facebookresearch / fairseq

Facebook AI Research Sequence-to-Sequence Toolkit written in Python.
MIT License
30.44k stars 6.4k forks source link

Error when running fairseq data2vec example #5369

Open FilipAndersson245 opened 12 months ago

FilipAndersson245 commented 12 months ago

🐛 Bug

Traceback (most recent call last):
  File "/home/odin/dev/nlp-swe/swedish_nlp_datasets/fairseq/fairseq_cli/hydra_train.py", line 10, in <module>
    import hydra
  File "/home/odin/.pyenv/versions/fairseq/lib/python3.11/site-packages/hydra/__init__.py", line 5, in <module>
    from hydra import utils
  File "/home/odin/.pyenv/versions/fairseq/lib/python3.11/site-packages/hydra/utils.py", line 10, in <module>
    from hydra._internal.utils import (
  File "/home/odin/.pyenv/versions/fairseq/lib/python3.11/site-packages/hydra/_internal/utils.py", line 21, in <module>
    from hydra.core.utils import get_valid_filename, split_config_path
  File "/home/odin/.pyenv/versions/fairseq/lib/python3.11/site-packages/hydra/core/utils.py", line 19, in <module>
    from hydra.core.hydra_config import HydraConfig
  File "/home/odin/.pyenv/versions/fairseq/lib/python3.11/site-packages/hydra/core/hydra_config.py", line 6, in <module>
    from hydra.conf import HydraConf
  File "/home/odin/.pyenv/versions/fairseq/lib/python3.11/site-packages/hydra/conf/__init__.py", line 62, in <module>
    class JobConf:
  File "/home/odin/.pyenv/versions/fairseq/lib/python3.11/site-packages/hydra/conf/__init__.py", line 87, in JobConf
    @dataclass
     ^^^^^^^^^
  File "/home/odin/.pyenv/versions/3.11.4/lib/python3.11/dataclasses.py", line 1230, in dataclass
    return wrap(cls)
           ^^^^^^^^^
  File "/home/odin/.pyenv/versions/3.11.4/lib/python3.11/dataclasses.py", line 1220, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odin/.pyenv/versions/3.11.4/lib/python3.11/dataclasses.py", line 958, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odin/.pyenv/versions/3.11.4/lib/python3.11/dataclasses.py", line 815, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'hydra.conf.JobConf.JobConfig.OverrideDirname'> for field override_dirname is not allowed: use default_factory

To Reproduce

python fairseq_cli/hydra_train.py -m --config-dir examples/data2vec/config/v2 \
      --config-name base_text_only_task task.data=../data/outfile.txt

Code sample

Expected behavior

Environment

Additional context

mattbonnell commented 11 months ago

I had the same error on Python 3.11, switched to Python 3.8 and it works.