Instructions to use ShimaRinC/Distill-to-Loop with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use ShimaRinC/Distill-to-Loop with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("ShimaRinC/Distill-to-Loop", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
Download NOTICE from ShimaRinC/Distill-to-Loop: direct link, hf CLI and curl.
- Browser
- Download file 4.28 kB
-
https://huggingface.co/ShimaRinC/Distill-to-Loop/resolve/main/NOTICE
- Command line
-
hf download hf://ShimaRinC/Distill-to-Loop/NOTICE
-
curl -L -o NOTICE https://huggingface.co/ShimaRinC/Distill-to-Loop/resolve/main/NOTICE
4.28 kB
| This Stability AI Model is licensed under the Stability AI Non-Commercial Research Community License, Copyright (c) Stability AI Ltd. All Rights Reserved. | |
| The attribution notice above applies to Stable Diffusion 3 Medium (stabilityai/stable-diffusion-3-medium-diffusers) and to both weight sets | |
| distributed here, dooop-sd3-medium and dooop-sd3-medium-turbo, which are Derivative Works of it. The license is in the LICENSE file. | |
| Changes to Stable Diffusion 3 Medium (Distill to Loop) | |
| ======================================================= | |
| Both weight sets replace the 24-block MMDiT transformer of Stable Diffusion 3 Medium by a looped student transformer. The VAE, the three | |
| text encoders, the tokenizers and the scheduler are not changed and are not distributed here; they are loaded from | |
| stabilityai/stable-diffusion-3-medium-diffusers. | |
| Architecture (identical for both weight sets): 9 MMDiT blocks instead of 24, namely 2 input blocks, 5 shared blocks that are applied K times | |
| in a loop (K = 4 by default; K can be changed at sampling time), and 2 output blocks; 756,415,672 parameters. Added to the teacher's | |
| modules: a depth embedding that conditions the shared blocks on the loop position, a fixed depth-step update of both token streams after | |
| each loop, per-stream QK-norm gains on the shared and output blocks, and a soft attention modification (XSA) on the shared blocks. The patch | |
| embedding, positional embedding, time and text embeddings, context embedder, output norm and output projection keep the teacher's | |
| structure. | |
| Initialization: the student's blocks are copies of teacher blocks. The input blocks copy teacher blocks 0 and 1, the shared blocks copy | |
| teacher blocks 2, 6, 10, 14 and 18, and the output blocks copy teacher blocks 22 and 23. The embeddings, the output norm and the output | |
| projection are copied from the teacher. The per-stream QK-norm gains are initialized by calibration from the teacher's query and key statistics; the other added modules start from their own initialization. | |
| Training: the student was trained by distillation from the teacher transformer on COCO 2017 train images (512 px) and captions, with the | |
| outputs after every loop trained toward the teacher, and an exponential moving average (EMA, decay 0.9995) of its weights was kept. The | |
| released weights are post-hoc combinations of EMA weights, as follows. | |
| dooop-sd3-medium | |
| Teacher: the Stable Diffusion 3 Medium transformer; the student's blocks were initialized from it. | |
| Weights: 0.5 x the EMA weights at step 100,000 of the distillation run + 0.5 x the uniform average of the EMA weights at steps 105,000, | |
| 110,000, 115,000 and 120,000 of a continuation of that run from step 100,000 in which the training target was the flow-matching | |
| velocity of the training images instead of the teacher's prediction. | |
| dooop-sd3-medium-turbo | |
| Teacher: the transformer of byliutao/stable-diffusion-3-medium-turbo (revision 9ebe6142e456b3d262e8739d7b99fa4213d2c008), a four-step | |
| model distilled from Stable Diffusion 3 Medium with Continuous-Time Distribution Matching (CDM); the student's blocks were initialized | |
| from this transformer. | |
| Weights: the uniform average of the EMA weights at steps 100,000, 105,000, 110,000, 115,000 and 120,000. | |
| Attribution for dooop-sd3-medium-turbo only | |
| ========================================= | |
| The teacher of dooop-sd3-medium-turbo is the transformer of byliutao/stable-diffusion-3-medium-turbo | |
| (https://huggingface.co/byliutao/stable-diffusion-3-medium-turbo, revision 9ebe6142e456b3d262e8739d7b99fa4213d2c008), from | |
| "Continuous-Time Distribution Matching for Few-Step Diffusion Distillation" by Tao Liu, Hao Yan, Mengting Chen, Taihang Hu, Zhengrong Yue, | |
| Zihao Pan, Jinsong Lan, Xiaoyong Zhu, Ming-Ming Cheng, Bo Zheng and Yaxing Wang (arXiv:2605.06376; code https://github.com/byliutao/cdm). | |
| The README of that repository states: "This project is licensed under the MIT License — see the [LICENSE](LICENSE) file for details." | |
| That model is itself a Derivative Work of Stable Diffusion 3 Medium. | |
| The MIT statement of that repository concerns its code. It does not change the Stability AI Non-Commercial Research Community License that applies to the weights derived from Stable Diffusion 3 Medium, including dooop-sd3-medium-turbo. | |