yuhuan-wu / P2T

[TPAMI22] Pyramid Pooling Transformer for Scene Understanding
200 stars 18 forks source link

unexpected keyword argument 'pretrain_cfg' #17

Closed qianlian-mozi closed 1 year ago

qianlian-mozi commented 1 year ago

Hellow! when i used the code follow the guide of 'readme.md' (!python -m torch.distributed.launch --nproc_per_node=2 \ --master_port=$((RANDOM+10000)) --use_env main.py --data-path ~/autodl-tmp/p2t/P2T-main/imagenette2-320/ --batch-size 128 --model p2t_tiny --drop-path 0.1), i met the following error: Namespace(aa='rand-m9-mstd0.5-inc1', batch_size=128, clip_grad=None, color_jitter=0.4, cooldown_epochs=10, cutmix=1.0, cutmix_minmax=None, data_path='/root/autodl-tmp/p2t/P2T-main/imagenette2-320/', data_set='IMNET', decay_epochs=30, decay_rate=0.1, device='cuda', dist_backend='nccl', dist_eval=False, dist_url='env://', distributed=True, drop=0.0, drop_path=0.1, epochs=300, eval=False, eval_epoch=10, finetune='', fp32_resume=False, gpu=0, inat_category='name', input_size=224, lr=0.0005, lr_noise=None, lr_noise_pct=0.67, lr_noise_std=1.0, min_lr=1e-05, mixup=0.8, mixup_mode='batch', mixup_prob=1.0, mixup_switch_prob=0.5, model='p2t_tiny', momentum=0.9, num_workers=16, opt='adamw', opt_betas=None, opt_eps=1e-08, output_dir='./', patience_epochs=10, pin_mem=True, rank=0, recount=1, remode='pixel', repeated_aug=True, reprob=0.25, resplit=False, resume='./checkpoint.pth', sched='cosine', seed=123, smoothing=0.1, start_epoch=0, train_interpolation='bicubic', use_mcloader=False, warmup_epochs=20, warmup_lr=1e-06, weight_decay=0.05, world_size=2) /root/miniconda3/lib/python3.8/site-packages/torchvision/transforms/transforms.py:332: UserWarning: Argument interpolation should be of type InterpolationMode instead of int. Please, use InterpolationMode enum. warnings.warn( /root/miniconda3/lib/python3.8/site-packages/torchvision/transforms/transforms.py:332: UserWarning: Argument interpolation should be of type InterpolationMode instead of int. Please, use InterpolationMode enum. warnings.warn( Traceback (most recent call last): File "main.py", line 422, in <module> main(args) File "main.py", line 245, in main model = create_model( File "/root/autodl-tmp/pytorch-image-models/timm/models/_factory.py", line 114, in create_model model = create_fn( File "/root/autodl-tmp/p2t/P2T-main/p2t.py", line 353, in p2t_tiny model = PyramidPoolingTransformer( **TypeError: __init__() got an unexpected keyword argument 'pretrained_cfg'**

i just use the environment by pip install timm, i am new to this repo and don't know whether the repo has been renewed so that the code can't be runned. I am sorry for that i can't slove this problem by reading 'readme.md' and 'timmdocs', Look forward for your help!

yuhuan-wu commented 1 year ago

You seem to meet a package version error. Please use timm==0.3.2 or timm==0.4.12.

Alternatively, you can change this line of p2t.py without changing timm version. Here is the location that needs to be changed

https://github.com/yuhuan-wu/P2T/blob/d7e81e23c9b16317280c4d6e98b9cc3f5a467e49/p2t.py#L150,

Change this line to:depths=[2, 2, 9, 3], **kwargs): (add **kwargs).

I have updated the repo, so you can try again after git pull.

qianlian-mozi commented 1 year ago

You seem to meet a package version error. Please use timm==0.3.2 or timm==0.4.12.

Alternatively, you can change this line of p2t.py without changing timm version. Here is the location that needs to be changed

https://github.com/yuhuan-wu/P2T/blob/d7e81e23c9b16317280c4d6e98b9cc3f5a467e49/p2t.py#L150

, Change this line to:depths=[2, 2, 9, 3], **kwargs): (add **kwargs).

I have updated the repo, so you can try again after git pull.

Thanks a lot, i slove this problem now.