D-X-Y / AutoDL-Projects

Automated deep learning algorithms implemented in PyTorch.
MIT License
1.56k stars 281 forks source link

ImportError: cannot import name 'load_config' #26

Closed colorjam closed 4 years ago

colorjam commented 4 years ago

Hi, Thank you for the nice code. But I got a problem when I run the script.

Traceback (most recent call last):
  File "./exps/search-shape.py", line 14, in <module>
    from config_utils import load_config, configure2str, obtain_search_single_args as obtain_args
ImportError: cannot import name 'load_config'

Thanks if you could help.

D-X-Y commented 4 years ago

Which command did you run? I double-check the script and can successfully run on my machine. load_config is defined at https://github.com/D-X-Y/NAS-Projects/blob/master/lib/config_utils/__init__.py#L4.

D-X-Y commented 4 years ago

@colorjam Hi, would you mind to show some examples of reproducing this problem?

colorjam commented 4 years ago

@colorjam Hi, would you mind to show some examples of reproducing this problem?

In the search-width-cifar.sh , I just comment the following lines

#!/bin/bash
# bash ./scripts-search/search-width-cifar.sh cifar10 ResNet110 CIFAR 0 0 0.57 777
# bash ./scripts-search/search-width-cifar.sh cifar10 ResNet110 CIFARX 0 0 0.57 777
# set -e
# echo script name: $0
# echo $# arguments
# if [ "$#" -ne 7 ] ;then
#   echo "Input illegal number of parameters " $#
#   echo "Need 7 parameters for the dataset and the-model-name and the-optimizer and gumbel-max/min and FLOP-ratio and the-random-seed"
#   exit 1
# fi
# if [ "$TORCH_HOME" = "" ]; then
#   echo "Must set TORCH_HOME envoriment variable for data dir saving"
#   exit 1
# else
#   echo "TORCH_HOME : $TORCH_HOME"
# fi

run bash ./scripts-search/search-width-gumbel.sh cifar10 ResNet56 CIFARX 0.57 -1, and I get the error message

root@c9c185ce6296:/userhome/repo/TAS# bash ./scripts-search/search-width-gumbel.sh cifar10 ResNet56 CIFARX 0.57 -1
Python 3.6.8
Traceback (most recent call last):
  File "./exps/search-shape.py", line 14, in <module>
    from config_utils import load_config, configure2str, obtain_search_single_args as obtain_args
ImportError: cannot import name 'load_config'
Skip training the best configuration
D-X-Y commented 4 years ago

It is strange, I tried but did not find this error. You can try to print lib_dir at https://github.com/D-X-Y/NAS-Projects/blob/master/exps/search-shape.py#L12. It should be /userhome/repo/TAS/lib in your machine. Otherwise, it is a problem of path.

colorjam commented 4 years ago

@D-X-Y Thank you for the response. I just add print(lib_dir) after https://github.com/D-X-Y/NAS-Projects/blob/f8f3f382e0ec4a8a16b76c16b42758e353ddd93e/exps/search-shape.py#L12 and it runs successfully.

D-X-Y commented 4 years ago

Cool.