changlin31 / BossNAS

(ICCV 2021) BossNAS: Exploring Hybrid CNN-transformers with Block-wisely Self-supervised Neural Architecture Search
136 stars 20 forks source link

ImportError: cannot import name 'resolve_se_args' from 'timm.models.efficientnet_blocks' #13

Closed sekhaish closed 2 years ago

sekhaish commented 2 years ago

Hi there, I am trying to search on NATS-Bench using CIFAR 10 dataset and encountered this error. Could you kindly help me with this?

sekhaish commented 2 years ago

Pasting the entire thing here!

warnings.warn( WARNING:torch.distributed.run:


Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed.


fused_weight_gradient_mlp_cuda module not found. gradient accumulation fusion with weight gradient computation disabled. fused_weight_gradient_mlp_cuda module not found. gradient accumulation fusion with weight gradient computation disabled. Traceback (most recent call last): File "train.py", line 16, in import bossnas # register hooks File "/home/vishwam/aishu/BossNAS/BossNAS/searching/bossnas/init.py", line 3, in import bossnas.models File "/home/vishwam/aishu/BossNAS/BossNAS/searching/bossnas/models/init.py", line 5, in from bossnas.models.supernets.hytra_supernet import SupernetHyTra File "/home/vishwam/aishu/BossNAS/BossNAS/searching/bossnas/models/supernets/hytra_supernet.py", line 7, in from bossnas.models.operations.operation_dict import OPS File "/home/vishwam/aishu/BossNAS/BossNAS/searching/bossnas/models/operations/operation_dict.py", line 3, in from .mbconv_ops import InvertedResidual File "/home/vishwam/aishu/BossNAS/BossNAS/searching/bossnas/models/operations/mbconv_ops.py", line 2, in from timm.models.efficientnet_blocks import make_divisible, SqueezeExcite, resolve_se_args ImportError: cannot import name 'resolve_se_args' from 'timm.models.efficientnet_blocks' (/anaconda/lib/python3.8/site-packages/timm/models/efficientnet_blocks.py) Traceback (most recent call last): File "train.py", line 16, in import bossnas # register hooks File "/home/vishwam/aishu/BossNAS/BossNAS/searching/bossnas/init.py", line 3, in import bossnas.models File "/home/vishwam/aishu/BossNAS/BossNAS/searching/bossnas/models/init.py", line 5, in from bossnas.models.supernets.hytra_supernet import SupernetHyTra File "/home/vishwam/aishu/BossNAS/BossNAS/searching/bossnas/models/supernets/hytra_supernet.py", line 7, in from bossnas.models.operations.operation_dict import OPS File "/home/vishwam/aishu/BossNAS/BossNAS/searching/bossnas/models/operations/operation_dict.py", line 3, in from .mbconv_ops import InvertedResidual File "/home/vishwam/aishu/BossNAS/BossNAS/searching/bossnas/models/operations/mbconv_ops.py", line 2, in from timm.models.efficientnet_blocks import make_divisible, SqueezeExcite, resolve_se_args ImportError: cannot import name 'resolve_se_args' from 'timm.models.efficientnet_blocks' (/anaconda/lib/python3.8/site-packages/timm/models/efficientnet_blocks.py) WARNING:torch.distributed.elastic.multiprocessing.api:Sending process 28409 closing signal SIGTERM ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 28408) of binary: /anaconda/bin/python Traceback (most recent call last): File "/anaconda/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/anaconda/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/anaconda/lib/python3.8/site-packages/torch/distributed/launch.py", line 193, in main() File "/anaconda/lib/python3.8/site-packages/torch/distributed/launch.py", line 189, in main launch(args) File "/anaconda/lib/python3.8/site-packages/torch/distributed/launch.py", line 174, in launch run(args) File "/anaconda/lib/python3.8/site-packages/torch/distributed/run.py", line 710, in run elastic_launch( File "/anaconda/lib/python3.8/site-packages/torch/distributed/launcher/api.py", line 131, in call return launch_agent(self._config, self._entrypoint, list(args)) File "/anaconda/lib/python3.8/site-packages/torch/distributed/launcher/api.py", line 259, in launch_agent raise ChildFailedError( torch.distributed.elastic.multiprocessing.errors.ChildFailedError:

train.py FAILED

Failures:

------------------------------------------------------------ Root Cause (first observed failure): [0]: time : 2022-03-10_19:38:27 host : vv-gpu2002-nc12s-v3.internal.cloudapp.net rank : 0 (local_rank: 0) exitcode : 1 (pid: 28408) error_file: traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html ============================================================
changlin31 commented 2 years ago

Hi @sekhaish

It seems an import error. What is your timm version? We use 0.3.2. pip install timm==0.3.2

sekhaish commented 2 years ago

Hi @changlin31 , thank you for your response. Yes, I made sure the version is 0.3.2 and it did not work. I got the error as above. I tried playing around with a few versions and the error did not change.

changlin31 commented 2 years ago

It's weird. Could you try start a python console in your environment and run:

import timm
timm.__version__
from timm.models.efficientnet_blocks import make_divisible, SqueezeExcite, resolve_se_args

For my environment, it outputs this and yields no error: '0.3.2'

sekhaish commented 2 years ago

Screenshot from 2022-03-11 11-31-22 Hi @changlin31 upon downgrading the torch version to 1.7.0 with Ttimm 0.3.2, I was able to run it without any errors. Thanks for your time. much appreciated.