RuntimeError: PytorchStreamReader failed locating file constants.pkl: file not found #8193
Closed
kafuka1984
started this conversation in
General
Replies: 1 comment 1 reply
-
Hi @kafuka1984, It looks like you might want to load model.ts instead of model.pt. The torch.jit.load function is specifically designed to load TorchScript models, whereas model.pt is not serialized using TorchScript. Hope it helps, move it to discussion for now. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When I try to load the model using the model.pt file provided with the MONAI Model Zoo, I get the following error.
net = torch.jit.load(env_dict["model_path"]).to(device)
File "/database/home/tangchi/.conda/envs/medsam/lib/python3.10/site-packages/torch/jit/_serialization.py", line 163, in load
cpp_module = torch._C.import_ir_module(cu, os.fspath(f), map_location, _extra_files, _restore_shapes) # type: ignore[call-arg]
RuntimeError: PytorchStreamReader failed locating file constants.pkl: file not found
config:
MONAI version: 1.3.2
Numpy version: 1.26.3
Pytorch version: 2.4.0+cu118
MONAI flags: HAS_EXT = False, USE_COMPILED = False, USE_META_DICT = False
MONAI rev id: 59a7211
MONAI file: /database/home//.local/lib/python3.10/site-packages/monai/init.py
Optional dependencies:
Pytorch Ignite version: 0.4.11
ITK version: 5.4.0
Nibabel version: 5.2.0
scikit-image version: 0.23.1
scipy version: 1.14.0
Pillow version: 10.2.0
Tensorboard version: 2.17.1
gdown version: 5.2.0
TorchVision version: 0.19.0+cu118
tqdm version: 4.66.4
lmdb version: 1.5.1
psutil version: 5.9.6
pandas version: 2.2.2
einops version: 0.8.0
transformers version: 4.40.2
mlflow version: 2.15.1
pynrrd version: 1.0.0
clearml version: 1.16.4
Beta Was this translation helpful? Give feedback.
All reactions