Open rradjabi opened 6 months ago
I have the exact same issue
I get the same error when trying to convert: https://huggingface.co/HuggingFaceTB/SmolLM-1.7B
I'm wondering if this is one of the situations where the torch operation -> CoreML Operation mapping does not automatically work (i.e. requires us to write our own operator: https://apple.github.io/coremltools/docs-guides/source/custom-operators.html
@rradjabi try installing coremltools 8 and a newer version of transformers! I was able to run this conversion just fine 👏 (with my own memory fixing patch ofcourse).
@Proryanator Could you please provide more details about your fix? Thanks
@Proryanator Could you please provide more details about your fix? Thanks
Yeah sure! Let me collect the specific details (it was a bit complicated in the end).
In a nutshell though:
Out of Memory Issue For some models (not even the ones that were that large) including llama2, I would get an out of memory error on my M3 Max w/ 36GB of RAM. This happened when coremltools tried to load the converted model toward the end. Figured out that making a 1 line change to exporters would fix this issue for me, here is that change: https://github.com/huggingface/exporters/pull/83
Unsupported 'full' op
It was either from upgrading to coremltools 8.0b1 where this op issue went away, or using an older version of transformers
that fixed the issue for me (I did both so I can't say which one at the moment). Lemme double check and I can get back to you though with specifics (pretty sure it was the transformers
version though).
I'm unable to use
exporters
formeta-llama/Llama-2-7b-chat-hf
model.Here is my command
And here is the output
I was able to generate a
mlpackage
fordistilbert-base-uncased-finetuned-sst-2-english
, with this command:python -m exporters.coreml --model=distilbert-base-uncased-finetuned-sst-2-english --feature=sequence-classification models/defaults.mlpackage
, so I have some confidence that the environment is correct and working.