Skip to content

TypeError: TaskPrompter.__init__() got an unexpected keyword argument 'default_cfg' #24

@op1009

Description

@op1009

Steps done:

  1. Clone repo
  2. Download .pth.tar files
  3. Run below commands
CUDA_VISIBLE_DEVICES=0
!python3 inference.py --config_path=configs/pascal/pascal_vitLp16_taskprompter.yml --image_path=/content/Screenshot7.png --ckp_path=/content/Multi-Task-Transformer/TaskPrompter/InvPT_pascal_vitLp16.pth.tar --save_dir=output

Error

Traceback (most recent call last):
  File "/content/Multi-Task-Transformer/TaskPrompter/inference.py", line 185, in <module>
    infer_one_image(args.image_path)
  File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/content/Multi-Task-Transformer/TaskPrompter/inference.py", line 141, in infer_one_image
    model = initialize_model(p, checkpoint_path)
  File "/content/Multi-Task-Transformer/TaskPrompter/inference.py", line 60, in initialize_model
    model = get_model(p)
  File "/content/Multi-Task-Transformer/TaskPrompter/utils/common_config.py", line 79, in get_model
    backbone, backbone_channels = get_backbone(p)
  File "/content/Multi-Task-Transformer/TaskPrompter/utils/common_config.py", line 22, in get_backbone
    backbone = taskprompter_vit_large_patch16_384(p=p, pretrained=True, drop_path_rate=0.15, img_size=p.TRAIN.SCALE)
  File "/content/Multi-Task-Transformer/TaskPrompter/models/transformers/taskprompter.py", line 676, in taskprompter_vit_large_patch16_384
    model = _create_task_prompter('vit_large_patch16_384', pretrained=pretrained, **model_kwargs)
  File "/content/Multi-Task-Transformer/TaskPrompter/models/transformers/taskprompter.py", line 661, in _create_task_prompter
    model = build_model_with_cfg(
  File "/usr/local/lib/python3.10/dist-packages/timm/models/_builder.py", line 385, in build_model_with_cfg
    model = model_cls(**kwargs)
TypeError: TaskPrompter.__init__() got an unexpected keyword argument 'default_cfg'

Trying other solution from closed issue #10

CUDA_VISIBLE_DEVICES=0 
!python inference.py --image_path=/content/Screenshot7.png --ckp_path=/content/Multi-Task-Transformer/TaskPrompter/InvPT_pascal_vitLp16.pth.tar --save_dir=SAVE_DIR

Error

Traceback (most recent call last):
  File "/content/Multi-Task-Transformer/TaskPrompter/inference.py", line 185, in <module>
    infer_one_image(args.image_path)
  File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/content/Multi-Task-Transformer/TaskPrompter/inference.py", line 121, in infer_one_image
    p = create_config(args.config_path, {'run_mode': 'infer'})
  File "/content/Multi-Task-Transformer/TaskPrompter/utils/config.py", line 94, in create_config
    with open(exp_file, 'r') as stream:
FileNotFoundError: [Errno 2] No such file or directory: './configs/pascal/pascal_vitLp16.yml'

Platform
Google colab with T4 runtime

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions