Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: __init__() got an unexpected keyword argument 'bn_tf' #134

Closed
ModeSky opened this issue Sep 8, 2022 · 16 comments
Closed

TypeError: __init__() got an unexpected keyword argument 'bn_tf' #134

ModeSky opened this issue Sep 8, 2022 · 16 comments

Comments

@ModeSky
Copy link

ModeSky commented Sep 8, 2022

Hello, I want to ask what caused the following error when running the train.py file? thank you
“ TypeError: init() got an unexpected keyword argument 'bn_tf' ”

@iamhankai
Copy link
Member

Could you show more log information?

@ModeSky
Copy link
Author

ModeSky commented Sep 8, 2022

ImportError: cannot import name 'container_abcs' from 'torch._six'
Now the error has changed

@ModeSky
Copy link
Author

ModeSky commented Sep 8, 2022

For the previous error, I just lowered the version of timm to 0.3.2, but torch is 1.10.0. Is this the reason for this error?

@ModeSky
Copy link
Author

ModeSky commented Sep 8, 2022

Training with a single process on 1 GPUs.
Traceback (most recent call last):
File "D:/Study/CV/important_code/vig_pytorch/train.py", line 808, in
main()
File "D:/Study/CV/important_code/vig_pytorch/train.py", line 341, in main
checkpoint_path=args.initial_checkpoint)
File "C:\Users\jcy14\Anaconda3\lib\site-packages\timm\models\factory.py", line 71, in create_model
model = create_fn(pretrained=pretrained, pretrained_cfg=pretrained_cfg, **kwargs)
File "C:\Users\jcy14\Anaconda3\lib\site-packages\timm\models\resnet.py", line 847, in resnet101
return _create_resnet('resnet101', pretrained, **model_args)
File "C:\Users\jcy14\Anaconda3\lib\site-packages\timm\models\resnet.py", line 736, in _create_resnet
return build_model_with_cfg(ResNet, variant, pretrained, **kwargs)
File "C:\Users\jcy14\Anaconda3\lib\site-packages\timm\models\helpers.py", line 531, in build_model_with_cfg
model = model_cls(**kwargs) if model_cfg is None else model_cls(cfg=model_cfg, **kwargs)
TypeError: init() got an unexpected keyword argument 'bn_tf'

@ModeSky
Copy link
Author

ModeSky commented Sep 8, 2022 via email

@iamhankai
Copy link
Member

It seems you run ResNet101.

Please run as python -m torch.distributed.launch --nproc_per_node=1 train.py /path/to/imagenet/ --model pvig_s_224_gelu --sched cosine --epochs 300 --opt adamw -j 8 --warmup-lr 1e-6 --mixup .8 --cutmix 1.0 --model-ema --model-ema-decay 0.99996 --aa rand-m9-mstd0.5-inc1 --color-jitter 0.4 --warmup-epochs 20 --opt-eps 1e-8 --repeated-aug --remode pixel --reprob 0.25 --amp --lr 2e-3 --weight-decay .05 --drop 0 --drop-path .1 -b 128 --output /path/to/save/models/

with timm 0.3.2, and torch 1.7.0.

@ModeSky
Copy link
Author

ModeSky commented Sep 9, 2022 via email

@iamhankai
Copy link
Member

您好,请仔细阅读readme,谢谢!测试程序包含在train.py里面,调用方式:

python train.py /path/to/imagenet/ --model pvig_s_224_gelu -b 256 --pretrain_path /path/to/pretrained/model/ --evaluate

@ModeSky
Copy link
Author

ModeSky commented Sep 19, 2022 via email

@iamhankai
Copy link
Member

We followed the official pytorch example: move and extract the training and validation images to labeled subfolders, using the following shell script

@ModeSky
Copy link
Author

ModeSky commented Sep 20, 2022 via email

@iamhankai
Copy link
Member

dir/
  train/
    ...
  val/
    n01440764/
      ILSVRC2012_val_00000293.JPEG
      ...
    ...

@ModeSky
Copy link
Author

ModeSky commented Sep 22, 2022 via email

@ModeSky
Copy link
Author

ModeSky commented Sep 23, 2022 via email

@iamhankai
Copy link
Member

We followed the official pytorch example: move and extract the training and validation images to labeled subfolders, using the following shell script

Please read this example first. It seems you're not familiar to ImageNet training.

@ModeSky
Copy link
Author

ModeSky commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants