rwightman/efficientdet-pytorch

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

sefibk opened this issue · 5 comments

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):**
 - OS: Ubuntu 18.04
 - This repository version [cloned Master no Feb 2nd - not sure how to check the version]
 - Python 3.7.0
 - pytorch                   1.7.1           py3.7_cuda11.0.221_cudnn8.0.5_0    pytorch
 - timm                      0.3.4                    pypi_0    pypi

**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

@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?

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?

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)

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

Thank you very