NVlabs / A-ViT

Official PyTorch implementation of A-ViT: Adaptive Tokens for Efficient Vision Transformer (CVPR 2022)
Apache License 2.0
138 stars 12 forks source link

Train with the provided hyperparameters and cannot get a small model with 78.8% acc1 and 3.6G FLOPs #8

Open ShenZhang-Shin opened 1 year ago

ShenZhang-Shin commented 1 year ago

Hi, Thanks for your interesting work. I try to train avit-small model with the provided hyperparameters. Finally, I get a model with 79.8% acc1 and 4.3G FLOPs. The performance is different from that of the pretrained A-ViT.
would you mind sharing the detail of hyperparameters to reproduce the model with 78.8% acc1 and 3.6G FLOPs.

Ther-nullptr commented 1 year ago

Hello, I want to ask you, how can you get the FLOPs?

ShenZhang-Shin commented 1 year ago

Hello, I want to ask you, how can you get the FLOPs?

I get the FLOPs of each sample on the ImageNet Val dataset and average the FLOPs.

Ther-nullptr commented 1 year ago

use which library? thop?

Andyyoung0507 commented 1 year ago

Hello, I am interested in this work. I installed the packages in the requirements.txt, but I got the error like this. 'Traceback (most recent call last): File "/data/ML_document/A-ViT/main_act.py", line 504, in main(args) File "/data/ML_document/A-ViT/main_act.py", line 443, in main train_stats = train_one_epoch( File "/data/ML_document/A-ViT/engine_act.py", line 67, in train_one_epoch rho_token = torch.mean(model.module.rho_token) File "/home/zjlab/miniconda3/envs/ad_vit/lib/python3.8/site-packages/torch/nn/modules/module.py", line 771, in getattr raise ModuleAttributeError("'{}' object has no attribute '{}'".format( torch.nn.modules.module.ModuleAttributeError: 'VisionTransformer' object has no attribute 'module'' I installed the timm=0.3.2 in the virtual env but the version is 0.4.12 in the project. Is this was caused by the mismatch of the imports?

oryany12 commented 10 months ago

Hi, i am also trying to understand how you calculate the FLOPs, and which library you used

doublemanyu commented 6 months ago

Hello, I am interested in this work. I installed the packages in the requirements.txt, but I got the error like this. 'Traceback (most recent call last): File "/data/ML_document/A-ViT/main_act.py", line 504, in main(args) File "/data/ML_document/A-ViT/main_act.py", line 443, in main train_stats = train_one_epoch( File "/data/ML_document/A-ViT/engine_act.py", line 67, in train_one_epoch rho_token = torch.mean(model.module.rho_token) File "/home/zjlab/miniconda3/envs/ad_vit/lib/python3.8/site-packages/torch/nn/modules/module.py", line 771, in getattr raise ModuleAttributeError("'{}' object has no attribute '{}'".format( torch.nn.modules.module.ModuleAttributeError: 'VisionTransformer' object has no attribute 'module'' I installed the timm=0.3.2 in the virtual env but the version is 0.4.12 in the project. Is this was caused by the mismatch of the imports?

Hi there. I met the same issue. Have you solve it? Can you share your way?