tyfeld/drifting-model
tyfeld/drifting-model has 250 GitHub stars and 27 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-21 03:15 UTC. Last push 2026-02-06.
측정된 스타 증가
- in 24h
- 0
- in 7 days
- 기록 수집 중
- in 15 days
- 기록 수집 중
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
소개
Personal PyTorch implementation of "Generative Modeling via Drifting" with Claude
머신러닝README.md
OriginalDrifting Models
Unofficial PyTorch implementation of "Generative Modeling via Drifting".
Just for fun and learning. Feel free to test and pull request~
One-step generation - no iterative sampling required (1-NFE).
Method
Drifting Models train a generator by computing a drifting field V that points generated samples toward real data and away from other generated samples. The loss is simply ||V||^2, which reaches zero when generated samples are indistinguishable from real data.
Key components:
- DiT-style generator with adaLN-Zero conditioning
- Drifting field V computed via soft assignment matrices (Algorithm 2)
- Multi-temperature V computation for multi-scale structure
- Classifier-free guidance (CFG) support
Requirements
pip install torch torchvision einops
TODO
- Support MNIST and CIFAR-10
- Support ImageNet
Usage
Training
# MNIST (pixel space, ~20 min on GPU)
python train.py --dataset mnist
# CIFAR-10 (with feature encoder)
python train.py --dataset cifar10
Sampling
python sample.py --checkpoint outputs/mnist/checkpoint_final.pt --dataset mnist
Results
MNIST samples after ~8000 steps:

CIFAR-10 samples after ~8500 steps:

Project Structure
├── model.py # DiT-style generator
├── drifting.py # Drifting field V computation
├── feature_encoder.py # CNN feature encoder (for CIFAR)
├── train.py # Training loop
├── sample.py # Sampling script
└── utils.py # EMA, utilities
Key Hyperparameters
| Parameter | MNIST | CIFAR-10 |
|---|---|---|
| Model | DriftDiT-Tiny (9M) | DriftDiT-Small (27M) |
| Epochs | 100 | 200 |
| LR | 2e-4 | 2e-4 |
| Temperatures | [0.02, 0.05, 0.2] | [0.02, 0.05, 0.2] |
| Feature space | Pixel (L2 norm) | CNN encoder |