Unbabel / COMET

A Neural Framework for MT Evaluation
https://unbabel.github.io/COMET/html/index.html
Apache License 2.0
441 stars 72 forks source link

When loading huggingface Unbabel/wmt22-cometkiwi-da checkpoint, UnpicklingError #188

Closed efsotr closed 7 months ago

efsotr commented 7 months ago

UnpicklingError Traceback (most recent call last)

1 import torch ----> 3 a = torch.load("wmt22-cometkiwi-da/checkpoints/model.ckpt", map_location=torch.device("cpu"))

File ~/anaconda3/envs/AMCT/lib/python3.9/site-packages/torch/serialization.py:1028, in load(f, map_location, pickle_module, weights_only, mmap, pickle_load_args) 1026 except RuntimeError as e: 1027 raise pickle.UnpicklingError(UNSAFE_MESSAGE + str(e)) from None -> 1028 return _legacy_load(opened_file, map_location, pickle_module, pickle_load_args)

File ~/anaconda3/envs/AMCT/lib/python3.9/site-packages/torch/serialization.py:1246, in _legacy_load(f, map_location, pickle_module, pickle_load_args) 1240 if not hasattr(f, 'readinto') and (3, 8, 0) <= sys.version_info < (3, 8, 2): 1241 raise RuntimeError( 1242 "torch.load does not work with file-like objects that do not implement readinto on Python 3.8.0 and 3.8.1. " 1243 f"Received object of type "{type(f)}". Please update to Python 3.8.2 or newer to restore this " 1244 "functionality.") -> 1246 magic_number = pickle_module.load(f, pickle_load_args) 1247 if magic_number != MAGIC_NUMBER: 1248 raise RuntimeError("Invalid magic number; corrupt file?")

UnpicklingError: invalid load key, 'v'.