ImperialCollegeLondon / ReCoDE-DeepLearning-Best-Practices

This repository provides guidelines and best practices for starting a new deep learning project.
https://ubiquitous-robot-j5jn44o.pages.github.io/
BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

Error with hydra conf #20

Closed dalonsoa closed 8 months ago

dalonsoa commented 8 months ago

After installing all the dependencies in a fresh environment, I get the error below when running ReCoDE-DeepLearning-Best-Practices-main/learning/Learning_about_hydra.ipynb

Error message ``` ValueError Traceback (most recent call last) ----> 1 import hydra 2 from hydra import compose, initialize 3 from omegaconf import OmegaConf File ~/Downloads/ReCoDE-DeepLearning-Best-Practices-main/venv/lib/python3.11/site-packages/hydra/__init__.py:5 1 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 3 # Source of truth for Hydra's version 4 __version__ = \"1.2.0\" ----> 5 from hydra import utils 6 from hydra.errors import MissingConfigException 7 from hydra.main import main File ~/Downloads/ReCoDE-DeepLearning-Best-Practices-main/venv/lib/python3.11/site-packages/hydra/utils.py:8 5 from pathlib import Path 6 from typing import Any, Callable ----> 8 import hydra._internal.instantiate._instantiate2 9 import hydra.types 10 from hydra._internal.utils import _locate File ~/Downloads/ReCoDE-DeepLearning-Best-Practices-main/venv/lib/python3.11/site-packages/hydra/_internal/instantiate/_instantiate2.py:12 9 from omegaconf import OmegaConf, SCMode 10 from omegaconf._utils import is_structured_config ---> 12 from hydra._internal.utils import _locate 13 from hydra.errors import InstantiationException 14 from hydra.types import ConvertMode, TargetConf File ~/Downloads/ReCoDE-DeepLearning-Best-Practices-main/venv/lib/python3.11/site-packages/hydra/_internal/utils.py:18 16 from hydra._internal.config_search_path_impl import ConfigSearchPathImpl 17 from hydra.core.config_search_path import ConfigSearchPath, SearchPathQuery ---> 18 from hydra.core.utils import get_valid_filename, validate_config_path 19 from hydra.errors import ( 20 CompactHydraException, 21 InstantiationException, 22 SearchPathException, 23 ) 24 from hydra.types import RunMode, TaskFunction File ~/Downloads/ReCoDE-DeepLearning-Best-Practices-main/venv/lib/python3.11/site-packages/hydra/core/utils.py:20 18 from hydra import version 19 from hydra._internal.deprecation_warning import deprecation_warning ---> 20 from hydra.core.hydra_config import HydraConfig 21 from hydra.core.singleton import Singleton 22 from hydra.types import HydraContext, TaskFunction File ~/Downloads/ReCoDE-DeepLearning-Best-Practices-main/venv/lib/python3.11/site-packages/hydra/core/hydra_config.py:6 2 from typing import Any, Optional 4 from omegaconf import DictConfig, OmegaConf ----> 6 from hydra.conf import HydraConf 7 from hydra.core.singleton import Singleton 10 class HydraConfig(metaclass=Singleton): File ~/Downloads/ReCoDE-DeepLearning-Best-Practices-main/venv/lib/python3.11/site-packages/hydra/conf/__init__.py:46 41 task: List[str] = field(default_factory=lambda: []) 44 # job runtime information will be populated here 45 @dataclass ---> 46 class JobConf: 47 # Job name, populated automatically unless specified by the user (in config or cli) 48 name: str = MISSING 50 # Change current working dir to the output dir. 51 # Will be non-optional and default to False in Hydra 1.3 File ~/Downloads/ReCoDE-DeepLearning-Best-Practices-main/venv/lib/python3.11/site-packages/hydra/conf/__init__.py:75, in JobConf() 72 env_copy: List[str] = field(default_factory=list) 74 # Job config ---> 75 @dataclass 76 class JobConfig: 77 @dataclass 78 # configuration for the ${hydra.job.override_dirname} runtime variable 79 class OverrideDirname: 80 kv_sep: str = \"=\" File ~/.pyenv/versions/3.11.7/lib/python3.11/dataclasses.py:1230, in dataclass(cls, init, repr, eq, order, unsafe_hash, frozen, match_args, kw_only, slots, weakref_slot) 1227 return wrap 1229 # We're called as @dataclass without parens. -> 1230 return wrap(cls) File ~/.pyenv/versions/3.11.7/lib/python3.11/dataclasses.py:1220, in dataclass..wrap(cls) 1219 def wrap(cls): -> 1220 return _process_class(cls, init, repr, eq, order, unsafe_hash, 1221 frozen, match_args, kw_only, slots, 1222 weakref_slot) File ~/.pyenv/versions/3.11.7/lib/python3.11/dataclasses.py:958, in _process_class(cls, init, repr, eq, order, unsafe_hash, frozen, match_args, kw_only, slots, weakref_slot) 955 kw_only = True 956 else: 957 # Otherwise it's a field of some type. --> 958 cls_fields.append(_get_field(cls, name, type, kw_only)) 960 for f in cls_fields: 961 fields[f.name] = f File ~/.pyenv/versions/3.11.7/lib/python3.11/dataclasses.py:815, in _get_field(cls, a_name, a_type, default_kw_only) 811 # For real fields, disallow mutable defaults. Use unhashable as a proxy 812 # indicator for mutability. Read the __hash__ attribute from the class, 813 # not the instance. 814 if f._field_type is _FIELD and f.default.__class__.__hash__ is None: --> 815 raise ValueError(f'mutable default {type(f.default)} for field ' 816 f'{f.name} is not allowed: use default_factory') 818 return f ValueError: mutable default for field override_dirname is not allowed: use default_factory" ```
dalonsoa commented 8 months ago

