ml-stable-diffusion
Stable Diffusion with Core ML on Apple Silicon
File Explorer
- pull_request_template.md
- randomSeed_11_computeUnit_CPU_AND_GPU_modelVersion_runwayml_stable-diffusion-v1-5.png
- randomSeed_11_computeUnit_CPU_AND_NE_modelVersion_runwayml_stable-diffusion-v1-5.png
- randomSeed_123456789_computeUnit_ALL_modelVersion_CompVis_stable-diffusion-v1-4.png
- randomSeed_123456789_computeUnit_CPU_AND_GPU_modelVersion_CompVis_stable-diffusion-v1-4.png
- randomSeed_123456789_computeUnit_CPU_AND_NE_modelVersion_CompVis_stable-diffusion-v1-4.png
- randomSeed_93_computeUnit_ALL_modelVersion_stabilityai_stable-diffusion-2-base.png
- randomSeed_93_computeUnit_CPU_AND_GPU_modelVersion_stabilityai_stable-diffusion-2-base.png
- randomSeed_93_computeUnit_CPU_AND_NE_modelVersion_stabilityai_stable-diffusion-2-base.png
- randomSeed_11_computeUnit_CPU_AND_GPU_modelVersion_stabilityai_stable-diffusion-2-base.png
- randomSeed_11_computeUnit_CPU_AND_NE_modelVersion_stabilityai_stable-diffusion-2-base.png
- randomSeed_13_computeUnit_ALL_modelVersion_CompVis_stable-diffusion-v1-4.png
- randomSeed_13_computeUnit_CPU_AND_GPU_modelVersion_CompVis_stable-diffusion-v1-4.png
- randomSeed_13_computeUnit_CPU_AND_NE_modelVersion_CompVis_stable-diffusion-v1-4.png
- randomSeed_93_computeUnit_ALL_modelVersion_runwayml_stable-diffusion-v1-5.png
- randomSeed_93_computeUnit_CPU_AND_GPU_modelVersion_runwayml_stable-diffusion-v1-5.png
- randomSeed_93_computeUnit_CPU_AND_NE_modelVersion_runwayml_stable-diffusion-v1-5.png
- a_high_quality_photo_of_a_surfing_dog.7667.final_3.41-bits.png
- a_high_quality_photo_of_a_surfing_dog.7667.final_4.50-bits.png
- a_high_quality_photo_of_a_surfing_dog.7667.final_6.55-bits.png
- a_high_quality_photo_of_a_surfing_dog.7667.final_float16_original.png
- runwayml_stable-diffusion-v1-5_psnr_vs_size.png
- stabilityai_stable-diffusion-2-1-base_psnr_vs_size.png
- stabilityai_stable-diffusion-xl-base-1.0_psnr_vs_size.png
- controlnet_readme_reel.png
- float16_cpuandne_readmereel.png
- float16_gpu_readmereel.png
- palette6_cpuandne_readmereel.png
- readme_reel.png
- __init__.py
- _version.py
- activation_quantization.py
- attention.py
- chunk_mlprogram.py
- controlnet.py
- coreml_model.py
- layer_norm.py
- mixed_bit_compression_apply.py
- mixed_bit_compression_pre_analysis.py
- multilingual_projection.py
- pipeline.py
- torch2coreml.py
- unet.py
- CGImage+vImage.swift
- ControlNet.swift
- Decoder.swift
- DiscreteFlowScheduler.swift
- DPMSolverMultistepScheduler.swift
- Encoder.swift
- ManagedMLModel.swift
- MultilingualTextEncoder.swift
- MultiModalDiffusionTransformer.swift
- NumPyRandomSource.swift
- NvRandomSource.swift
- RandomSource.swift
- ResourceManaging.swift
- SafetyChecker.swift
- SampleTimer.swift
- Scheduler.swift
- StableDiffusion3Pipeline+Resources.swift
- StableDiffusion3Pipeline.swift
- StableDiffusionPipeline+Resources.swift
- StableDiffusionPipeline.Configuration.swift
- StableDiffusionPipeline.swift
- StableDiffusionXL+Resources.swift
- StableDiffusionXLPipeline.swift
- TextEncoder.swift
- TextEncoderT5.swift
- TextEncoderXL.swift
- TorchRandomSource.swift
- Unet.swift
- BPETokenizer+Reading.swift
- BPETokenizer.swift
- T5Tokenizer.swift
- main.swift
- merges.txt
- vocab.json
- StableDiffusionTests.swift
- __init__.py
- test_stable_diffusion.py
- .gitignore
- ACKNOWLEDGEMENTS
- CODE_OF_CONDUCT.md
- CONTRIBUTING.md
- LICENSE.md
- Package.swift
- README.md
- requirements.txt
- setup.py
# Installation Guide
python- Python 3.8+
- macOS 13.1+
- coremltools 7.0+
Setup Steps
pip install -r requirements.txt
Install Python dependency packages.
pip install .
Install the python coreml stable diffusion package.
Key Commands
pip install -r requirements.txt
Install the required Python packages for the project.
python -m pip install .
Install the python_coreml_stable_diffusion package locally.
# Use via CDN
jsDelivrjsDelivr serves any public GitHub repository as a CDN with zero setup. Pick a version and a file to get a ready-to-paste link and snippet.
Release Timeline
Command Glossary
Commands referenced in this DOCs, explained below.
conda activate
View Details ▼
conda activate
Activate a conda environment.
See also: `conda deactivate`.
conda activate myenv
Activate an existing environment named `myenv`:
conda activate {{path/to/myenv}}
Activate an existing environment located at custom path:
conda activate --stack myenv
Stack `myenv` environment on top of a previous environment making libraries/commands/variables from both accessible:
conda create
View Details ▼
conda create
Create new conda environments.
conda create {{[-y|--yes]}} {{[-n|--name]}} py39 python=3.9 "numpy>=1.11" scipy
Create a new environment named `py39`, install Python 3.9, NumPy v1.11 or above in it, and the latest stable version of SciPy. Say yes to all confirmations:
conda create {{[-n|--name]}} myenv --file {{file1.yml}} --file {{file2.yml}}
Create a new environment named `myenv` and install packages listed in files:
conda create {{[-p|--prefix]}} {{path/to/myenv}}
Create a new environment at a custom path (i.e. prefix):
git clone
View Details ▼
git clone
Clone an existing repository.
git clone {{remote_repository_location}} {{path/to/directory}}
Clone an existing repository into a new directory (the default directory is the repository name):
git clone --recursive {{remote_repository_location}}
Clone an existing repository and its submodules:
git clone {{[-n|--no-checkout]}} {{remote_repository_location}}
Clone only the `.git` directory of an existing repository:
git lfs
View Details ▼
git lfs
Work with large files in Git repositories.
git lfs install
Initialize Git LFS:
git lfs track '{{*.bin}}'
Track files that match a glob:
git config {{[-f|--file]}} .lfsconfig lfs.url {{lfs_endpoint_url}}
Change the Git LFS endpoint URL (useful if the LFS server is separate from the Git server):
git
View Details ▼
git
Distributed version control system.
Some subcommands such as `commit`, `add`, `branch`, `switch`, `push`, etc. have their own usage documentation.
git init
Create an empty Git repository:
git clone {{https://example.com/repo.git}}
Clone a remote Git repository from the internet:
git status
View the status of the local repository:
huggingface-cli
View Details ▼
huggingface-cli
This command is an alias of `hf`.
tldr hf
View documentation for the original command:
pip install
View Details ▼
pip install
Install Python packages.
pip install {{package1 package2 ...}}
Install one or more packages:
pip install {{package1 package2 ...}} {{[-U|--upgrade]}}
Upgrade all specified packages to the latest version, installing any that are not already present:
pip install {{package}}=={{version}}
Install a specific version of a package:
python
View Details ▼
python
Python language interpreter.
python
Start a REPL (interactive shell):
python {{path/to/file.py}}
Execute a specific Python file:
python -i {{path/to/file.py}}
Execute a specific Python file and start a REPL:
swift
View Details ▼
swift
Create, run, and build Swift projects.
swift repl
Start a REPL (interactive shell):
swift {{file.swift}}
Execute a program:
swift package init
Start a new project with the package manager:
