ml-stable-diffusion icon indicating copy to clipboard operation
ml-stable-diffusion copied to clipboard

Incompatible Architecture issue when Converting Models to Core ML

Open ankushagarwal opened this issue 3 years ago • 2 comments

I am on an M1 Mac and created the conda environment using

CONDA_SUBDIR=osx-arm64 conda create -n coreml_stable_diffusion python=3.8 -y

Yet when I try to generate Core ML model files by running python -m python_coreml_stable_diffusion.torch2coreml --convert-unet, I run into this issue :

(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

Here's the full error:

ImportError: dlopen(/Users/kush/opt/miniconda3/envs/coreml_stable_diffusion/lib/python3.8/site-packages/tokenizers/tokenizers.cpython-38-darwin.so, 0x0002): 
tried: '/Users/kush/opt/miniconda3/envs/coreml_stable_diffusion/lib/python3.8/site-packages/tokenizers/tokenizers.cpython-38-darwin.so' 
(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')),

'/System/Volumes/Preboot/Cryptexes/OS/Users/kush/opt/miniconda3/envs/coreml_stable_diffusion/lib/python3.8/site-packages/tokenizers/tokenizers.cpython-38-darwin.so' (no such file), 
'/Users/kush/opt/miniconda3/envs/coreml_stable_diffusion/lib/python3.8/site-packages/tokenizers/tokenizers.cpython-38-darwin.so' 
(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

ankushagarwal avatar Dec 02 '22 00:12 ankushagarwal

You might need to build the tokenizers package from source https://github.com/huggingface/tokenizers/issues/712

adammarples avatar Dec 02 '22 16:12 adammarples

Sounds good. Thanks @adammarples 🙏 - will give that a shot!

ankushagarwal avatar Dec 02 '22 17:12 ankushagarwal