Allow users to download only the COMET checkpoint without the XLM-R checkpoint from huggingface hub.
Motivation
Currently, all encoders in COMET repo are loaded by XXModel.from_pretrained, which also downloads model weights from huggingface. For end users without the demand to train a custom model, the weights are not needed. Code reference:
🚀 Feature
Allow users to download only the COMET checkpoint without the XLM-R checkpoint from huggingface hub.
Motivation
Currently, all encoders in COMET repo are loaded by
XXModel.from_pretrained
, which also downloads model weights from huggingface. For end users without the demand to train a custom model, the weights are not needed. Code reference:https://github.com/Unbabel/COMET/blob/9a84de1e7efc9966822ad786f86c3b5514cf824d/comet/encoders/xlmr.py#L35-L41
The code can be refactored with
XXConfig.from_pretrained
like:This avoids downloading unnecessary weights and only keeps the important config file.
Alternatives
A better approach for ease of use is to export the whole model to ONNX format, but requires much more effort.
Additional context
No