Glance: Accelerating Diffusion Models with 1 Sample
This model is presented in the paper Glance: Accelerating Diffusion Models with 1 Sample.
Project Page: https://zhuobaidong.github.io/Glance/
Code: https://github.com/CSU-JPG/Glance
About
Glance introduces a novel approach to accelerate diffusion models by intelligently speeding up denoising phases. Instead of costly retraining, Glance equips base models with lightweight Slow-LoRA and Fast-LoRA adapters. This method achieves up to 5x acceleration over base models while maintaining comparable visual quality and strong generalization on unseen prompts. Notably, the LoRA experts are trained with only 1 sample within an hour.
π§ͺ Usage
π¨ Inference
We provide solid 4-GPU inference code for easy multi-card sampling. You can experience our Glance model by running:
CUDA_VISIBLE_DEVICES=0,1,2,3 python infer_Glance_qwen.py
Glance (Qwen-Image)
import torch
from pipeline.qwen import GlanceQwenSlowPipeline, GlanceQwenFastPipeline
from utils.distribute_free import distribute, free_pipe
repo = "CSU-JPG/Glance"
slow_pipe = GlanceQwenSlowPipeline.from_pretrained("Qwen/Qwen-Image", torch_dtype=torch.float32)
slow_pipe.load_lora_weights(repo, weight_name="glance_qwen_slow.safetensors")
distribute(slow_pipe)
prompt = "Please create a photograph capturing a young woman showcasing a dynamic presence as she bicycles alongside a river during a hot summer day. Her long hair streams behind her as she pedals, dressed in snug tights and a vibrant yellow tank top, complemented by New Balance running shoes that highlight her lean, athletic build. She sports a small backpack and sunglasses resting confidently atop her head."
latents = slow_pipe(
prompt=prompt,
negative_prompt=" ",
width=1024,
height=1024,
num_inference_steps=5,
true_cfg_scale=5,
generator=torch.Generator(device="cuda").manual_seed(0),
output_type="latent"
).images[0].unsqueeze(0).detach().cpu()
free_pipe(slow_pipe)
fast_pipe = GlanceQwenFastPipeline.from_pretrained("Qwen/Qwen-Image", torch_dtype=torch.float32)
fast_pipe.load_lora_weights(repo, weight_name="glance_qwen_fast.safetensors")
distribute(fast_pipe)
image = fast_pipe(
prompt=prompt,
negative_prompt=" ",
width=1024,
height=1024,
num_inference_steps=5,
true_cfg_scale=5,
generator=torch.Generator(device="cuda").manual_seed(0),
latents=latents.to("cuda", dtype=torch.float32)
).images[0]
image.save("output.png")
πΌοΈ Sample Output
π Training
Glance_Qwen Training
To start training with your configuration file, simply run:
accelerate launch train_Glance_qwen.py --config ./train_configs/Glance_qwen.yaml
Note: All the training code is primarily based on flymyai-lora-trainer.
Ensure that Glance_qwen.yaml is properly configured with your dataset paths, model settings, output directory, and other hyperparameters. You can also explicitly specify whether to train the Slow-LoRA or Fast-LoRA variant directly within the configuration file.
If you want to train on a single GPU (requires less than 24 GB of VRAM), run:
python train_Glance_qwen.py --config ./train_configs/Glance_qwen.yaml
Glance_FLUX Training
To launch training for the FLUX variant, run:
accelerate launch train_Glance_flux.py --config ./train_configs/Glance_flux.yaml
Citation
@misc{dong2025glanceacceleratingdiffusionmodels,
title={Glance: Accelerating Diffusion Models with 1 Sample},
author={Zhuobai Dong and Rui Zhao and Songjie Wu and Junchao Yi and Linjie Li and Zhengyuan Yang and Lijuan Wang and Alex Jinpeng Wang},
year={2025},
eprint={2512.02899},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2512.02899},
}
- Downloads last month
- 260
Model tree for CSU-JPG/Glance
Base model
Qwen/Qwen-Image