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

Running train.py results in ValueError from dataclasses #3

Open
leleogere opened this issue May 28, 2024 · 0 comments
Open

Running train.py results in ValueError from dataclasses #3

leleogere opened this issue May 28, 2024 · 0 comments

Comments

@leleogere
Copy link

I'm trying to play a bit with ScorePerformer to understand it better. I installed all requirements in a new environment, and I did not change anything in the code. When trying to execute the train.py script, I'm getting an error from dataclasses:

$ python scoreperformer/train.py
Traceback (most recent call last):
  File "/home/user/ScorePerformer/scoreperformer/train.py", line 5, in <module>
    from scoreperformer.experiments import Trainer
  File "/home/user/ScorePerformer/scoreperformer/experiments/__init__.py", line 1, in <module>
    from .trainer import Trainer
  File "/home/user/ScorePerformer/scoreperformer/experiments/trainer.py", line 22, in <module>
    from scoreperformer.models.base import Model
  File "/home/user/ScorePerformer/scoreperformer/models/__init__.py", line 2, in <module>
    from .scoreperformer import (
  File "/home/user/ScorePerformer/scoreperformer/models/scoreperformer/__init__.py", line 1, in <module>
    from .embeddings import TupleTokenEmbeddings, TupleTokenLMHead, TupleTokenTiedLMHead
  File "/home/user/ScorePerformer/scoreperformer/models/scoreperformer/embeddings.py", line 12, in <module>
    from scoreperformer.modules.transformer import DiscreteContinuousEmbedding, DiscreteDenseContinuousEmbedding
  File "/home/user/ScorePerformer/scoreperformer/modules/transformer/__init__.py", line 21, in <module>
    from .transformer import (
  File "/home/user/ScorePerformer/scoreperformer/modules/transformer/transformer.py", line 34, in <module>
    @dataclass
     ^^^^^^^^^
  File "/home/user/miniconda3/envs/ScorePerformer/lib/python3.11/dataclasses.py", line 1232, in dataclass
    return wrap(cls)
           ^^^^^^^^^
  File "/home/user/miniconda3/envs/ScorePerformer/lib/python3.11/dataclasses.py", line 1222, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/miniconda3/envs/ScorePerformer/lib/python3.11/dataclasses.py", line 958, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/miniconda3/envs/ScorePerformer/lib/python3.11/dataclasses.py", line 815, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'scoreperformer.modules.transformer.attention.AttentionConfig'> for field attention is not allowed: use default_factory

I know that I should probably pass some parameters to the script (e.g. data location), but I assume that the script should error due to missing parameters rather than this one.

By the way, having an example of a training command would be very valuable!

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

1 participant