1# Download from HuggingFace2git lfs install3git clone https://huggingface.co/HiDream-ai/VAREdit
Basic Usage
python
1from infer import load_model, generate_image
23model_components = load_model(4 pretrain_root="HiDream-ai/VAREdit",5 model_path="HiDream-ai/VAREdit/8B-1024.pth",6 model_size="8B",7 image_size=10248)910# Generate edited image11edited_image = generate_image(12 model_components,13 src_img_path="assets/test.jpg",14 instruction="Add glasses to this girl and change hair color to red",15 cfg=3.0,# Classifier-free guidance scale16 tau=0.1,# Temperature parameter17 seed=42# Optional random seed18)
📝 Detailed Configuration
Model Sampling Parameters
Parameter
Description
Default
cfg
Classifier-free guidance scale
3.0
tau
Temperature for sampling
0.1
seed
Random seed for reproducibility
-1 (random)
📂 Project Structure
VAREdit/
├── infer.py # Main inference script
├── infinity/ # Core model implementations
│ ├── models/ # Model architectures
│ ├── dataset/ # Data processing utilities
│ └── utils/ # Helper functions
├── tools/ # Additional tools and scripts
│ └── run_infinity.py # Model execution utilities
├── assets/ # Demo images and resources
└── README.md # This file
📊 Performance Benchmarks
Method
Size
EMU-Edit Bal.
PIE-Bench Bal.
Time (A800)
InstructPix2Pix
1.1B
2.923
4.034
3.5s
UltraEdit
7.7B
4.541
5.580
2.6s
OmniGen
3.8B
4.674
3.492
16.5s
AnySD
2.9B
3.129
3.326
3.4s
EditAR
0.8B
3.305
4.707
45.5s
ACE++
16.9B
2.076
2.574
5.7s
ICEdit
17.0B
4.785
4.933
8.4s
VAREdit (256px)
2.2B
5.565
6.684
0.5s
VAREdit (512px)
2.2B
5.662
6.996
0.7s
VAREdit (512px)
8.4B
7.792
8.105
1.2s
VAREdit (1024px)
8.4B
7.379
7.688
3.9s
Note: The released 8B models are trained longer and on more data, so the performances are better than that in the paper.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
📚 Citation
If you use VAREdit in your research, please cite:
bibtex
1@article{varedit2025,
2 title={Visual Autoregressive Modeling for Instruction-Guided Image Editing},
3 author={Mao, Qingyang and Cai, Qi and Li, Yehao and Pan, Yingwei and Cheng, Mingyue and Yao, Ting and Liu, Qi and Mei, Tao},
4 journal={arXiv preprint},
5 year={2025}
6}