{"id":28432,"library":"unbabel-comet","title":"Unbabel COMET","description":"High-quality Machine Translation Evaluation library using neural models. Version 2.2.7. Active development on GitHub, with minor releases every few months.","status":"active","version":"2.2.7","language":"python","source_language":"en","source_url":"https://github.com/Unbabel/COMET","tags":["machine translation","evaluation","NLP","quality estimation"],"install":[{"cmd":"pip install unbabel-comet","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Required for model inference","package":"torch","optional":false}],"imports":[{"note":"download_model is at the package level, not in comet.models","wrong":"from comet.models import download_model","symbol":"download_model","correct":"from comet import download_model"},{"note":"Same as download_model; package-level function","wrong":"from comet.models import load_from_checkpoint","symbol":"load_from_checkpoint","correct":"from comet import load_from_checkpoint"}],"quickstart":{"code":"from comet import download_model, load_from_checkpoint\n\nmodel_path = download_model(\"Unbabel/wmt22-comet-da\")\nmodel = load_from_checkpoint(model_path)\n\ndata = [\n    {\n        \"src\": \"This is a source sentence.\",\n        \"mt\": \"Ceci est une phrase source.\",\n        \"ref\": \"This is a reference translation.\"\n    }\n]\n\nseg_scores, sys_score = model.predict(data, batch_size=8, gpus=1)\nprint(seg_scores, sys_score)","lang":"python","description":"Load a COMET model and score translation pairs."},"warnings":[{"fix":"Ensure each dict contains 'src' and 'mt' keys (and 'ref' if required).","message":"The `predict` method expects a list of dicts with keys 'src', 'mt', and optionally 'ref'. Missing keys cause KeyError.","severity":"gotcha","affected_versions":"all"},{"fix":"Set environment variable COMET_CACHE_DIR to a custom path.","message":"Model downloads can be large (several GB). The download_model function caches in ~/.cache/comet by default.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to v2.2.6+ for consistent half-precision behavior.","message":"The `comet-score` CLI uses model.half() by default starting v2.2.5, which slightly changes scores compared to v2.2.4.","severity":"deprecated","affected_versions":">=2.2.5, <2.2.6"},{"fix":"Check model documentation to confirm training support.","message":"Some models (like XCOMET) are only for inference and not for training in current releases.","severity":"gotcha","affected_versions":">=2.2.0, <2.3.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Ensure each sample dict has 'src' and 'mt' keys.","cause":"Missing required key in input data dict.","error":"KeyError: 'src'"},{"fix":"Check internet connection or set HF_HUB_OFFLINE=1 to use cached models.","cause":"Network issue downloading model from Hugging Face hub.","error":"requests.exceptions.ConnectionError: HTTPConnectionPool"},{"fix":"Use 'from comet import download_model' instead of 'from comet.models import download_model'.","cause":"Incorrect import path.","error":"AttributeError: module 'comet' has no attribute 'download_model'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}