-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Dataclass error while importing Fairseq in Python 3.11 #5012
Dataclass error while importing Fairseq in Python 3.11 #5012
Comments
Is Pytorch supporting python 3.11? |
Hi, is there any progress on this issue? |
I created another conda environment with python 3.9, and didn't face with this error. |
@EmreOzkose Yes, Pytorch2.0 supports Python 3.11 |
fairseq/fairseq/dataclass/configs.py Line 1129 in 176cd93
I assume it wants something like this: @dataclass
class FairseqConfig(FairseqDataclass):
- common: CommonConfig = CommonConfig()
+ common: CommonConfig = field(default_factory=CommonConfig) |
same problem |
Experiencing this with 3.11.2. |
I am also facing the same issue. any way to resolve this? |
@Muskan19577 I had to move back to python 3.9 |
getting the same ValeError iwth Python 3.11.4. Any suggestions? |
The official fix is too slow, I made a fix version myself.
|
This issue still exists on the official release. I'm using Python 3.11. |
Same error with Python 3.11.5 |
Same error with Python 3.11 |
Same error with Python 3.11.6 😥 |
The changes to dataclasses are an official change that was introduced in python 3.11, meaning all 3.11.x and higher won't work. This will need to get changed in fairseq's codebase, and isnt dependent on the exact python 3.11.x version |
|
I'm confused. Why is this still not fixed? Will it break backwards compatibility? |
I have encountered these problems, and here is my solution: pip install git+https://github.com/liyaodev/fairseq.git or, download fairseq-0.12.3.1-cp311-cp311-linux_x86_64.whl pip install./fairseq-0.12.3.1-cp311-cp311-linux_x86_64.whl WSL2(Ubuntu22.04) environment(my local use) pip install git+https://github.com/liyaodev/fairseq.git or, download fairseq-0.12.3.1-cp311-cp311-linux_x86_64.whl pip install./fairseq-0.12.3.1-cp311-cp311-linux_x86_64.whl there's a little tip, best use |
Figured since it's April now, I'd throw in my two cents. Still not working. |
Thanks, it work for me. I change all the error place like your suggestion. |
@liyaodev, could you please tell me what the exact name of the package you mentioned would be for Windows? |
Windows 11 Professional |
Not working in CentOS, Python 3.11 |
So uh, still not working in Python 3.12 😅 Compile from source fixes tho |
problem still up and critical |
does this still work? |
This is what I get.
|
This is my first answer on any forum, besides, my English is bad. Sorry, guys.
|
This does not work for me on Windows 11. I am getting |
@yjyuanjin Your patch didn't work for me. |
I'm on Ubuntu linux python 3.11.9(conda venv) and pip installing it worked |
python 3.11, problem solved! Many thanks. |
When I use this, the problem solved but there comes up with anther issue: |
🐛 Bug
FaValueError: mutable default <class 'fairseq.dataclass.configs.CommonConfig'> for field common is not allowed: use default_factory
To Reproduce
Steps to reproduce the behavior (always include the command you ran):
1, pip install fairseq==0.12.2
2. from fairseq import *
Trace:
Traceback (most recent call last):
File "", line 1, in
File "/home/a1bharat/fairseq/fairseq/init.py", line 20, in
from fairseq.distributed import utils as distributed_utils
File "/home/a1bharat/fairseq/fairseq/distributed/init.py", line 7, in
from .legacy_distributed_data_parallel import LegacyDistributedDataParallel
File "/home/a1bharat/fairseq/fairseq/distributed/legacy_distributed_data_parallel.py", line 23, in
from fairseq.distributed import utils
File "/home/a1bharat/fairseq/fairseq/distributed/utils.py", line 22, in
from fairseq.dataclass.configs import DistributedTrainingConfig, FairseqConfig
File "/home/a1bharat/fairseq/fairseq/dataclass/init.py", line 6, in
from .configs import FairseqDataclass
File "/home/a1bharat/fairseq/fairseq/dataclass/configs.py", line 906, in
@DataClass
^^^^^^^^^
File "/usr/lib/python3.11/dataclasses.py", line 1220, in dataclass
return wrap(cls)
^^^^^^^^^
File "/usr/lib/python3.11/dataclasses.py", line 1210, in wrap
return _process_class(cls, init, repr, eq, order, unsafe_hash,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/dataclasses.py", line 958, in _process_class
cls_fields.append(_get_field(cls, name, type, kw_only))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/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
Code sample
Environment
pip
, source): pip install successfulAdditional context
The text was updated successfully, but these errors were encountered: