FSJD: Accelerating Auto-regressive Text-to-Image Generation with Training-free
Speculative Jacobi Decoding
🚩 注意事项
如果你把workdir生成在了本地,不要把workdir的内容push到仓库!!!!
🚩 New Features/Updates
- ✅ Apr, 2025. 💥 SJD has been integrated into Lumina-mGPT2 and SimpleAR.
- ✅ Jan, 2025. 💥 SJD is accepted to ICLR 2025.
- ✅ Oct, 2024. Release SJD's code.
🚩 TODO List
- □ Integrating SJD into vLLM framework for further acceleration.
Installing the dependencies
Environment:
- Python 3.10
- CUDA 12.5
- Pytorch 2.5.1+cu124
- Transformers 4.47.1
Install from yaml:
conda env create -f environment.yaml
🚩 如果你想完成完整的数据集测试?
target model: lumina-gpt
cd ./fsjd
isp='random' #init的填充方式
method='speculative_jacobi' #sjd
num_init_new_token=16 #填充数量
benchmark_way='order' #测试集的载入方式
prompt="MSCOCO2017Val" #测试集的名字
num_images=2 #测试集的图片数量
slice='0-1000' #测试集的区间
output_path=/home/leihaodong/AAAI25/exp/FSJD/${prompt}/${method}# 测试结果的输出文件夹
python /home/leihaodong/AAAI25/fsjd/main.py \
--output_path=$output_path \
--isp=$isp \
--method=$method \
--num_init_new_token=$num_init_new_token \
--benchmark_way=$benchmark_way \
--prompt=$prompt \
--num_images=$num_images \
--slice=$slice
target model: lumina-gpt
benchmark 为 parti-prompt
cd /home/leihaodong/AAAI25/fsjd
gpu_ids=0,3
dataset_name=parti
dataset_anno_file=/home/leihaodong/AAAI25/fsjd/data/prompts/PartiPrompts.tsv
model_name=leloy/Anole-7b-v0.1-hf
max_num_new_tokens=16
multi_token_init_scheme=random
seed=42
target_size=1024
prefix_token_sampler_scheme=speculative_jacobi
temperature=1.0
output_path=/home/leihaodong/AAAI25/exp/SJD/${dataset_name}_anole_${temperature}/${prefix_token_sampler_scheme}
mkdir -p ${output_path}
nohup python eval_model.py \
--gpu_ids $gpu_ids \
--dataset_name $dataset_name \
--dataset_anno_file $dataset_anno_file \
--model_name $model_name \
--max_num_new_tokens $max_num_new_tokens \
--multi_token_init_scheme $multi_token_init_scheme \
--seed $seed \
--target_size $target_size \
--prefix_token_sampler_scheme $prefix_token_sampler_scheme \
--temperature $temperature \
--output_dir $output_path \
--return_accl True \
--num_images 0 > ${output_path}.log 2>&1 &
Lumina-mGPT
CUDA_VISIBLE_DEVICES=0 python test_lumina_mgpt.py
Emu3
CUDA_VISIBLE_DEVICES=0 python test_emu3.py
LlamaGen
CUDA_VISIBLE_DEVICES=0 python test_llamagen.py
Acknowledge
Our code is based on Lumina-mGPT, Emu3, LlamaGen, Anole, and CLLM. We would like to express our gratitude to Tianwei Xiong for his assistance.
Citation
@article{teng2024accelerating,
title={Accelerating auto-regressive text-to-image generation with training-free speculative jacobi decoding},
author={Teng, Yao and Shi, Han and Liu, Xian and Ning, Xuefei and Dai, Guohao and Wang, Yu and Li, Zhenguo and Liu, Xihui},
journal={arXiv preprint arXiv:2410.01699},
year={2024}
}