I'm using Python 3.11.7 with the following dependencies installed today with pip install -r requirements.txt:

Package                  Version
------------------------ -----------
aiohttp                  3.9.1
aiosignal                1.3.1
alembic                  1.13.1
antlr4-python3-runtime   4.9.3
appdirs                  1.4.4
asttokens                2.4.1
attrs                    23.2.0
autopage                 0.5.2
certifi                  2023.11.17
cfgv                     3.4.0
charset-normalizer       3.3.2
click                    8.1.7
cliff                    4.5.0
cmaes                    0.10.0
cmake                    3.28.1
cmd2                     2.4.3
colorlog                 6.8.0
comm                     0.2.1
contourpy                1.2.0
cycler                   0.12.1
debugpy                  1.8.0
decorator                5.1.1
distlib                  0.3.8
docker-pycreds           0.4.0
einops                   0.7.0
executing                2.0.1
filelock                 3.13.1
fonttools                4.47.2
frozenlist               1.4.1
fsspec                   2023.12.2
gitdb                    4.0.11
GitPython                3.1.41
greenlet                 3.0.3
hydra-colorlog           1.2.0
hydra-core               1.2.0
hydra-optuna-sweeper     1.2.0
identify                 2.5.33
idna                     3.6
iniconfig                2.0.0
ipykernel                6.28.0
ipython                  8.20.0
jedi                     0.19.1
Jinja2                   3.1.3
jupyter_client           8.6.0
jupyter_core             5.7.1
kiwisolver               1.4.5
lightning-utilities      0.10.1
lit                      17.0.6
Mako                     1.3.0
markdown-it-py           3.0.0
MarkupSafe               2.1.4
matplotlib               3.8.2
matplotlib-inline        0.1.6
mdurl                    0.1.2
mpmath                   1.3.0
multidict                6.0.4
nest-asyncio             1.6.0
networkx                 3.2.1
nodeenv                  1.8.0
numpy                    1.26.3
nvidia-cublas-cu11       11.10.3.66
nvidia-cuda-cupti-cu11   11.7.101
nvidia-cuda-nvrtc-cu11   11.7.99
nvidia-cuda-runtime-cu11 11.7.99
nvidia-cudnn-cu11        8.5.0.96
nvidia-cufft-cu11        10.9.0.58
nvidia-curand-cu11       10.2.10.91
nvidia-cusolver-cu11     11.4.0.1
nvidia-cusparse-cu11     11.7.4.91
nvidia-nccl-cu11         2.14.3
nvidia-nvtx-cu11         11.7.91
omegaconf                2.3.0
optuna                   2.10.1
packaging                23.2
parso                    0.8.3
pbr                      6.0.0
pexpect                  4.9.0
pillow                   10.2.0
pip                      23.2.1
platformdirs             4.1.0
pluggy                   1.3.0
pre-commit               3.6.0
prettytable              3.9.0
prompt-toolkit           3.0.43
protobuf                 4.25.2
psutil                   5.9.8
ptyprocess               0.7.0
pure-eval                0.2.2
Pygments                 2.17.2
pyparsing                3.1.1
pyperclip                1.8.2
pyrootutils              1.0.4
pytest                   7.4.4
python-dateutil          2.8.2
python-dotenv            1.0.0
pytorch-lightning        2.1.3
PyYAML                   6.0.1
pyzmq                    25.1.2
requests                 2.31.0
rich                     13.7.0
scipy                    1.12.0
sentry-sdk               1.39.2
setproctitle             1.3.3
setuptools               65.5.0
six                      1.16.0
smmap                    5.0.1
SQLAlchemy               2.0.25
stack-data               0.6.3
stevedore                5.1.0
sympy                    1.12
torch                    2.0.1
torchmetrics             1.3.0.post0
torchvision              0.15.2
tornado                  6.4
tqdm                     4.66.1
traitlets                5.14.1
triton                   2.0.0
typing_extensions        4.9.0
urllib3                  2.1.0
virtualenv               20.25.0
wandb                    0.16.2
wcwidth                  0.2.13
wheel                    0.42.0
yarl                     1.9.4
dalonsoa commented 8 months ago

I get the same error whenever I import hydra, so most likely nothing to do with your project. Maybe it does not like Python 3.11.

import hydra
antonibigata commented 8 months ago

I just tested with python 3.11 and I get the same error. Works fine with python 3.10. I will add this constraint in the README.