Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: PytorchStreamReader failed locating file constants.pkl: file not found #8192

Closed
kafuka1984 opened this issue Nov 6, 2024 · 1 comment

Comments

@kafuka1984
Copy link

When I try to load the model using the model.pt file provided with the MONAI Model Zoo, I get the following error.
1730858630717


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

@KumoLiu
Copy link
Contributor

KumoLiu commented Nov 6, 2024

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.

@Project-MONAI Project-MONAI locked and limited conversation to collaborators Nov 6, 2024
@KumoLiu KumoLiu converted this issue into discussion #8193 Nov 6, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants