SMD README

README проекта с github.com/zjwfufu/SMD. Одним файлом markdown: README.md.

Simplifying and Improving On-Policy Distillation
for Few-Step Diffusion

Project Page arXiv:2610.18472 Hugging Face Model Collection Datasets 中文文档

SMD examples: images on the left, 3D assets in the center, and video sequences on the right.

SMD is a simple and scalable method for few-step diffusion distillation across image, video, audio-video and 3D generation.

Models

See the model card for Hugging Face weights, standalone inference and example outputs.

The configurations below use four sampling steps unless noted otherwise. Model names link to their training configs.

Task Models
Text to image FLUX.1-dev, Qwen-Image, SD3.5-Medium, FLUX.2 Klein 4B, Lens
Image editing Qwen-Image-Edit-2511
Text to video Wan2.1 1.3B and 14B, causal Wan2.1 1.3B
Audio-video MiniMax H3 T2VA (4-step, 8-step) and Ref2VA (4-step, 8-step)
Image to 3D Hunyuan3D-2.1 Shape, TRELLIS.2 Shape and Texture

Additional configs cover SD3.5 reward specialists and multiple teachers, plus FLUX.2 9B distillation into Klein 4B and Lens.

Installation

Requirements:

The setup script creates an environment with Python 3.12, PyTorch 2.7.1, CUDA 12.6 wheels and FlashAttention.

Run from the repository root:

bash environments/setup_conda.sh
conda activate smd

For Hunyuan3D mesh previews and TRELLIS.2, install the additional environment:

bash environments/setup_3d_environment.sh
conda activate smd_3d_extend

Inference

For released weights, follow the standalone examples in the Hugging Face model collection.

For your own training checkpoints, export the student weights first, then run the inference script.

For example, with Qwen-Image:

python tools/download_resources.py --model qwen_image
python infer.py qwen_image --weights /path/to/exported_student \
  --output /path/to/samples --prompt "A red ceramic mug on a wooden table."

Pass your exported model directory to --weights and choose where to save samples with --output. The model directory must contain both student weights and sampling metadata.

See the inference guide for other models and options.

[!NOTE] H3 uses a student LoRA and cached conditions; no fused base checkpoint is needed. Export the adapter with the sampling metadata from the same checkpoint.

Launching with python defaults to one GPU; use --n-gpus to choose the GPU count. See H3 export and inference.

Training

Choose a configuration from the training experiments and prepare your data using the data guide.

For example, train Qwen-Image on two GPUs with a Parquet file containing a prompt column:

export SMD_OUTPUT_ROOT=/path/to/training_runs
torchrun --standalone --nproc_per_node=2 train.py \
  --config smd/configs/experiments/qwen_image.py --download-resources \
  - dataloader_train.dataset_path=/path/to/prompts.parquet \
  log_config.name=qwen-image-my-data

Replace the example data file and output directory with your own paths.

The --download-resources option downloads required resources automatically. Parameters after the standalone - override the selected configuration.

The SMD_OUTPUT_ROOT environment variable sets the root directory for checkpoints and previews. W&B logging defaults to offline mode.

See the training guide for run directories, resume, logging and preview settings.

Agent skills

To make SMD easier to use and extend, we provide agent skills for environment setup, training and inference, and model integration in the skills directory.

Each skill includes instructions and references that you or your coding assistant can follow.

Acknowledgments and license

SMD builds on NVIDIA FastGen's training infrastructure and uses model implementations from Hugging Face Diffusers.

We are grateful to the authors and maintainers of these projects for giving us a foundation to build on.

We thank the authors of FLUX.1, FLUX.2, Qwen-Image and Qwen-Image-Edit, Stable Diffusion 3.5, Wan2.1, MiniMax H3, Lens, Hunyuan3D-2.1 and TRELLIS.2 for sharing their models and code. These releases made it possible to explore SMD across image, video, audio-video and 3D generation.

