I have a pytorch .ckpt
file and I need to convert this to .bin
file.
I have tried to execute that code in Python 3.10.11:
import torch
# Load the checkpoint file
checkpoint = torch.load("checkpoint.ckpt")
# Extract the model parameters
params = checkpoint["model_state_dict"]
# Save the parameters to a .bin file
torch.save(params, "model.bin")
And I got this error:
File "D:\Model\trial_ckpt converter.py", line 4, in <module>
checkpoint = torch.load("checkpoint.ckpt")
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\serialization.py", line 797, in load
with _open_zipfile_reader(opened_file) as opened_zipfile:
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\serialization.py", line 283, in __init__
super().__init__(torch._C.PyTorchFileReader(name_or_buffer))
RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory
Anyone knows any solution about this?