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

use default_factory #473

Closed
supercraaazy opened this issue Jun 7, 2023 · 11 comments
Closed

use default_factory #473

supercraaazy opened this issue Jun 7, 2023 · 11 comments
Labels
stale 🪨话题搁置

Comments

@supercraaazy
Copy link

Guys easy on me i am a beginner i followed all steps i receive this message 👍

File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 815, in _get_field
raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'fairseq.dataclass.configs.CommonConfig'> for field common is not allowed: use default_factory. i am mac user. any idea.

@RVC-Boss
Copy link
Member

RVC-Boss commented Jun 8, 2023

maybe it's because the version of fairseq
Our repo is tested in fairseq==0.12.2

@supercraaazy
Copy link
Author

maybe it's because the version of fairseq Our repo is tested in fairseq==0.12.2

this is the same on i am using still the same error

@theoparis
Copy link

theoparis commented Jun 10, 2023

I have been trying to fix this by modifying fairseq to support python 3.11, but it does not seem to be working. See https://github.com/wtf-things/fairseq-311/commits/main and facebookresearch/fairseq#5062.

File "/home/theo/.local/lib/python3.11/site-packages/fairseq/__init__.py", line 31, in <module>
    hydra_init()
  File "/home/theo/.local/lib/python3.11/site-packages/fairseq/dataclass/initialize.py", line 24, in hydra_init
    cs.store(name=k, node=v)
  File "/home/theo/.local/lib/python3.11/site-packages/hydra/core/config_store.py", line 85, in store
    cfg = OmegaConf.structured(node)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/theo/.local/lib/python3.11/site-packages/omegaconf/omegaconf.py", line 125, in structured
    return OmegaConf.create(obj, parent, flags)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/theo/.local/lib/python3.11/site-packages/omegaconf/omegaconf.py", line 178, in create
    return OmegaConf._create_impl(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/theo/.local/lib/python3.11/site-packages/omegaconf/omegaconf.py", line 900, in _create_impl
    format_and_raise(node=None, key=None, value=None, msg=str(e), cause=e)
  File "/home/theo/.local/lib/python3.11/site-packages/omegaconf/_utils.py", line 901, in format_and_raise
    _raise(ex, cause)
  File "/home/theo/.local/lib/python3.11/site-packages/omegaconf/_utils.py", line 799, in _raise
    raise ex.with_traceback(sys.exc_info()[2])  # set env var OC_CAUSE=1 for full trace
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/theo/.local/lib/python3.11/site-packages/omegaconf/omegaconf.py", line 896, in _create_impl
    raise ValidationError(
omegaconf.errors.ValidationError: Object of unsupported type: '_MISSING_TYPE'
    full_key:
    object_type=None

Am I doing something wrong? I downloaded the latest github release file and extracted it, then I ran

python3 -m pip install -r requirements.txt
python3 -m pip install git+https://github.com/wtf-things/fairseq-311/
python3 infer-web.py

@supercraaazy
Copy link
Author

ok now after long time of using codes that may fix my issue. now i am getting this message :

Use Language: en_US
common - <dataclasses._MISSING_TYPE object at 0x10e83fe80>
Traceback (most recent call last):
File "/Users/supercrazy/Downloads/Retrieval-based-Voice-Conversion-WebUI-main 2/infer-web.py", line 82, in
from fairseq import checkpoint_utils
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/fairseq/init.py", line 31, in
hydra_init()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/fairseq/dataclass/initialize.py", line 24, in hydra_init
cs.store(name=k, node=v)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/hydra/core/config_store.py", line 85, in store
cfg = OmegaConf.structured(node)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/omegaconf/omegaconf.py", line 125, in structured
return OmegaConf.create(obj, parent, flags)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/omegaconf/omegaconf.py", line 178, in create
return OmegaConf._create_impl(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/omegaconf/omegaconf.py", line 900, in _create_impl
format_and_raise(node=None, key=None, value=None, msg=str(e), cause=e)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/omegaconf/_utils.py", line 899, in format_and_raise
_raise(ex, cause)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/omegaconf/_utils.py", line 797, in _raise
raise ex.with_traceback(sys.exc_info()[2]) # set env var OC_CAUSE=1 for full trace
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/omegaconf/omegaconf.py", line 896, in _create_impl
raise ValidationError(
omegaconf.errors.ValidationError: Object of unsupported type: '_MISSING_TYPE'
full_key:
object_type=None

any idea?

@supervict0r
Copy link

I am stuck here:

python3.11 infer-web.py

Traceback (most recent call last):
File "/Retrieval-based-Voice-Conversion-WebUI-main/infer-web.py", line 26, in
from fairseq import checkpoint_utils
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/fairseq/init.py", line 20, in
from fairseq.distributed import utils as distributed_utils
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/fairseq/distributed/init.py", line 7, in
from .fully_sharded_data_parallel import (
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/fairseq/distributed/fully_sharded_data_parallel.py", line 10, in
from fairseq.dataclass.configs import DistributedTrainingConfig
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/fairseq/dataclass/init.py", line 6, in
from .configs import FairseqDataclass
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/fairseq/dataclass/configs.py", line 1104, in
@DataClass
^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 1230, in dataclass
return wrap(cls)
^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 1220, in wrap
return _process_class(cls, init, repr, eq, order, unsafe_hash,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 958, in _process_class
cls_fields.append(_get_field(cls, name, type, kw_only))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 815, in _get_field
raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'fairseq.dataclass.configs.CommonConfig'> for field common is not allowed: use default_factory

@HardikJain02
Copy link

I tried this.

Before
common: CommonConfig= CommonConfig()

After
common: CommonConfig = field(default_factory= CommonConfig())

In the same way, you will have to do it for all the fields required. After that, I got another error. So I uninstalled the fairseq. this absurdism is making me more of a stoic daily.

@One-sixth
Copy link

The official fix of fairseq is too slow. I have created a fixed version of fairseq that works properly on Python 3.11.
You can try this If you need.

pip install git+https://github.com/One-sixth/fairseq.git

@CrabbyDisk
Copy link

I am having the same issue.

@ghost ghost mentioned this issue Sep 30, 2023
@Yamamotooo1994
Copy link

Yamamotooo1994 commented Jan 13, 2024

@CrabbyDisk @theoparis
Hey guys, I got same problem and I fixed this by install python 3.10.11

During requirement installation, I found some package can only run under <python 3.11

https://www.python.org/ftp/python/3.10.11/python-3.10.11-amd64.exe

Hope this can help you, enjoy!

@GUUser91
Copy link

Here is the solution for those using Python3.11
facebookresearch/fairseq#5012 (comment)

@github-actions github-actions bot added the stale 🪨话题搁置 label Apr 19, 2024
Copy link
Contributor

github-actions bot commented May 5, 2024

This issue was closed because it has been inactive for 15 days since being marked as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale 🪨话题搁置
Projects
None yet
Development

No branches or pull requests

9 participants