Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__init__() missing 1 required positional argument: 'temperature' #32

Open
davidecarnevali opened this issue Sep 20, 2021 · 11 comments
Open

Comments

@davidecarnevali
Copy link

I cloned the repository and run:
autoalbument-search --config-dir autoalbument/examples/cifar10/

But I got the following error (the same with imagenet and svhn)

Error executing job with overrides: []
Traceback (most recent call last):
File "/users/dcar/anaconda3/envs/pytorch/lib/python3.8/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 62, in _call_target
return target(*args, **kwargs)
TypeError: init() missing 1 required positional argument: 'temperature'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/users/dcar/anaconda3/envs/pytorch/bin/autoalbument-search", line 8, in
sys.exit(main())
File "/users/dcar/anaconda3/envs/pytorch/lib/python3.8/site-packages/hydra/main.py", line 48, in decorated_main
_run_hydra(
File "/users/dcar/anaconda3/envs/pytorch/lib/python3.8/site-packages/hydra/_internal/utils.py", line 377, in _run_hydra
run_and_report(
File "/users/dcar/anaconda3/envs/pytorch/lib/python3.8/site-packages/hydra/_internal/utils.py", line 214, in run_and_report
raise ex
File "/users/dcar/anaconda3/envs/pytorch/lib/python3.8/site-packages/hydra/_internal/utils.py", line 211, in run_and_report
return func()
File "/users/dcar/anaconda3/envs/pytorch/lib/python3.8/site-packages/hydra/_internal/utils.py", line 378, in
lambda: hydra.run(
File "/users/dcar/anaconda3/envs/pytorch/lib/python3.8/site-packages/hydra/_internal/hydra.py", line 111, in run
_ = ret.return_value
File "/users/dcar/anaconda3/envs/pytorch/lib/python3.8/site-packages/hydra/core/utils.py", line 233, in return_value
raise self._return_value
File "/users/dcar/anaconda3/envs/pytorch/lib/python3.8/site-packages/hydra/core/utils.py", line 160, in run_job
ret.return_value = task_function(task_cfg)
File "/users/dcar/anaconda3/envs/pytorch/lib/python3.8/site-packages/autoalbument/cli/search.py", line 54, in main
searcher = instantiate(cfg.searcher, cfg=cfg)
File "/users/dcar/anaconda3/envs/pytorch/lib/python3.8/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 180, in instantiate
return instantiate_node(config, *args, recursive=recursive, convert=convert)
File "/users/dcar/anaconda3/envs/pytorch/lib/python3.8/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 245, in instantiate_node
value = instantiate_node(
File "/users/dcar/anaconda3/envs/pytorch/lib/python3.8/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 266, in instantiate_node
cfg[key] = instantiate_node(
File "/users/dcar/anaconda3/envs/pytorch/lib/python3.8/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 266, in instantiate_node
cfg[key] = instantiate_node(
File "/users/dcar/anaconda3/envs/pytorch/lib/python3.8/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 223, in instantiate_node
items = [
File "/users/dcar/anaconda3/envs/pytorch/lib/python3.8/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 224, in
instantiate_node(item, convert=convert, recursive=recursive)
File "/users/dcar/anaconda3/envs/pytorch/lib/python3.8/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 249, in instantiate_node
return _call_target(target, *args, **kwargs)
File "/users/dcar/anaconda3/envs/pytorch/lib/python3.8/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 64, in _call_target
raise type(e)(
File "/users/dcar/anaconda3/envs/pytorch/lib/python3.8/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 62, in _call_target
return target(*args, **kwargs)
TypeError: Error instantiating 'autoalbument.faster_autoaugment.models.policy_operations.ShiftRGB' : init() missing 1 required positional argument: 'temperature'

My versions are:
albumentations 1.0.3
autoalbument 0.4.0

Any hint?

Thx

@coallar
Copy link

coallar commented Sep 30, 2021

Hi, do you solve this problem?

@davidecarnevali
Copy link
Author

Hi,
yes, I solved this morning by using a fresh installation of pytorch 1.8.2 with cuda 10.2 in a new python virtual environment
I believe I had a system problem/conflict.

D

@adam-j-kelly
Copy link

Hi, I'm having this issue too but can't find pytorch 1.8.2, do you have any more details about how to solve the problem? They would be much appreciated!

@davidecarnevali
Copy link
Author

Hi,
here you can find previous pytorch versions
https://pytorch.org/get-started/previous-versions/

However, I updated to 1.9 and it still works, thus I believe you should create a fresh python virtual environment with pytorch 1.9 and albumentations only, avoiding any conflict with other packages

@kompaso
Copy link

kompaso commented Oct 22, 2021

@adam-j-kelly

Did this solution help you? I tried a different version of torch, but it doesn't work. Log is the same.

@adam-j-kelly
Copy link

@kompaso eventually I did get it working, I think partly due to the above. I created a 3.9.7 venv with the following package versions, although my understanding is that your torchvision/cuda might need to be different depending on hardware:

absl-py==0.11.0
aiohttp==3.7.3
albumentations==0.5.2
antlr4-python3-runtime==4.8
async-timeout==3.0.1
attrs==20.3.0
autoalbument==0.4.0
cachetools==4.2.1
certifi==2020.12.5
chardet==3.0.4
click==7.1.2
colorama==0.4.4
cycler==0.10.0
decorator==4.4.2
efficientnet-pytorch==0.6.3
fsspec==0.8.5
future==0.18.2
google-auth==1.27.0
google-auth-oauthlib==0.4.2
grpcio==1.35.0
hydra-core==1.0.6
idna==2.10
imageio==2.9.0
imgaug==0.4.0
importlib-resources==5.1.0
kiwisolver==1.3.1
Markdown==3.3.3
matplotlib==3.3.4
multidict==5.1.0
munch==2.5.0
networkx==2.5
numpy==1.20.1
oauthlib==3.1.0
omegaconf==2.0.6
opencv-python==4.5.1.48
opencv-python-headless==4.5.1.48
Pillow==8.1.0
pretrainedmodels==0.7.4
protobuf==3.14.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pyparsing==2.4.7
python-dateutil==2.8.1
pytorch-lightning==1.1.8
PyWavelets==1.1.1
PyYAML==5.3.1
requests==2.25.1
requests-oauthlib==1.3.0
rsa==4.7.1
ruamel.yaml==0.16.12
ruamel.yaml.clib==0.2.2
scikit-image==0.18.1
scipy==1.6.1
segmentation-models-pytorch==0.1.3
Shapely==1.7.1
six==1.15.0
tensorboard==2.4.1
tensorboard-plugin-wit==1.8.0
tifffile==2021.2.1
timm==0.3.2
torch==1.9.1+cu111
torchaudio==0.9.1
torchvision==0.10.1+cu111
tqdm==4.57.0
typing-extensions==3.7.4.3
urllib3==1.26.3
Werkzeug==1.0.1
yarl==1.6.3

Good luck!

@kompaso
Copy link

kompaso commented Oct 22, 2021

@adam-j-kelly thanks a lot! In my case problem was in hydra-core

@ihamdi
Copy link

ihamdi commented Nov 23, 2021

This is what I had to do to get the cifar10 example to work:

  • Upgrade Python from 3.6.13 to 3.7.11
  • Downgrade Pytorch from 1.10.0 to 1.8.0
  • Downgrade Hydra-Core from 1.1.0 to 1.0.6
  • Change line 6 in envs/name/lib/site-packages/timm/models/layers/helper.py from "from torch._six import container_abcs" to "import collections.abc as container_abcs"

@VLavado
Copy link

VLavado commented Nov 23, 2021

The solution by @ihamdi worked for me! Thanks a lot!

I needed to add a slight modification by doing pip install torch==1.8.0+cu111 -f https://download.pytorch.org/whl/torch_stable.html to have a compatible CUDA runtime version.

In case it helps anybody:

absl-py==1.0.0
aiohttp==3.8.1
aiosignal==1.2.0
albumentations==1.1.0
antlr4-python3-runtime==4.8
async-timeout==4.0.1
attrs==21.2.0
autoalbument==0.4.0
boto3==1.20.8
botocore==1.23.8
cachetools==4.2.4
certifi==2021.10.8
charset-normalizer==2.0.7
click==8.0.3
colorama==0.4.4
cycler==0.11.0
efficientnet-pytorch==0.6.3
fonttools==4.28.1
frozenlist==1.2.0
fsspec==2021.11.0
future==0.18.2
google-auth==2.3.3
google-auth-oauthlib==0.4.6
grpcio==1.42.0
hydra-core==1.0.6
idna==3.3
imageio==2.11.0
importlib-metadata==4.8.2
importlib-resources==5.4.0
jmespath==0.10.0
joblib==1.1.0
kiwisolver==1.3.2
Markdown==3.3.6
matplotlib==3.5.0
multidict==5.2.0
munch==2.5.0
networkx==2.6.3
numpy==1.21.4
oauthlib==3.1.1
omegaconf==2.0.6
opencv-python-headless==4.5.4.58
packaging==21.3
Pillow==8.4.0
pretrainedmodels==0.7.4
protobuf==3.19.1
pyasn1==0.4.8
pyasn1-modules==0.2.8
pyparsing==3.0.6
python-dateutil==2.8.2
pytorch-lightning==1.1.8
PyWavelets==1.2.0
PyYAML==6.0
qudida==0.0.4
requests==2.26.0
requests-oauthlib==1.3.0
rsa==4.7.2
ruamel.yaml==0.17.17
ruamel.yaml.clib==0.2.6
s3transfer==0.5.0
scikit-image==0.18.3
scikit-learn==1.0.1
scipy==1.7.2
segmentation-models-pytorch==0.1.3
setuptools-scm==6.3.2
six==1.16.0
tensorboard==2.7.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.0
threadpoolctl==3.0.0
tifffile==2021.11.2
timm==0.3.2
tomli==1.2.2
torch==1.8.0+cu111
torchvision==0.9.0+cu111
tqdm==4.62.3
typing_extensions==4.0.0
urllib3==1.26.7
Werkzeug==2.0.2
yarl==1.7.2
zipp==3.6.0

@ihamdi
Copy link

ihamdi commented Nov 23, 2021

The solution by @ihamdi worked for me! Thanks a lot!

I needed to add a slight modification by doing pip install torch==1.8.0+cu111 -f https://download.pytorch.org/whl/torch_stable.html to have a compatible CUDA runtime version.

In case it helps anybody:

absl-py==1.0.0 aiohttp==3.8.1 aiosignal==1.2.0 albumentations==1.1.0 antlr4-python3-runtime==4.8 async-timeout==4.0.1 attrs==21.2.0 autoalbument==0.4.0 boto3==1.20.8 botocore==1.23.8 cachetools==4.2.4 certifi==2021.10.8 charset-normalizer==2.0.7 click==8.0.3 colorama==0.4.4 cycler==0.11.0 efficientnet-pytorch==0.6.3 fonttools==4.28.1 frozenlist==1.2.0 fsspec==2021.11.0 future==0.18.2 google-auth==2.3.3 google-auth-oauthlib==0.4.6 grpcio==1.42.0 hydra-core==1.0.6 idna==3.3 imageio==2.11.0 importlib-metadata==4.8.2 importlib-resources==5.4.0 jmespath==0.10.0 joblib==1.1.0 kiwisolver==1.3.2 Markdown==3.3.6 matplotlib==3.5.0 multidict==5.2.0 munch==2.5.0 networkx==2.6.3 numpy==1.21.4 oauthlib==3.1.1 omegaconf==2.0.6 opencv-python-headless==4.5.4.58 packaging==21.3 Pillow==8.4.0 pretrainedmodels==0.7.4 protobuf==3.19.1 pyasn1==0.4.8 pyasn1-modules==0.2.8 pyparsing==3.0.6 python-dateutil==2.8.2 pytorch-lightning==1.1.8 PyWavelets==1.2.0 PyYAML==6.0 qudida==0.0.4 requests==2.26.0 requests-oauthlib==1.3.0 rsa==4.7.2 ruamel.yaml==0.17.17 ruamel.yaml.clib==0.2.6 s3transfer==0.5.0 scikit-image==0.18.3 scikit-learn==1.0.1 scipy==1.7.2 segmentation-models-pytorch==0.1.3 setuptools-scm==6.3.2 six==1.16.0 tensorboard==2.7.0 tensorboard-data-server==0.6.1 tensorboard-plugin-wit==1.8.0 threadpoolctl==3.0.0 tifffile==2021.11.2 timm==0.3.2 tomli==1.2.2 torch==1.8.0+cu111 torchvision==0.9.0+cu111 tqdm==4.62.3 typing_extensions==4.0.0 urllib3==1.26.7 Werkzeug==2.0.2 yarl==1.7.2 zipp==3.6.0

Yeah please make sure you have the correct cudatoolkit according to your hardware.

Unfortunately the output in the json files isn't giving a rotation range but rather the same negative number as upper and lower limit. When I try to use the file to implement the generated augmentations, the code blows up because it is impossible to generate a random number between two numbers that are identical. I'm stumped and don't know how to proceed from there. I don't want to mess with the random just to make this work.

@PetrDvoracek
Copy link

Hi, I solved this problem on my machine by downgrading the hydra core version to hydra-core==1.0.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants