Comments (7)
FYI: I submitted a PR with proposed fixes in #178
from comet.
Thanks @arturnn I will look into the PR asap!
from comet.
@arturnn haven't had time yet, but its not forgotten.
from comet.
Hi ! I just got a very similar error ('dict' object has no attribute 'scores', also highlighting pred.scores in the trace), but in my case there is no GPU on the machine I used.
The first time I got the error I specified gpus=0 (I thought it was the correct way to make it run on CPU), but then I removed the parameter and got the same error as well.
%env TOKENIZERS_PARALLELISM=false
issue_data = [
{
"src": "10 ๅฐ 15 ๅ้ๅฏไปฅ้ๅฐๅ",
"mt": "Can I receive my food in 10 to 15 minutes?",
"ref": "Can it be delivered between 10 to 15 minutes?"
},
{
"src": "Pode ser entregue dentro de 10 a 15 minutos?",
"mt": "Can you send it for 10 to 15 minutes?",
"ref": "Can it be delivered between 10 to 15 minutes?"
}
]
comet_model = load_from_checkpoint(download_model("Unbabel/wmt22-comet-da"))
comet_output = comet_model.predict(issue_data, batch_size=8)
print(model_output)
print(model_output.system_scores)
Ouput:
[...]
Predicting DataLoader 0: 100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 1/1 [00:00<00:00, 3.09it/s]
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[56], line 15
1 get_ipython().run_line_magic('env', 'TOKENIZERS_PARALLELISM=false')
3 issue_data = [
4 {
5 "src": "10 ๅฐ 15 ๅ้ๅฏไปฅ้ๅฐๅ",
(...)
13 }
14 ]
---> 15 comet_output = comet_model.predict(issue_data, batch_size=8)
16 # comet_output = comet_model.predict(test_dataset_comet, batch_size=8)
17 print(model_output)
File ~/.../venv-mt-models/lib/python3.10/site-packages/comet/models/base.py:652, in CometModel.predict(self, samples, batch_size, gpus, devices, mc_dropout, progress_bar, accelerator, num_workers, length_batching)
648 elif gpus > 1 and not trainer.is_global_zero:
649 # If we are not in the GLOBAL RANK we will return None
650 exit()
--> 652 scores = torch.cat([pred.scores for pred in predictions], dim=0).tolist()
653 if "metadata" in predictions[0]:
654 metadata = flatten_metadata([pred.metadata for pred in predictions])
File ~/.../venv-mt-models/lib/python3.10/site-packages/comet/models/base.py:652, in <listcomp>(.0)
648 elif gpus > 1 and not trainer.is_global_zero:
649 # If we are not in the GLOBAL RANK we will return None
650 exit()
--> 652 scores = torch.cat([pred.scores for pred in predictions], dim=0).tolist()
653 if "metadata" in predictions[0]:
654 metadata = flatten_metadata([pred.metadata for pred in predictions])
AttributeError: 'dict' object has no attribute 'scores'
I'm using unbabel-comet version 2.2.0 and Python 3.10, on Ubuntu 22.04
from comet.
I ran into the same problem when using test cases on huggingface.
AttributeError: 'dict' object has no attribute 'scores'
from comet.
Facing the same issue: AttributeError: 'dict' object has no attribute 'scores'
when running prediction on 1 GPU with the example from https://huggingface.co/Unbabel/wmt23-cometkiwi-da-xl. Looking forward to a fix!
from comet.
I just publish a new release that should solve this.
from comet.
Related Issues (20)
- Different scores from different COMET package versions 1.1.2 and 2.2.1 HOT 2
- Different versions of COMET code give different scores with the same model and date.
- [QUESTION] large file scoring HOT 3
- [QUESTION] Splitting big models over multiple GPUs HOT 6
- [QUESTION] Memory footprint HOT 21
- [INPUT] Text Length of Input (source, reference, and hypothesis) HOT 2
- Change the global variable logger to comet_logger HOT 1
- Training script for XCOMET HOT 1
- Safetensors Support
- [QUESTION] OOM when load XCOMET-XXL in A100 with 40G memory for prediction HOT 4
- [QUESTION] why num_layers = num_hidden_layers + 1 HOT 1
- [QUESTION] Comet kiwi architecture HOT 11
- Training data and scripts used for wmt22-cometkiwi-da HOT 4
- Add missing library stubs or py.typed marker
- I see Unbabel comet is downloading models--xlm-roberta-large folder every time, is there any way to load it from local, if yes please share the hack.[QUESTION] HOT 1
- [QUESTION] predict multiple times with a model
- [QUESTION] how to enable multi-gpu when calling the predict method
- Comet installation fails HOT 3
- Cannot use `load_from_checkpoint` in an offline environment HOT 3
- [QUESTION] MQM dataset on huggingface
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from comet.