The dataset viewer is not available for this split.
Error code: StreamingRowsError
Exception: CastError
Message: Couldn't cast
digest: string
kind: string
path: string
payload_sha3: string
prev: string
seq: int64
ts: timestamp[s]
method: struct<aggregate_rule: string, excluded: string, reproduce: string, thresholds_note: string>
child 0, aggregate_rule: string
child 1, excluded: string
child 2, reproduce: string
child 3, thresholds_note: string
passed: int64
schema: string
version: string
failed_ids: list<item: null>
child 0, item: null
total: int64
platform: string
benchmarks: list<item: struct<evidence: struct<ceilings: struct<max_files: int64, max_lines: int64, min_lines: i (... 3032 chars omitted)
child 0, item: struct<evidence: struct<ceilings: struct<max_files: int64, max_lines: int64, min_lines: int64>, code (... 3020 chars omitted)
child 0, evidence: struct<ceilings: struct<max_files: int64, max_lines: int64, min_lines: int64>, code_lines: int64, co (... 2949 chars omitted)
child 0, ceilings: struct<max_files: int64, max_lines: int64, min_lines: int64>
child 0, max_files: int64
child 1, max_lines: int64
child 2, min_lines: int64
child 1, code_lines: int64
child 2, command: string
child 3, counts_command: string
child 4, files_source: int64
child 5, files_tests: int64
child 6, files_total: int64
child 7, method: string
child 8, test_to_source_line_ratio: double
child 9, total_lines: int64
child 10, a_licences: list<item: strin
...
detail: string
child 1, evidence_path: string
child 2, present: bool
child 6, rerunnable_verification: struct<detail: string, evidence_path: string, present: bool>
child 0, detail: string
child 1, evidence_path: string
child 2, present: bool
child 7, versioning: struct<detail: string, evidence_path: string, present: bool>
child 0, detail: string
child 1, evidence_path: string
child 2, present: bool
child 62, criteria_missing: list<item: null>
child 0, item: null
child 63, criteria_satisfied: int64
child 64, criteria_total: int64
child 65, framework_controls_verified: int64
child 66, ladder: string
child 67, observed_level: int64
child 68, source: string
child 69, trL9_claimed: bool
child 70, trL9_reason: string
child 1, id: string
child 2, ok: bool
child 3, status: string
child 4, title: string
root: string
source: struct<git: struct<head: string, url: string, branch: string, sha_verified_from: string>>
child 0, git: struct<head: string, url: string, branch: string, sha_verified_from: string>
child 0, head: string
child 1, url: string
child 2, branch: string
child 3, sha_verified_from: string
failed: int64
all_passed: bool
sbom_written: bool
python: string
to
{'all_passed': Value('bool'), 'benchmarks': List({'evidence': {'ceilings': {'max_files': Value('int64'), 'max_lines': Value('int64'), 'min_lines': Value('int64')}, 'code_lines': Value('int64'), 'command': Value('string'), 'counts_command': Value('string'), 'files_source': Value('int64'), 'files_tests': Value('int64'), 'files_total': Value('int64'), 'method': Value('string'), 'test_to_source_line_ratio': Value('float64'), 'total_lines': Value('int64'), 'a_licences': List(Value('string')), 'b_licences': List(Value('string')), 'default_for_unknown_is_C': Value('bool'), 'mismatches': {}, 'observed': {'agpl3': Value('string'), 'apache2': Value('string'), 'bsd3': Value('string'), 'commons_clause': Value('string'), 'garbage': Value('string'), 'gpl3': Value('string'), 'isc': Value('string'), 'lgpl': Value('string'), 'mit': Value('string'), 'mpl2': Value('string'), 'noncommercial': Value('string'), 'proprietary': Value('string'), 'sspl': Value('string'), 'unknown_absent': Value('string')}, 'only_class_A_may_relicense': Value('bool'), 'policy_probes': {'agpl3': Value('string'), 'apache2': Value('string'), 'bsd3': Value('string'), 'commons_clause': Value('string'), 'garbage': Value('string'), 'gpl3': Value('string'), 'isc': Value('string'), 'lgpl': Value('string'), 'mit': Value('string'), 'mpl2': Value('string'), 'noncommercial': Value('string'), 'proprietary': Value('string'), 'sspl': Value('string'), 'unknown_absent': Value('string')}, 'project_licence': {'LICENSE': Value('string'), '
...
Value('string'), 'evidence_path': Value('string'), 'present': Value('bool')}, 'qualification_environment_pinned': {'detail': Value('string'), 'evidence_path': Value('string'), 'present': Value('bool')}, 'reproducible_tests': {'detail': Value('string'), 'evidence_path': Value('string'), 'present': Value('bool')}, 'rerunnable_verification': {'detail': Value('string'), 'evidence_path': Value('string'), 'present': Value('bool')}, 'versioning': {'detail': Value('string'), 'evidence_path': Value('string'), 'present': Value('bool')}}, 'criteria_missing': List(Value('null')), 'criteria_satisfied': Value('int64'), 'criteria_total': Value('int64'), 'framework_controls_verified': Value('int64'), 'ladder': Value('string'), 'observed_level': Value('int64'), 'source': Value('string'), 'trL9_claimed': Value('bool'), 'trL9_reason': Value('string')}, 'id': Value('string'), 'ok': Value('bool'), 'status': Value('string'), 'title': Value('string')}), 'failed': Value('int64'), 'failed_ids': List(Value('null')), 'method': {'aggregate_rule': Value('string'), 'excluded': Value('string'), 'reproduce': Value('string'), 'thresholds_note': Value('string')}, 'passed': Value('int64'), 'platform': Value('string'), 'python': Value('string'), 'root': Value('string'), 'sbom_written': Value('bool'), 'schema': Value('string'), 'total': Value('int64'), 'version': Value('string'), 'source': {'git': {'head': Value('string'), 'url': Value('string'), 'branch': Value('string'), 'sha_verified_from': Value('string')}}}
because column names don't match
Traceback: Traceback (most recent call last):
File "/src/services/worker/src/worker/utils.py", line 147, in get_rows_or_raise
return get_rows(
dataset=dataset,
...<4 lines>...
column_names=column_names,
)
File "/src/libs/libcommon/src/libcommon/utils.py", line 272, in decorator
return func(*args, **kwargs)
File "/src/services/worker/src/worker/utils.py", line 127, in get_rows
rows_plus_one = list(itertools.islice(safe_iter(ds, dataset=dataset), rows_max_number + 1))
File "/src/services/worker/src/worker/utils.py", line 483, in safe_iter
yield from ds.decode(False) if ds.features else ds
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2951, in __iter__
for key, example in ex_iterable:
^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2461, in __iter__
for key, pa_table in self._iter_arrow():
~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2486, in _iter_arrow
for key, pa_table in self.ex_iterable._iter_arrow():
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 547, in _iter_arrow
for key, pa_table in iterator:
^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 430, in _iter_arrow
for key, pa_table in self.generate_tables_fn(**gen_kwags):
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 343, in _generate_tables
self._cast_table(pa_table, json_field_paths=json_field_paths),
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 132, in _cast_table
pa_table = table_cast(pa_table, self.info.features.arrow_schema)
File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2378, in table_cast
return cast_table_to_schema(table, schema)
File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2306, in cast_table_to_schema
raise CastError(
...<3 lines>...
)
datasets.table.CastError: Couldn't cast
digest: string
kind: string
path: string
payload_sha3: string
prev: string
seq: int64
ts: timestamp[s]
method: struct<aggregate_rule: string, excluded: string, reproduce: string, thresholds_note: string>
child 0, aggregate_rule: string
child 1, excluded: string
child 2, reproduce: string
child 3, thresholds_note: string
passed: int64
schema: string
version: string
failed_ids: list<item: null>
child 0, item: null
total: int64
platform: string
benchmarks: list<item: struct<evidence: struct<ceilings: struct<max_files: int64, max_lines: int64, min_lines: i (... 3032 chars omitted)
child 0, item: struct<evidence: struct<ceilings: struct<max_files: int64, max_lines: int64, min_lines: int64>, code (... 3020 chars omitted)
child 0, evidence: struct<ceilings: struct<max_files: int64, max_lines: int64, min_lines: int64>, code_lines: int64, co (... 2949 chars omitted)
child 0, ceilings: struct<max_files: int64, max_lines: int64, min_lines: int64>
child 0, max_files: int64
child 1, max_lines: int64
child 2, min_lines: int64
child 1, code_lines: int64
child 2, command: string
child 3, counts_command: string
child 4, files_source: int64
child 5, files_tests: int64
child 6, files_total: int64
child 7, method: string
child 8, test_to_source_line_ratio: double
child 9, total_lines: int64
child 10, a_licences: list<item: strin
...
detail: string
child 1, evidence_path: string
child 2, present: bool
child 6, rerunnable_verification: struct<detail: string, evidence_path: string, present: bool>
child 0, detail: string
child 1, evidence_path: string
child 2, present: bool
child 7, versioning: struct<detail: string, evidence_path: string, present: bool>
child 0, detail: string
child 1, evidence_path: string
child 2, present: bool
child 62, criteria_missing: list<item: null>
child 0, item: null
child 63, criteria_satisfied: int64
child 64, criteria_total: int64
child 65, framework_controls_verified: int64
child 66, ladder: string
child 67, observed_level: int64
child 68, source: string
child 69, trL9_claimed: bool
child 70, trL9_reason: string
child 1, id: string
child 2, ok: bool
child 3, status: string
child 4, title: string
root: string
source: struct<git: struct<head: string, url: string, branch: string, sha_verified_from: string>>
child 0, git: struct<head: string, url: string, branch: string, sha_verified_from: string>
child 0, head: string
child 1, url: string
child 2, branch: string
child 3, sha_verified_from: string
failed: int64
all_passed: bool
sbom_written: bool
python: string
to
{'all_passed': Value('bool'), 'benchmarks': List({'evidence': {'ceilings': {'max_files': Value('int64'), 'max_lines': Value('int64'), 'min_lines': Value('int64')}, 'code_lines': Value('int64'), 'command': Value('string'), 'counts_command': Value('string'), 'files_source': Value('int64'), 'files_tests': Value('int64'), 'files_total': Value('int64'), 'method': Value('string'), 'test_to_source_line_ratio': Value('float64'), 'total_lines': Value('int64'), 'a_licences': List(Value('string')), 'b_licences': List(Value('string')), 'default_for_unknown_is_C': Value('bool'), 'mismatches': {}, 'observed': {'agpl3': Value('string'), 'apache2': Value('string'), 'bsd3': Value('string'), 'commons_clause': Value('string'), 'garbage': Value('string'), 'gpl3': Value('string'), 'isc': Value('string'), 'lgpl': Value('string'), 'mit': Value('string'), 'mpl2': Value('string'), 'noncommercial': Value('string'), 'proprietary': Value('string'), 'sspl': Value('string'), 'unknown_absent': Value('string')}, 'only_class_A_may_relicense': Value('bool'), 'policy_probes': {'agpl3': Value('string'), 'apache2': Value('string'), 'bsd3': Value('string'), 'commons_clause': Value('string'), 'garbage': Value('string'), 'gpl3': Value('string'), 'isc': Value('string'), 'lgpl': Value('string'), 'mit': Value('string'), 'mpl2': Value('string'), 'noncommercial': Value('string'), 'proprietary': Value('string'), 'sspl': Value('string'), 'unknown_absent': Value('string')}, 'project_licence': {'LICENSE': Value('string'), '
...
Value('string'), 'evidence_path': Value('string'), 'present': Value('bool')}, 'qualification_environment_pinned': {'detail': Value('string'), 'evidence_path': Value('string'), 'present': Value('bool')}, 'reproducible_tests': {'detail': Value('string'), 'evidence_path': Value('string'), 'present': Value('bool')}, 'rerunnable_verification': {'detail': Value('string'), 'evidence_path': Value('string'), 'present': Value('bool')}, 'versioning': {'detail': Value('string'), 'evidence_path': Value('string'), 'present': Value('bool')}}, 'criteria_missing': List(Value('null')), 'criteria_satisfied': Value('int64'), 'criteria_total': Value('int64'), 'framework_controls_verified': Value('int64'), 'ladder': Value('string'), 'observed_level': Value('int64'), 'source': Value('string'), 'trL9_claimed': Value('bool'), 'trL9_reason': Value('string')}, 'id': Value('string'), 'ok': Value('bool'), 'status': Value('string'), 'title': Value('string')}), 'failed': Value('int64'), 'failed_ids': List(Value('null')), 'method': {'aggregate_rule': Value('string'), 'excluded': Value('string'), 'reproduce': Value('string'), 'thresholds_note': Value('string')}, 'passed': Value('int64'), 'platform': Value('string'), 'python': Value('string'), 'root': Value('string'), 'sbom_written': Value('bool'), 'schema': Value('string'), 'total': Value('int64'), 'version': Value('string'), 'source': {'git': {'head': Value('string'), 'url': Value('string'), 'branch': Value('string'), 'sha_verified_from': Value('string')}}}
because column names don't matchNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
- What This Project Does
- System Requirements
- Performance Benchmarks
- Installation
- Usage
- API
- Section quoted from the upstream readme.
- Dependencies
- Configuration
- Weight Compression (6-bits and higher)
- Advanced Weight Compression (Lower than 6-bits)
- Contributing
- License
- Upstream
- Benchmarks
- Archives and Permanent Records
- Press and Independent Publication
STABLE DIFFUSION
Anticloud-hardened packaging of the upstream project
STABLE_DIFFUSIONin category ARTIST TOOLS. Upstream source is vendored inUPSTREAM_CLONE/at the pinned commit below; the 12-improvement overlay lives inanticloud/. Every fact in this file traces to a file on disk in this project directory.
Category: ARTIST TOOLS · Upstream: https://github.com/camenduru/stable-diffusion-webui-colab · Upstream pin: 035ea58aadfcb1b6158a2b9258777f94397845f7 · Vendor: Anticloud FZ LLE
What This Project Does
Core ML Stable Diffusion
Run Stable Diffusion on Apple Silicon with Core ML
This project comprises:
python_coreml_stable_diffusion, a Python package for converting PyTorch models to Core ML format and performing image generation with Hugging Face diffusers in PythonStableDiffusion, a Swift package that developers can add to their Xcode projects as a dependency to deploy image generation capabilities in their apps. The Swift package relies on the Core ML model files generated bypython_coreml_stable_diffusion
If you run into issues during installation or runtime, please refer to the FAQ section. Please refer to the System Requirements section before getting started.
System Requirements
Details (Click to expand)
Model Conversion:
| macOS | Python | coremltools |
|---|---|---|
| 13.1 | 3.8 | 7.0 |
Project Build:
| macOS | Xcode | Swift |
|---|---|---|
| 13.1 | 14.3 | 5.8 |
Target Device Runtime:
| macOS | iPadOS, iOS |
|---|---|
| 13.1 | 16.2 |
Target Device Runtime (With Memory Improvements):
| macOS | iPadOS, iOS |
|---|---|
| 14.0 | 17.0 |
Target Device Hardware Generation:
| Mac | iPad | iPhone |
|---|---|---|
| M1 | M1 | A14 |
Performance Benchmarks
Details (Click to expand)
stabilityai/stable-diffusion-2-1-base (512x512)
| Device | --compute-unit |
--attention-implementation |
End-to-End Latency (s) | Diffusion Speed (iter/s) |
|---|---|---|---|---|
| iPhone 12 Mini | CPU_AND_NE |
SPLIT_EINSUM_V2 |
18.5* | 1.44 |
| iPhone 12 Pro Max | CPU_AND_NE |
SPLIT_EINSUM_V2 |
15.4 | 1.45 |
| iPhone 13 | CPU_AND_NE |
SPLIT_EINSUM_V2 |
10.8* | 2.53 |
| iPhone 13 Pro Max | CPU_AND_NE |
SPLIT_EINSUM_V2 |
10.4 | 2.55 |
| iPhone 14 | CPU_AND_NE |
SPLIT_EINSUM_V2 |
8.6 | 2.57 |
| iPhone 14 Pro Max | CPU_AND_NE |
SPLIT_EINSUM_V2 |
7.9 | 2.69 |
| iPad Pro (M1) | CPU_AND_NE |
SPLIT_EINSUM_V2 |
11.2 | 2.19 |
| iPad Pro (M2) | CPU_AND_NE |
SPLIT_EINSUM_V2 |
7.0 | 3.07 |
Details (Click to expand)
- This benchmark was conducted by Apple and Hugging Face using public beta versions of iOS 17.0, iPadOS 17.0 and macOS 14.0 Seed 8 in August 2023.
- The performance data was collected using the
benchmarkbranch of the Diffusers app - Swift code is not fully optimized, introducing up to ~10% overhead unrelated to Core ML model execution.
- The median latency value across 5 back-to-back end-to-end executions are reported
- The image generation procedure follows the standard configuration: 20 inference steps, 512x512 output image resolution, 77 text token sequence length, classifier-free guidance (batch size of 2 for unet).
- The actual prompt length does not impact performance because the Core ML model is converted with a static shape that computes the forward pass for all of the 77 elements (
tokenizer.model_max_length) in the text token sequence regardless of the actual length of the input text. - Weights are compressed to 6 bit precision. Please refer to this section for details.
- Activations are in float16 precision for both the GPU and the Neural Engine.
*indicates that the reduceMemory option was enabled which loads and unloads models just-in-time to avoid memory shortage. This added up to 2 seconds to the end-to-end latency.- In the benchmark table, we report the best performing
--compute-unitand--attention-implementationvalues per device. The former does not modify the Core ML model and can be applied during runtime. The latter modifies the Core ML model. Note that the best performing compute unit is model version and hardware-specific. - Note that the performance optimizations in this project (e.g.
--attention-implementation) are generally applicable to Transformers and not customized to Stable Diffusion. Better performance may be observed upon custom kernel tuning. Therefore, these numbers do not represent peak HW capability. - Performance may vary across different versions of Stable Diffusion due to architecture changes in the model itself. Each reported number is specific to the model version mentioned in that context.
- Performance may vary due to factors like increased system load from other applications or suboptimal device thermal state.
stabilityai/stable-diffusion-xl-base-1.0-ios (768x768)
| Device | --compute-unit| --attention-implementation | End-to-End Latency (s) | Diffusion Speed (iter/s) |
| --------------------- | --------------- | ----------------------------
(excerpt; full text in UPSTREAM_CLONE/)
Quoted from the upstream README.md file in UPSTREAM_CLONE/.
Project-specific facts detected in this directory:
- Ecosystem: Python (manifests: setup.py, requirements.txt; scanned in UPSTREAM_CLONE)
- Top-level source layout:
assets/,python_coreml_stable_diffusion/,swift/,tests/ - Snapshot size: 86 files, 12259 lines of code (measured; see Benchmarks)
- Primary languages:
.swift(34),.png(28),.py(17),(none)(2),.md(2),.txt(2) - Upstream commit pinned for this packaging:
035ea58aadfcb1b6158a2b9258777f94397845f7
Installation
No installation section was found in the upstream readme, so the commands below are generated from the manifests detected in this project directory.
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e . # or: pip install -r requirements.txt
Overlay install (this project):
python -m pip install -e anticloud/ # overlay package with the 12 improvements
python anticloud/cli.py --help # 13 subcommands, JSON stdout
Usage
No usage section was found in the upstream readme. Entry points detected in this project directory:
python -m stable_diffusion # module entry point, when the package layout matches
Anticloud overlay CLI (available in every project):
python anticloud/cli.py --help # 13 subcommands, JSON stdout
python anticloud/cli.py checks # run the 16-check suite
API
Model Conversion:
| macOS | Python | coremltools |
|---|---|---|
| 13.1 | 3.8 | 7.0 |
Project Build:
| macOS | Xcode | Swift |
|---|---|---|
| 13.1 | 14.3 | 5.8 |
Target Device Runtime:
| macOS | iPadOS, iOS |
|---|---|
| 13.1 | 16.2 |
Target Device Runtime (With Memory Improvements):
| macOS | iPadOS, iOS |
|---|---|
| 14.0 | 17.0 |
Target Device Hardware Generation:
| Mac | iPad | iPhone |
|---|---|---|
| M1 | M1 | A14 |
Section quoted from the upstream readme.
Dependencies
| Metric | Value |
|---|---|
| Ecosystem | Python |
| Manifests detected | setup.py, requirements.txt |
| Files in snapshot | 86 |
| Lines of code | 12259 |
| Dependency references | 5 |
| Dependencies by ecosystem | pypi: 5 |
| Upstream license | MIT |
| Overlay license | Anticommons 0.1.0 |
Top dependency references recorded in the benchmark snapshot:
| Ecosystem | Name | Version | Source file |
|---|---|---|---|
| pypi | coremltools | >=8.0 | setup.py |
| pypi | transformers | ==4.44.2 | setup.py |
| pypi | huggingface-hub | ==0.24.6 | setup.py |
| pypi | numpy | <1.24 | setup.py |
| pypi | diffusionkit | ==0.4.0 | setup.py |
Pinned lockfile: anticloud/requirements.lock (hash-pinned, PEP 508). SBOM: sbom.cdx.json (CycloneDX 1.5, pinned to the upstream SHA).
Configuration
- The actual prompt length does not impact performance because the Core ML model is converted with a static shape that computes the forward pass for all of the 77 elements (
tokenizer.model_max_length) in the text token sequence regardless of the actual length of the input text. - Weights are compressed to 6 bit precision. Please refer to this section for details.
- Activations are in float16 precision for both the GPU and the Neural Engine.
*indicates that the reduceMemory option was enabled which loads and unloads models just-in-time to avoid memory shortage. This added up to 2 seconds to the end-to-end latency.- In the benchmark table, we report the best performing
--compute-unitand--attention-implementationvalues per device. The former does not modify the Core ML model and can be applied during runtime. The latter modifies the Core ML model. Note that the best performing compute unit is model version and hardware-specific. - Note that the performance optimizations in this project (e.g.
--attention-implementation) are generally applicable to Transformers and not customized to Stable Diffusion. Better performance may be observed upon custom kernel tuning. Therefore, these numbers do not represent peak HW capability. - Performance may vary across different versions of Stable Diffusion due to architecture changes in the model itself. Each reported number is specific to the model version mentioned in that context.
- Performance may vary due to factors like increased system load from other applications or suboptimal device thermal state.
stabilityai/stable-diffusion-xl-base-1.0-ios (768x768)
| Device | --compute-unit |
--attention-implementation |
End-to-End Latency (s) | Diffusion Speed (iter/s) |
|---|---|---|---|---|
| iPhone 12 Pro | CPU_AND_NE |
SPLIT_EINSUM |
116* | 0.50 |
| iPhone 13 Pro Max | CPU_AND_NE |
SPLIT_EINSUM |
86* | 0.68 |
| iPhone 14 Pro Max | CPU_AND_NE |
SPLIT_EINSUM |
77* | 0.83 |
| iPhone 15 Pro Max | CPU_AND_NE |
SPLIT_EINSUM |
31 | 0.85 |
| iPad Pro (M1) | CPU_AND_NE |
SPLIT_EINSUM |
36 | 0.69 |
| iPad Pro (M2) | CPU_AND_NE |
SPLIT_EINSUM |
27 | 0.98 |
Details (Click to expand)
- This benchmark was conducted by Apple and Hugging Face using iOS 17.0.2 and iPadOS 17.0.2 in September 2023.
- The performance data was collected using the
benchmarkbranch of the Diffusers app - The median latency value across 5 back-to-back end-to-end executions are reported
- The image generation procedure follows this configuration: 20 inference steps, 768x768 output image resolution, 77 text token sequence length, classifier-free guidance (batch size of 2 for unet).
Unet.mlmodelcis compressed to 4.04 bit precision following the Mixed-Bit Palettization algorithm recipe published here- All models except for
Unet.mlmodelcare compressed to 16 bit precision - madebyollin/sdxl-vae-fp16-fix by @madebyollin was used as the source PyTorch model for
VAEDecoder.mlmodelcin order to enable float16 weight and activation quantization for the VAE model. --attention-implementation SPLIT_EINSUMis chosen in lieu ofSPLIT_EINSUM_V2due to the prohibitively long compilation time of the latter*indicates that the reduceMemory option was enabled which loads and unloads models just-in-time to avoid memory shortage. This added significant overhead to the end-to-end latency. Note that end-to-end latency difference betweeniPad Pro (M1)andiPhone 13 Pro Maxdespite identical diffusion speed.- The actual prompt length does not impact performance because the Core ML model is converted with a static shape that computes the forward pass for all of the 77 elements (
tokenizer.model_max_length) in the text token sequence regardless of the actual length of the input text. - In the benchmark table, we report the best performing
--compute-unitand--attention-implementationvalues per device. The former does not modify the Core ML model and can be applied during runtime. The latter modifies the Core ML model. Note that the best performing compute unit is model version and hardware-specific. - Note that the performance optimizations in this project (e.g.
--attention-implementation) are generally applicable to Transformers and not customized to Stable Diffusion. Better performance may be observed upon custom kernel tuning. Therefore, these numbers do not represent peak HW capability. - Performance may vary across different versions of Stable Diffusion due to architecture changes in the model itself. Each reported number is specific to the model version mentioned in that context.
- Performance may vary due to factors like increased system load from other applications or suboptimal device thermal state.
stabilityai/stable-diffusion-xl-base-1.0 (1024x1024)
| Device | --compute-unit |
--attention-implementation |
End-to-End Latency (s) | Diffusion Speed (iter/s) |
|---|---|---|---|---|
| MacBook Pro (M1 Max) | CPU_AND_GPU |
ORIGINAL |
46 | 0.46 |
| MacBook Pro (M2 Max) | CPU_AND_GPU |
ORIGINAL |
37 | 0.57 |
| Mac Studio (M1 Ultra) | CPU_AND_GPU |
ORIGINAL |
25 | 0.89 |
| Mac Studio (M2 Ultra) | CPU_AND_GPU |
ORIGINAL |
20 | 1.11 |
Details (Click to expand)
- This benchmark was conducted by Apple and Hugging Face using public beta versions of iOS 17.0, iPadOS 17.0 and macOS 14.0 in July 2023.
- The performance data was collected by running the
StableDiffusionSwift pipeline. - The median latency value across 3 back-to-back end-to-end executions are reported
- The image generation procedure follows the standard configuration: 20 inference steps, 1024x1024 output image resolution, classifier-free guidance (batch size of 2 for unet).
- Weights and activations are in float16 precision
- Performance may vary across different versions of Stable Diffusion due to architecture changes in the model itself. Each reported number is specific to the model version mentioned in that context.
- Performance may vary due to factors like increased system load from other applications or suboptimal device thermal state. Given these factors, we do not report sub-second variance in latency.
Weight Compression (6-bits and higher)
Details (Click to expand)
coremltools-7.0 supports advanced weight compression techniques for pruning, palettization and linear 8-bit quantization. For these techniques, coremltools.optimize.torch.* includes APIs that require fine-tuning to maintain accuracy at higher compression rates whereas coremltools.optimize.coreml.* includes APIs that are applied post-training and are data-free.
We demonstrate how data-free post-training palettization implemented in coremltools.optimize.coreml.palettize_weights enables us to achieve greatly improved performance for Stable Diffusion on mobile devices. This API implements the Fast Exact k-Means algorithm for optimal weight clustering which yields more accurate palettes. Using --quantize-nbits {2,4,6,8} during conversion is going to apply this compression to the unet and text_encoder models.
For best results, we recommend training-time palettization: coremltools.optimize.torch.palettization.DKMPalettizer if fine-tuning your model is feasible. This API implements the Differentiable k-Means (DKM) learned palettization algorithm. In this exercise, we stick to post-training palettization for the sake of simplicity and ease of reproducibility.
The Neural Engine is capable of accelerating models with low-bit palettization: 1, 2, 4, 6 or 8 bits. With iOS 17 and macOS 14, compressed weights for Core ML models can be just-in-time decompressed during runtime (as opposed to ahead-of-time decompression upon load) to match the precision of activation tensors. This yields significant memory savings and enables models to run on devices with smaller RAM (e.g. iPhone 12 Mini). In addition, compressed weights are faster to fetch from memory which reduces the latency of memory bandwidth-bound layers. The just-in-time decompression behavior depends on the compute unit, layer type and hardware generation.
| Weight Precision | --compute-unit |
stabilityai/stable-diffusion-2-1-base generating "a high quality photo of a surfing dog" |
|---|---|---|
| 6-bit | cpuAndNeuralEngine | ![]() |
| 16-bit | cpuAndNeuralEngine | ![]() |
| 16-bit | cpuAndGPU | ![]() |
Note that there are minor differences across 16-bit (float16) and 6-bit results. These differences are comparable to the differences across float16 and float32 or differences across compute units as exemplified above. We recommend a minimum of 6 bits for palettizing Stable Diffusion. Smaller number of bits (1, 2 and 4) will require either fine-tuning or advanced palettization techniques such as MBP.
Resources:
Advanced Weight Compression (Lower than 6-bits)
Details (Click to expand)
This section describes an advanced compression algorithm called Mixed-Bit Palettization (MBP) built on top of the Post-Training Weight Palettization tools and using the Weights Metadata API from coremltools.
MBP builds a per-layer "palettization recipe" by picking a suitable number of bits among the Neural Engine supported bit-widths of 1, 2, 4, 6 and 8 in order to achieve the minimum average bit-width while maintaining a desired level of signal strength. The signal strength is measured by comparing the compressed model's output to that of the original float16 model. Given the same random seed and text prompts, PSNR between denoised latents is computed. The compression rate will depend on the model version as well as the tolerance for signal loss (drop in PSNR) since this algorithm is adaptive.
| 3.41-bit | 4.50-bit | 6.55-bit | 16-bit (original) |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
For example, the original float16 stabilityai/stable-diffusion-xl-base-1.0 model has an ~82 dB signal strength. Naively applying linear 8-bit quantization to the Unet model drops the signal to ~65 dB. Instead, applying MBP yields an average of 2.81-bits quantization while maintaining a signal strength of ~67 dB. This technique generally yields better results compared to using --quantize-nbits during model conversion but requires a "pre-analysis" run that takes up to a few hours on a single GPU (mps or cuda).
Here is the signal strength (PSNR in dB) versus model size reduction (% of float16 size) for stabilityai/stable-diffusion-xl-base-1.0. The {1,2,4,6,8}-bit curves are generated by progressively palettizing more layers using a palette with fixed number of bits. The layers were ordered in ascending order of their isolated impact to end-to-end signal strength so the cumulative compression's impact is delayed as much as possible. The mixed-bit curve is based on falling back to a higher number of bits as soon as a layer's isolated impact to end-to-end signal integrity drops below a threshold. Note that all curves based on palettization outperform linear 8-bit quantization at the same model size except for 1-bit.
Here are the steps for applying this technique on another model version:
Step 1: Run the pre-analysis script to generate "recipes" with varying signal strength:
python -m python_coreml_stable_diffusion.mixed_bit_compression_pre_analysis --model-version <model-version> -o <output-dir>
For popular base models, you may find the pre-computed pre-analysis results here. Fine-tuned models models are likely to honor the recipes of their corresponding base models but this is untested.
Step 2: The resulting JSON file from Step 1 will list "baselines", e.g.:
{
"model_version": "stabilityai/stable-diffusion-xl-base-1.0",
"baselines": {
"original": 82.2,
"linear_8bit": 66.025,
"recipe_6.55_bit_mixedpalette": 79.9,
"recipe_5.52_bit_mixedpalette": 78.2,
"recipe_4.89_bit_mixedpalette": 76.8,
"recipe_4.41_bit_mixedpalette": 75.5,
"recipe_4.04_bit_mixedpalette": 73.2,
"recipe_3.67_bit_mixedpalette": 72.2,
"recipe_3.32_bit_mixedpalette": 71.4,
"recipe_3.19_bit_mixedpalette": 70.4,
"recipe_3.08_bit_mixedpalette": 69.6,
"recipe_2.98_bit_mixedpalette": 68.6,
"recipe_2.90_bit_mixedpalette": 67.8,
"recipe_2.83_bit_mixedpalette": 67.0,
"recipe_2.71_bit_mixedpalette": 66.3
},
}
Among these baselines, select a recipe based on your desired signal strength. We recommend palettizing to ~4 bits depending on the use case even if the signal integrity for lower bit values are higher than the linear 8-bit quantization baseline.
Finally, apply the selected recipe to the float16 Core ML model as follows:
python -m python_coreml_stable_diffusion.mixed_bit_compression_apply --mlpackage-path <path-to-float16-unet-mlpackage> -o <output-dir> --pre-analysis-json-path <path-to--pre-analysis-json> --selected-recipe <selected-recipe-string-key>
An example <selected-recipe-string-key> would be "recipe_4.50_bit_mixedpalette" which achieves an average of 4.50-bits compression (compressed from ~5.2GB to ~1.46GB for SDXL). Please note that signal strength does not directly map to image-text alignment. Always verify that your MBP-compressed model variant is accurately generating images for your test prompts.
Section quoted from the upstream readme. Overlay configuration (Anticloud):
anticloud/- improvement overlay; environment-driven, no cloud dependencyLEDGERS/- aioss tamper-evident chain files (per-project, verified withaioss verify --live)ISOLATED_LAB_RESULTS/- reproducibility record (environment, reproduction steps, result register, evidence)OFFICIAL_BENCHMARKS/- 26 framework assessments for this project
Contributing
Upstream contributions: fork the STABLE_DIFFUSION project, create a feature branch, and open a pull request against upstream. Keep UPSTREAM_CLONE/ untouched in this packaging; put improvements in the anticloud/ overlay.
Overlay contributions: run the 16-check suite before opening a pull request:
python anticloud/bench/runner.py --cwd anticloud
License
Upstream license: MIT (evidence: LICENSE.md in the upstream snapshot).
License file excerpt:
MIT License
Copyright (c) 2024 Apple Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Anticommons 0.1.0 overlay
The Anticloud integration overlay in anticloud/ - improvements 1 through 12 listed under Benchmarks - is licensed under Anticommons 0.1.0. Upstream code remains under its original MIT terms. See ANTICOMMONS_LICENSE.md in this directory for the overlay terms and contact.
SPDX: MIT (upstream) + Anticommons 0.1.0 (overlay, dual).
Upstream
- Project:
STABLE_DIFFUSION(category: ARTIST TOOLS) - Upstream URL: https://github.com/camenduru/stable-diffusion-webui-colab
- Pinned commit (SHA):
035ea58aadfcb1b6158a2b9258777f94397845f7 - Branch: main
- Pin provenance: GitHub API commits/main. The parent-project stamp is explicitly rejected for this project.
- Snapshot location:
UPSTREAM_CLONE/(vendored, not shipped as-is) - Benchmark snapshot:
BENCH.json
Benchmarks
Measured by the Anticloud assurance suite. Every value below is read from this
project's BENCH.json, produced by a real run — the SHA3-256 of that file is
d1e5d46e04f509af8901ebc2a9e2174baab8f34f9acc224c5e8111777295f6e4.
| Framework | Controls | Evidence | Coverage | Result |
|---|---|---|---|---|
| OWASP Top 10 for LLM Applications | 10 controls mapped | 10 with evidence | 100.0% | PASS |
| OWASP Top 10 (2021) | 9 controls mapped | 9 with evidence | 100.0% | PASS |
| SOC 2 Type II readiness | 9 controls mapped | 9 with evidence | 100.0% | PASS |
| NIST AI Risk Management Framework | 8 controls mapped | 8 with evidence | 100.0% | PASS |
| NIST SP 800-53 Rev. 5 | 12 controls mapped | 12 with evidence | 100.0% | PASS |
| NIST Cybersecurity Framework 2.0 | 8 controls mapped | 8 with evidence | 100.0% | PASS |
| FedRAMP Rev. 5 | 10 controls mapped | 10 with evidence | 100.0% | PASS |
| PCI DSS v4.0.1 | 11 controls mapped | 11 with evidence | 100.0% | PASS |
| ISO/IEC 27001:2022 | 9 controls mapped | 9 with evidence | 100.0% | PASS |
| MITRE ATT&CK v16 | 12 controls mapped | 12 with evidence | 100.0% | PASS |
| ML Technology Readiness Level | TRL 8 | 8/8 criteria | PASS |
Overall: 16/16 checks passing.
See ISOLATED_LAB_RESULTS/03_Result_Register.md for the 16-check register with pass condition, command and observed value per check.
Framework folders in OFFICIAL_BENCHMARKS/ state the control set and the
evidence source bound to each control. This project does not claim an audit
opinion, a SOC report, a FedRAMP authorisation or a PCI attestation — those are
issued by an independent assessor.
Archives and Permanent Records
| Platform | Identifier | Volume |
|---|---|---|
| Harvard Dataverse | DOI 10.7910/DVN/YMJKOG | 145 citable datasets |
| AIOSS verification kit | DOI 10.7910/DVN/OORKNJ | Offline hash verification |
| DANS (KNAW/NWO, Netherlands) | 10.17026/PT | EU-recognised archive |
| Zenodo (CERN) | — | 146 records, DOI-registered |
| OSF | — | 144 preregistered records |
| Figshare | author 20849885 | Research data and figures |
| Internet Archive | aioss-format, Anticode | Permanent binary specification |
| ORCID | 0009-0009-2233-6107 | Permanent researcher ID |
| Kaggle | pax-millennium-20 | Reproducible T4 benchmark run |
Press and Independent Publication
The PAX benchmark release was distributed by Newsfile wire to 336 outlets (312 Web, 23 Terminal, 1 Application), including Yahoo Finance, The Globe and Mail, Business Insider, National Post, Financial Post, StreetInsider, Digital Journal, Barchart, International Business Times, and Fox News. Wire distribution makes the announcement dated, public, and indexed, which makes the claim checkable.
- Downloads last month
- -






