Views
No views yet
git clone https://github.com/Ackesnal/RePaViT.git
cd RePaViTconda create -n repavit python=3.10 -y && conda activate repavit
conda install conda-forge::python-rocksdb -y
pip install torch torchvision torchaudio timm==1.0.3 einops ptflops wandbconda env create -f environment.ymldatasets.ImageFolder, and the training and validation data is expected to be in the train/ folder and val folder respectively:/path/to/imagenet/
train/
class1/
img1.jpeg
class2/
img2.jpeg
val/
class1/
img3.jpeg
class2/
img4.jpegpython insert_rocksdb.pytar_path_root and db_path_root in insert_rocksdb.py with your own source and target root paths).--rocksdb argument instead of --data_path to specify the database location.--idle_ratio is set to the same value as the pretrained model weight.torchrun --nproc_per_node=4 main.py \
--model=RePaViT_Large \
--batch_size=512 \
--eval \
--dist_eval \
--channel_idle \
--idle_ratio=0.75 \
--feature_norm=BatchNorm \
--data_path=/path/to/imagenet \
--resume=/path/to/pretrained_weight.pthtorchrun --nproc_per_node=4 main.py --model=RePaViT_Large --batch_size=512 --eval --dist_eval --channel_idle --idle_ratio=0.75 --feature_norm=BatchNorm --data_path=/path/to/imagenet --resume=/path/to/pretrained_weight.pth--test_speed and --only_test_speed arguments should be utilized, and the number of processes is recommended to set to 1:torchrun --nproc_per_node=1 main.py \
--model=RePaViT_Large \
--channel_idle \
--idle_ratio=0.75 \
--feature_norm=BatchNorm \
--test_speedtorchrun --nproc_per_node=1 main.py --model=RePaViT_Large --channel_idle --idle_ratio=0.75 --feature_norm=BatchNorm --test_speed--reparam as:torchrun --nproc_per_node=1 main.py \
--model=RePaViT_Large \
--channel_idle \
--idle_ratio=0.75 \
--feature_norm=BatchNorm \
--test_speed \
--reparamtorchrun --nproc_per_node=1 main.py --model=RePaViT_Large --channel_idle --idle_ratio=0.75 --feature_norm=BatchNorm --test_speed --reparam--reparam can be combined with performance evalutation as well. The prediction accuracy before and after reparameterization should be the same.@inproceedings{xu2025repavit,
title = {RePaViT: Scalable Vision Transformer Acceleration via Structural Reparameterization on Feedforward Network Layers},
author = {Xu, Xuwei and Li, Yang and Chen, Yudong and Liu, Jiajun and Wang, Sen},
booktitle = {The 42nd International Conference on Machine Learning (ICML)},
year = {2025}
}