coremltools: CoreML/MLShapedArray.swift:557: Fatal error: MLMultiArray of data type Float16 is not supported.

🐞Describing the bug

After updating coremltools from 7.0b1 to 7.0b2, Stable Diffusion 1.5 type models converted from .safetensors to coreml throw this error when used in a Swift CLI inference pipeline:

Sampling ...
CoreML/MLShapedArray.swift:557: Fatal error: MLMultiArray of data type Float16 is not supported.
zsh: trace trap  stablediffusion --step-count=10 --scheduler dpmpp  

Stack Trace

See above

To Reproduce

Conversion commands:

python convert_original_stable_diffusion_to_diffusers.py --checkpoint_path ./*.safetensors --from_safetensors --device cpu --extract_ema --dump_path ./realisticVisionV51_v51VAE_diffusers
python -m python_coreml_stable_diffusion.torch2coreml --latent-w 48 --latent-h 80 --compute-unit CPU_AND_GPU --convert-vae-decoder --convert-vae-encoder --convert-unet --unet-support-controlnet --convert-text-encoder --model-version ./realisticVisionV51_v51VAE_diffusers --bundle-resources-for-swift-cli --attention-implementation ORIGINAL -o realisticVisionV51_v51VAE_original_384x640 && python -m python_coreml_stable_diffusion.torch2coreml --latent-w 48 --latent-h 80 --compute-unit CPU_AND_GPU --convert-unet --model-version ./realisticVisionV51_v51VAE_diffusers --bundle-resources-for-swift-cli --attention-implementation ORIGINAL -o realisticVisionV51_v51VAE_original_384x640
  • If the model conversion succeeds, but there is a numerical mismatch in predictions, please include the code used for comparisons.
swift run StableDiffusionSample "a photo of a goat" --seed 12 --guidance-scale 8.0 --step-count 10 --image-count 1 --scheduler dpmpp --compute-units cpuAndGPU --resource-path ../models/realisticVisionV51_v51VAE_original_384x640 --output-path ../images

System environment (please complete the following information):

  • coremltools version: 7.0b2
  • macOS 13.5
  • ml-stable-diffusion 1.0.0

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 15

Most upvoted comments

I commented in the other issue. I think this is an issue that needs to be fixed in the stable diffusion repository.