Stop converting mlmodec files after converted mlpackage files
Hi, I am using stabilityai/stable-diffusion-2 to test convert a v- prediction model. And I meet a problem that after converting files it stops converting and shows files not found. I did same way one week ago and get mlmodec file successfully. I tried sdv1.5, 2.0-base and 2.0, they have same problem, I am confused where I did wrong.
here is the command : python -m python_coreml_stable_diffusion.torch2coreml --convert-unet --convert-text-encoder --convert-vae-decoder --convert-safety-checker --model-version stabilityai/stable-diffusion-2 -o sd2 --bundle-resources-for-swift-cli --chunk-unet
here is the error:
INFO:main:Saved text_encoder into sd2/Stable_Diffusion_version_stabilityai_stable-diffusion-2_text_encoder.mlpackage
INFO:main:Converted text_encoder
INFO:main:Converting safety_checker
WARNING:main:diffusers pipeline for stabilityai/stable-diffusion-2 does not have a safety_checker module! --convert-safety-checker will be ignored.
INFO:main:Converted safety_checker
INFO:main:Bundling resources for the Swift CLI
INFO:main:Created sd2/Resources for Swift CLI assets
INFO:main:Compiling sd2/Stable_Diffusion_version_stabilityai_stable-diffusion-2_text_encoder.mlpackage
xcrun: error: unable to find utility "coremlcompiler", not a developer tool or in PATH
Traceback (most recent call last):
File "/Users/felix/anaconda3/envs/coreml_stable_diffusion/lib/python3.8/shutil.py", line 791, in move
os.rename(src, real_dst)
FileNotFoundError: [Errno 2] No such file or directory: 'sd2/Resources/Stable_Diffusion_version_stabilityai_stable-diffusion-2_text_encoder.mlmodelc' -> 'sd2/Resources/TextEncoder.mlmodelc'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/felix/anaconda3/envs/coreml_stable_diffusion/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Users/felix/anaconda3/envs/coreml_stable_diffusion/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/felix/ml-stable-diffusion/python_coreml_stable_diffusion/torch2coreml.py", line 1427, in
You could try this, because of the xcrun: error: unable to find utility "coremlcompiler", not a developer tool or in PATH line in the above error mesage:
xcrun: error: unable to find utility "coremlcompiler", not a developer tool or in PATH:
Open Xcode and go to "Settings..." → "Locations" then click on the "Command Line Tools" drop-down menu and reselect the Command Line Tools version
From: https://github.com/godly-devotion/MochiDiffusion/wiki/How-to-convert-Stable-Diffusion-models-to-Core-ML#terminal-errors