Registry / ai-ml / unbabel-comet

unbabel-comet

JSON →
library2.2.7pypypi✓ verified 85d ago

High-quality Machine Translation Evaluation library using neural models. Version 2.2.7. Active development on GitHub, with minor releases every few months.

pip install unbabel-comet
INSTALL
IMPORT
SIG · UNBABEL-COMET
U
unbabel-comet
ai-mlpythonv2.2.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

download_model
from comet import download_model
from comet.models import download_model
download_model is at the package level, not in comet.models
load_from_checkpoint
from comet import load_from_checkpoint
from comet.models import load_from_checkpoint
Same as download_model; package-level function

Load a COMET model and score translation pairs.

from comet import download_model, load_from_checkpoint model_path = download_model("Unbabel/wmt22-comet-da") model = load_from_checkpoint(model_path) data = [ { "src": "This is a source sentence.", "mt": "Ceci est une phrase source.", "ref": "This is a reference translation." } ] seg_scores, sys_score = model.predict(data, batch_size=8, gpus=1) print(seg_scores, sys_score)
comet --version
Debug
Known issues
gotchaThe `predict` method expects a list of dicts with keys 'src', 'mt', and optionally 'ref'. Missing keys cause KeyError.
fix
Ensure each dict contains 'src' and 'mt' keys (and 'ref' if required).
affects: all
gotchaModel downloads can be large (several GB). The download_model function caches in ~/.cache/comet by default.
fix
Set environment variable COMET_CACHE_DIR to a custom path.
affects: all
deprecatedThe `comet-score` CLI uses model.half() by default starting v2.2.5, which slightly changes scores compared to v2.2.4.
fix
Upgrade to v2.2.6+ for consistent half-precision behavior.
affects: >=2.2.5, <2.2.6
gotchaSome models (like XCOMET) are only for inference and not for training in current releases.
fix
Check model documentation to confirm training support.
affects: >=2.2.0, <2.3.0
Errors
Common errors & fixes
KeyError: 'src'
Missing required key in input data dict.
fix
Ensure each sample dict has 'src' and 'mt' keys.
requests.exceptions.ConnectionError: HTTPConnectionPool
Network issue downloading model from Hugging Face hub.
fix
Check internet connection or set HF_HUB_OFFLINE=1 to use cached models.
AttributeError: module 'comet' has no attribute 'download_model'
Incorrect import path.
fix
Use 'from comet import download_model' instead of 'from comet.models import download_model'.
Upgrade
Version history
2.2.7latest on PyPI · released Sep 1, 2025
Audit
Dependencies
torchrequiredRequired for model inference
Agent activity
39 hits · last 30 days
node
36
OpenAI (training)
1
Resources
unbabel-comet — pip install unbabel-comet · libregistry