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

bugs #2

Closed
cuge1995 opened this issue Nov 16, 2021 · 9 comments
Closed

bugs #2

cuge1995 opened this issue Nov 16, 2021 · 9 comments

Comments

@cuge1995
Copy link

cuge1995 commented Nov 16, 2021

MAE-pytorch/modeling_pretrain.py", line 296, in pretrain_mae_base_patch16_224
    **kwargs)
TypeError: __init__() got an unexpected keyword argument 'num_classes'
@pengzhiliang
Copy link
Owner

I'm sorry that I can't reproduce the bug you mentioned with the unmodified code in this repo. Can you provide more information?

@cuge1995
Copy link
Author

just clone your repo, and follow the running code

# Set the path to save checkpoints
OUTPUT_DIR='output/'
# path to imagenet-1k train set
DATA_PATH='../ImageNet_ILSVRC2012/train'


OMP_NUM_THREADS=1 python -m torch.distributed.launch --nproc_per_node=8 run_mae_pretraining.py \
        --data_path ${DATA_PATH} \
        --mask_ratio 0.75 \
        --model pretrain_mae_base_patch16_224 \
        --batch_size 128 \
        --opt_betas 0.9 0.95 \
        --warmup_epochs 40 \
        --epochs 1600 \
        --output_dir ${OUTPUT_DIR}

@cuge1995
Copy link
Author

cuge1995 commented Nov 16, 2021

more logs are as follows:

Creating model: pretrain_mae_base_patch16_224
Traceback (most recent call last):
  File "run_mae_pretraining.py", line 264, in <module>
    main(opts)
  File "run_mae_pretraining.py", line 150, in main
    model = get_model(args)
  File "run_mae_pretraining.py", line 129, in get_model
    drop_block_rate=None,
  File "timm/models/factory.py", line 57, in create_model
    model = create_fn(**model_args, **kwargs)
  File "MAE-pytorch/modeling_pretrain.py", line 296, in pretrain_mae_base_patch16_224
    **kwargs)
TypeError: __init__() got an unexpected keyword argument 'num_classes'
Traceback (most recent call last):

@LiewFeng
Copy link
Collaborator

I can run it successfully. Maybe you can check the version of timm.

@launchauto
Copy link

launchauto commented Nov 17, 2021

MAE-pytorch/modeling_pretrain.py", line 296, in pretrain_mae_base_patch16_224
    **kwargs)
TypeError: __init__() got an unexpected keyword argument 'num_classes'

command
pip install --upgrade timm
will help

@chenhao-zju
Copy link

MAE-pytorch/modeling_pretrain.py", line 296, in pretrain_mae_base_patch16_224
**kwargs)
TypeError: init() got an unexpected keyword argument 'num_classes'

Have you solved this problem? I met it too

@pengzhiliang
Copy link
Owner

Hello, @shandong-university-weihai-chen . You can have a try:

pip install timm==0.3.2

@chenhao-zju
Copy link

It’s very nice of you, I solve this problem by changing all ‘>=’ to ‘==’ in ‘requirements.txt’

@pengzhiliang
Copy link
Owner

You are welcome.

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

5 participants