We also thank the authors of Self Forcing and Causal Forcing for sharing their code and checkpoints. Our causal Wan implementation builds on Self Forcing and uses the chunkwise initialization and teacher checkpoints from Causal Forcing.

See LICENSE, NOTICE and third-party licenses for code licensing and attribution.

Model weights, teacher adapters and datasets retain their upstream licenses.

Citation

@article{smd,
  title   = {Simplifying and Improving On-Policy Distillation for Few-Step Diffusion},
  author  = {Jiawei Zhang and Ziyu Wan and Nanye Ma and Long Zhao and Dong Chen and Hongyu Liu and Qifeng Chen and Dongdong Chen},
  year    = {2026},
  journal = {arXiv preprint arXiv:2610.18472},
}

SMD (zjwfufu/SMD)

Ищем в базе…

277 ·GitHub
Что это такое?SMD — это исследовательский метод и кодовая база для дистилляции диффузионных моделей в быстрые генераторы, которые работают за несколько шагов. Они охватывают задачи генерации изображений, видео, аудио-видео и 3D.
Это готовое приложение или исследовательский код?Это исследовательская кодовая база со скриптами обучения и инференса и конфигурациями, а не готовое приложение. Вы запускаете Python-скрипты с конфигами и экспортированными чекпоинтами.
Как всё это запустить?На машине с Linux x86_64 и Conda запустите прилагаемый скрипт установки из корня репозитория. Он соберёт окружение Python 3.12 / PyTorch 2.7.1 / CUDA 12.6 с FlashAttention, собранным из исходников. Для Hunyuan3D и TRELLIS.2 нужно отдельное дополнительное окружение.
Нужны ли видеокарта NVIDIA и CUDA Toolkit?Да. Нужна видеокарта NVIDIA с драйвером, совместимым с CUDA 12.6, а также CUDA Toolkit и компилятор C++ для сборки FlashAttention из исходников.
Можно ли запустить это на Windows или Mac?Нет. README требует Linux x86_64 с Conda, а поддержка Windows и macOS нигде не упоминается.
Всё ли здесь распространяется под лицензией Apache-2.0?Сам код SMD распространяется под Apache-2.0. Но веса моделей, адаптеры модели-учителя и датасеты сохраняют собственные лицензии исходных проектов.
Какие модели можно использовать сразу?Выпущенные веса ученических моделей на Hugging Face покрывают: генерацию изображений по тексту (FLUX.1-dev, Qwen-Image, SD3.5-Medium, FLUX.2 Klein 4B, Lens), редактирование изображений (Qwen-Image-Edit-2511), генерацию видео по тексту (Wan2.1), аудио-видео (MiniMax H3) и 3D по изображению (Hunyuan3D-2.1, TRELLIS.2).
Как обучить SMD на своих данных?Выберите конфигурацию обучения и подготовьте Parquet-файл с колонкой prompt по руководству по данным. Затем запустите обучение на своих GPU, например Qwen-Image на двух GPU. Переменная SMD_OUTPUT_ROOT задаёт, куда попадают чекпоинты и превью, а логирование в W&B по умолчанию работает в офлайн-режиме.
Одинаково ли инференс работает для всех моделей?В основном да: экспортируйте веса ученической модели вместе с метаданными семплирования и запустите скрипт инференса с --weights и --output. Исключение — MiniMax H3. Он использует LoRA ученической модели с кэшированными условиями вместо объединённого чекпоинта.
Для чего нужны навыки агента?Папка skills содержит навыки агента для настройки окружения, обучения, инференса и интеграции моделей. Они написаны так, чтобы вы или ассистент для программирования могли следовать им и проще использовать и расширять SMD.
Какие есть похожие проекты?DiffSynth-Studio, hyperflow, EasyWAM, generative-models, kohya_ss, diffusers, CodeVideoModel, HunyuanVideo-1.5
Автор
zjwfufu
Размер
27 MB
Звёзды
277
Обновлён
КоммитOct 21
Возраст
1 мес
Коммиты · 90 дней