This project is developed based on the PaddlePaddle framework.
cd SPR2Q
conda create -n SPR2Q python=3.9
conda activate SPR2Q
python -m pip install paddlepaddle-gpu==3.2.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/
pip install -r requirements.txtThis repository uses DF2K for training and Set5, Set14, B100, Urban100, and Manga109 for testing. Please modify the dataset paths in the YAML configuration files located in options/train/, options/test/, and options/finetune/.
For example, to train 2× super-resolution with 4-bit quantization, modify the pretrain_network_FP in the YAML file to point to the full-precision model (.pdparams), then run:
python basicsr/train.py -opt options/train/train_mamba_quant_x2.yml --force_yml bit=4 name=train_x2_bit4The training results will be saved in the experiments folder.
Modify pretrain_network_FP to the full-precision model (.pdparams) and pretrain_network_Q to the trained quantized model (.pdparams) you want to fine-tune. Then run:
python basicsr/train.py -opt options/finetune/finetune_mamba_quant_x2.yml --force_yml bit=1 name=finetune_x2_bit4The fine-tuned results will be saved in the experiments folder.
Modify pretrain_network_Q in the YAML file to the trained quantized model (.pdparams). Then run:
python basicsr/test.py -opt options/test/test_mamba_quant_x2.yml --force_yml bit=4 name=test_x2_bit4The test results will be saved in the results folder.