-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Converting fine-tuned ggml model to CoreML. Invalid model name
error.
#1296
Comments
Workaround (HF -> PT -> CoreML)I found a workaround by converting a HuggingFace model to PyTorch first and then modify the existing convert-whisper-to-coreml.py script slightly to accomodate for a custom model name.
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--model", type=str, help="model to convert (e.g. tiny, tiny.en, base, base.en, small, small.en, medium, medium.en, large, large-v1)", required=True)
parser.add_argument("--encoder-only", type=bool, help="only convert encoder", default=False)
parser.add_argument("--quantize", type=bool, help="quantize weights to F16", default=False)
parser.add_argument("--optimize-ane", type=bool, help="optimize for ANE execution (currently broken)", default=False)
args = parser.parse_args()
############ Comment out the model name checking below ############
"""
if args.model not in ["tiny", "tiny.en", "base", "base.en", "small", "small.en", "medium", "medium.en", "large", "large-v1"]:
raise ValueError("Invalid model name")
"""
whisper = load_model(args.model).cpu()
hparams = whisper.dims
print(hparams)
TestsI tested workaround with a fine-tuned small model and it worked quite well. |
@AlienKevin Thank you! Can you clarify about these lines?
Do I need to create some py file and put those lines in there and then run it in console? Sorry, I'm not very familiar with Python. |
@Sogl Yeah, you can create a python file and run the two lines I mentioned. Alternatively, you can add those to the end of the jupyter notebook that you use to fine-tune the model. Either way works. |
How about creating a PR for this? |
@bobqianic Submitted a PR. I tried to keep the script simple by reusing the existing |
I want to convert this model: https://huggingface.co/mitchelldehaven/whisper-large-v2-ru/tree/main to CoreML
First, I successfully converted bin to ggml using the following instructions: https://github.com/ggerganov/whisper.cpp/tree/master/models#fine-tuned-models
But when trying to convert ggml to CoreML version, an error occurs:
I also tried @akeybl hack from here: #1088 (comment)
but I don't have
.pt
file or URL for it 😢So I ended up with another error:
https://github.com/ggerganov/whisper.cpp/blob/master/models/convert-whisper-to-coreml.py#L308
Related issue: #947
Any thoughts?
The text was updated successfully, but these errors were encountered: