Views
No views yet
torch2coreml), MIT licensed, Copyright (c) 2024 Apple Inc.| Component | Precision | Size |
|---|---|---|
UnetChunk1.mlmodelc + UnetChunk2.mlmodelc | 6-bit palettized | 645 MB |
TextEncoder.mlmodelc | float16 | 246 MB |
VAEDecoder.mlmodelc | float16 | 99 MB |
merges.txt, vocab.json | — | 1.4 MB |
SPLIT_EINSUM_V2, so the models are meant for the Neural Engine
(MLComputeUnits.cpuAndNeuralEngine). Running them on the GPU instead is
markedly slower.python -m python_coreml_stable_diffusion.torch2coreml \
--model-version SG161222/Realistic_Vision_V5.1_noVAE \
--convert-unet --convert-text-encoder --convert-vae-decoder \
--attention-implementation SPLIT_EINSUM_V2 \
--quantize-nbits 6 --chunk-unet \
--bundle-resources-for-swift-cli \
--compute-unit CPU_AND_NE --latent-h 64 --latent-w 64 \
-o outquantize_weights quantizes unet, but with --chunk-unet it is
unet_chunk1/unet_chunk2 that get bundled — and chunking runs before
quantization. Left alone, the shipped chunks stay float16. The U-Net is
quantized before it is cut.chunk_mlprogram.py calls .index() and integer subscripts on
Block.operations, which is a CacheDoublyLinkedList in coremltools 8 rather
than a list.-inf, and k-means
palettization fails on it.StableDiffusionPipeline(resourcesAt:) at a directory holding
these files, flat, and set computeUnits to .cpuAndNeuralEngine.