Views
No views yet



1@article{zhang2025mvar,
2 title={MVAR: Visual Autoregressive Modeling with Scale and Spatial Markovian Conditioning},
3 author={Zhang, Jinhua and Long, Wei and Han, Minghao and You, Weiyi and Gu, Shuhang},
4 journal={arXiv preprint arXiv:2505.12742},
5 year={2025}
6}



| Model | FID ↓ | IS ↑ | sFID ↓ | Prec. ↑ | Recall ↑ | Params | HF Weights 🤗 |
|---|---|---|---|---|---|---|---|
| MVAR-d16 | 3.01 | 285.17 | 6.26 | 0.85 | 0.51 | 310M | link |
| MVAR-d16$^{*}$ | 3.37 | 295.35 | 6.10 | 0.86 | 0.48 | 310M | link |
| MVAR-d20$^{*}$ | 2.83 | 294.31 | 6.12 | 0.85 | 0.52 | 600M | link |
| MVAR-d24$^{*}$ | 2.15 | 298.85 | 5.62 | 0.84 | 0.56 | 1.0B | link |
Note: $^{*}$ indicates models fine-tuned from VAR weights on ImageNet.
1conda create -n mvar python=3.11 -y
2conda activate mvar1pip install torch==2.8.0 torchvision==0.23.0 torchaudio==2.8.0 \
2 xformers==0.0.32.post2 \
3 --index-url https://download.pytorch.org/whl/cu128
4
5pip install accelerate einops tqdm huggingface_hub pytz tensorboard \
6 transformers typed-argument-parser thop matplotlib seaborn wheel \
7 scipy packaging ninja openxlab lmdb pillowpip install natten-0.21.1+torch280cu128-cp311-cp311-linux_x86_64.whl/path/to/imagenet/:
train/:
n01440764/
...
val/:
n01440764/
...huggingface-cli to download the entire model repository:1# Install huggingface_hub if you haven't
2pip install huggingface_hub
3# Download models to local directory
4hf download FoundationVision/var --local-dir ./pretrained/FoundationVision/var1# Download models to local directory
2hf download CVLUESTC/MVAR --local-dir ./checkpointsflash-attn and xformers for faster attention computation. Our code will automatically use them if installed. See models/basic_mvar.py#L17-L48.CACHED_PATH tto reduce computational overhead during MVAR training:1torchrun --nproc_per_node=8 --nnodes=1 --node_rank=0 main_cache.py \
2 --img_size 256 --data_path ${IMAGENET_PATH} \
3 --cached_path ${CACHED_PATH}/train_cache_mvar \ # or ${CACHED_PATH}/val_cache_mvar
4 --train \ # specify train--use_cached=True to use the pre-computed cached latents and code index:1# Example for MVAR-d16
2torchrun --nproc_per_node=8 --nnodes=... --node_rank=... --master_addr=... --master_port=... train.py \
3 --depth=16 --bs=448 --ep=300 --fp16=1 --alng=1e-3 --wpe=0.1 \
4 --data_path ${IMAGENET_PATH} --exp_name ${EXP_NAME}
5
6# Example for MVAR-d16 (Fine-tuning)
7torchrun --nproc_per_node=8 --nnodes=... --node_rank=... --master_addr=... --master_port=... train.py \
8 --depth=16 --bs=448 --ep=80 --fp16=1 --alng=1e-3 --wpe=0.1 \
9 --data_path ${IMAGENET_PATH} --exp_name ${EXP_NAME} --finetune_from_var=True
10
11# Example for MVAR-d20 (Fine-tuning)
12torchrun --nproc_per_node=8 --nnodes=... --node_rank=... --master_addr=... --master_port=... train.py \
13 --depth=20 --bs=192 --ep=80 --fp16=1 --alng=1e-3 --wpe=0.1 \
14 --data_path ${IMAGENET_PATH} --exp_name ${EXP_NAME} --finetune_from_var=True
15
16 # Example for MVAR-d24 (Fine-tuning)
17torchrun --nproc_per_node=8 --nnodes=... --node_rank=... --master_addr=... --master_port=... train.py \
18 --depth=24 --bs=448 --ep=80 --fp16=1 --alng=1e-3 --wpe=0.1 \
19 --data_path ${IMAGENET_PATH} --exp_name ${EXP_NAME} --finetune_from_var=True1python run_mvar_evaluate.py \
2 --cfg 2.7 --top_p 0.99 --top_k 1200 --depth 16 \
3 --mvar_ckpt ${MVAR_CKPT}1python utils/evaluations/c2i/evaluator.py \
2 --ref_batch VIRTUAL_imagenet256_labeled.npz \
3 --sample_batch ${SAMPLE_BATCH}