-
Notifications
You must be signed in to change notification settings - Fork 78
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
TypeError: comet.models.utils.Prediction is not a dataclasss. This is a subclass of ModelOutput and so must use the @dataclass decorator. #166
Comments
Hi @devrimcavusoglu, I encountered the same problem and tentatively applied the same solution as in your PR (i.e. adding the TracebackTypeError: Caught TypeError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/opt/mt/anaconda3/envs/comet/lib/python3.10/site-packages/torch/utils/data/_utils/worker.py", line 308, in _worker_loop
data = fetcher.fetch(index)
File "/opt/mt/anaconda3/envs/comet/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py", line 54, in fetch
return self.collate_fn(data)
File "/opt/mt/anaconda3/envs/comet/lib/python3.10/site-packages/comet/models/base.py", line 511, in <lambda>
collate_fn=lambda s: self.prepare_sample(s, stage="validate"),
File "/opt/mt/anaconda3/envs/comet/lib/python3.10/site-packages/comet/models/multitask/unified_metric.py", line 362, in prepare_sample
targets = Target(score=torch.tensor(scores, dtype=torch.float))
TypeError: Target.__init__() got an unexpected keyword argument 'score' |
try this: |
Hi @dmar1n, I think you can try adding the |
Thanks a lot, @aRyBernAlTEglOTRO, for the hint! I have run a quick test, and I can confirm this is actually solving the issue I explained above. When possible, I will propose a PR with this change; otherwise, the changes implemented in 2.1 won't work for training a UniTE model, and maybe other models. |
I'll try to bump the package version in the next few weeks. |
@ricardorei @devrimcavusoglu The change is overrided. |
I copied the old ModelOutput class from hugging face to utils. This error should not happen anymore |
🐛 Bug
unbabel-comet==2.1.0
Related CI: https://github.com/obss/jury/actions/runs/6409370286/job/17400400518
Traceback
The text was updated successfully, but these errors were encountered: