StableVS provides a set of custom schedulers for the diffusers library, enabling faster diffusion sampling with preserved generation quality via Stable Velocity Sampling strategies.
The implementation targets both text‑to‑image (T2I) and text‑to‑video (T2V) pipelines and integrates seamlessly with existing Diffusers workflows.
StableVS provides three custom schedulers:
- StableVSFlowMatchScheduler - A modified Flow Match Euler Discrete Scheduler combined with StableVS
- StableVSDPMSolverMultistepScheduler - A modified DPM-Solver++ scheduler combined with StableVS
- StableVSUniPCMultistepScheduler - A modified UniPC multistep scheduler combined with StableVS
# Create conda environment
conda create -n stablevs python=3.10 -y
conda activate stablevs
# Install PyTorch with CUDA support first (adjust cu121 to match your CUDA version)
# See https://pytorch.org/get-started/locally/ for other configurations
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121# Clone the repositories
git clone https://github.com/linYDTHU/StableVelocity.git
# 1. Install diffusers with test dependencies (includes transformers, sentencepiece, etc.)
pip install "diffusers[test]"
# 2. Install StableVS
cd StableVelocity/StableVS
pip install -e .from stablevs import (
StableVSFlowMatchScheduler,
StableVSDPMSolverMultistepScheduler,
StableVSUniPCMultistepScheduler
)
from diffusers import FluxPipeline
# Load your model
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
# Use custom scheduler
pipe.scheduler = StableVSFlowMatchScheduler(
num_train_timesteps=1000,
use_fast_low_schedule=True,
fast_low_split_point=0.85,
fast_low_low_substeps=9,
low_region_noise_factor=0.0,
)
# Generate image
image = pipe(
prompt="a beautiful landscape",
num_inference_steps=30,
guidance_scale=3.5,
).images[0]We provide simple demo scripts to compare baseline vs StableVS schedulers:
# Text-to-Image: compare Euler vs StableVS on SD3.5, Flux, Qwen-Image
python examples/t2i_demo.py --models sd35,flux,qwen --output-dir ./figures
# Text-to-Video: compare UniPC vs StableVS-UniPC on Wan2.2
python examples/t2v_demo.py --output-dir ./videos
# Print sigma schedules only (no GPU needed)
python examples/t2i_demo.py --print-sigmas-only
python examples/t2v_demo.py --print-sigmas-onlyWe provide a generation script for Geneval benchmark on multiple T2I models:
python examples/geneval_generate.py \
--prompts generation_prompts.txt \
--output-dir ./samples \
--models flux,sd35,qwen \
--num-steps 30 \
--sampler custom_euler \
--fast-low-split-point 0.85 \
--fast-low-low-substeps 9 \
--low-region-noise-factor 0.0Supported models:
flux- FLUX.1-devsd3- Stable Diffusion 3 Mediumsd35- Stable Diffusion 3.5 Largeqwen- Qwen Image 2512
Supported samplers:
euler- Default schedulercustom_euler- StableVSFlowMatchSchedulerdpm- DPMSolverMultistepSchedulercustom_dpm- StableVSDPMSolverMultistepScheduler
The script automatically detects available GPUs and performs parallel sampling.
For T2V-CompBench evaluation:
python examples/t2v_compbench_generate.py \
--save_dir ./video/custom_30steps \
--prompts_dir [Path/T2V-CompBench/prompts]\
--sampler custom \
--num_steps 30 \
--multi_gpuSupported samplers:
unipc- Default schedulercustom- StableVSUniPCMultistepScheduler
All custom schedulers support the following fast-low schedule parameters:
use_fast_low_schedule(bool): Enable fast-low schedulefast_low_split_point(float): Split point between high and low regions (default: 0.85)fast_low_low_substeps(int): Number of substeps in low region (default: 9)low_region_noise_factor(float): Noise factor for low region (default: 0.0)
StableVS/
├── stablevs/
│ ├── __init__.py
│ └── schedulers/
│ ├── __init__.py
│ ├── scheduling_stablevs_dpmsolver_multistep.py
│ ├── scheduling_stablevs_flow_match.py
│ └── scheduling_stablevs_unipc_multistep.py
├── examples/
│ ├── t2i_demo.py # T2I quick demo (SD3.5, Flux, Qwen)
│ ├── t2v_demo.py # T2V quick demo (Wan2.2)
│ ├── geneval_generate.py # Batch T2I generation script
│ └── t2v_compbench_generate.py # T2V-CompBench generation script
├── setup.py
├── generation_prompts.txt # prompts for Geneval
└── README.md
This project is built on top of the diffusers library by Hugging Face.