rwightman / efficientdet-pytorch

A PyTorch impl of EfficientDet faithful to the original Google impl w/ ported weights
Apache License 2.0
1.58k stars 293 forks source link

[BUG] module 'timm' has no attribute 'create_conv2d' #182

Closed sefibk closed 3 years ago

sefibk commented 3 years ago

Describe the bug Following the exact instructions to train EfficientDet I get the error: AttributeError: module 'timm' has no attribute 'create_conv2d'

To Reproduce Steps to reproduce the behavior:

  1. Cloned efficientdet repo
  2. Installed Timm package (tried both cloning repo and running python setup.py install and pip install timm)
  3. Run ```

    !/bin/bash

    NUM_PROC=$1 shift python -m torch.distributed.launch --nproc_per_node=$NUM_PROC train.py "$@"

  4. Process killed with error: AttributeError: module 'timm' has no attribute 'create_conv2d' comment: After installing Timm and starting python import timm succeeds including running timm.create_model() however timm.create_conv2d and other functions fails with the above message.

Expected behavior Expected training of EfficientDet to start

Desktop (please complete the following information):

Additional context I assume it is a problem with the Timm installation but I am not sure and do not know how to check this. Would appreciate any assistance

rwightman commented 3 years ago

@sefibk are you sure you don't have a different/old version of timm in your env (ie two timm) or a folder named timm in your working path?

sefibk commented 3 years ago

Thank you for replying however issue is still unsolved.

I tried removing the folder timm from the device => still same error Also tried removing the folder, uninstalling and reinstalling timm => still same error

BTW, when running pip install timm I get version 0.3.4 but when installing locally from the clone repo I get 0.4.1. Could this indicate something? Do you have any other ideas?

sefibk commented 3 years ago

I was able to solve those issues by editing __init__.py in timm but now I get the error:

Traceback (most recent call last):
  File "train_effdet.py", line 699, in <module>
    main()
  File "train_effdet.py", line 353, in main
    optimizer = timm.create_optimizer(args, model)
  File "/root/miniconda/lib/python3.7/site-packages/timm-0.4.1-py3.7.egg/timm/optim/optim_factory.py", line 53, in create_optimizer
    assert has_apex and torch.cuda.is_available(), 'APEX and CUDA required for fused optimizers'
AssertionError: APEX and CUDA required for fused optimizers

Do you use native APEX? must I install it? (I am running with torch==1.7.1)

rwightman commented 3 years ago

It's exactly as that assert says, you need it for the fused versions of optimizers. Remove the 'fused' if you don't have or don't want to install native APEX

sefibk commented 3 years ago

Thank you very