-
Notifications
You must be signed in to change notification settings - Fork 74
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
medim_infer.py ERROR in medim.create_model method #92
Comments
I have the same problem, I want to know if you solved it? |
not yet |
If you set |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
creating model SAM-Med3D
try to load pretrained weights from /home/weizheng/models/sam_med3d/sam_med3d.pth
Traceback (most recent call last):
File "/home/weizheng/SAM-Med3D/medim_infer.py", line 280, in
model = medim.create_model("SAM-Med3D",
File "/usr/local/anaconda3/envs/sammed3d/lib/python3.10/site-packages/medim/models/_factory.py", line 22, in create_model
return create_fn(pretrained=pretrained, checkpoint_path=checkpoint_path, **kwargs)
File "/usr/local/anaconda3/envs/sammed3d/lib/python3.10/site-packages/medim/models/sam_med3d.py", line 1257, in build_sam3D_vit_b_ori
load_pretrained_weights(model,
File "/usr/local/anaconda3/envs/sammed3d/lib/python3.10/site-packages/medim/models/_pretrain.py", line 86, in load_pretrained_weights
state_dict = torch.load(f, weights_only=True)
File "/usr/local/anaconda3/envs/sammed3d/lib/python3.10/site-packages/torch/serialization.py", line 1359, in load
raise pickle.UnpicklingError(_get_wo_message(str(e))) from None
_pickle.UnpicklingError: Weights only load failed. This file can still be loaded, to do so you have two options, do those steps only if you trust the source of the checkpoint.
(1) Re-running
torch.load
withweights_only
set toFalse
will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.(2) Alternatively, to load with
weights_only=True
please check the recommended steps in the following error message.WeightsUnpickler error: Unsupported global: GLOBAL argparse.Namespace was not an allowed global by default. Please use
torch.serialization.add_safe_globals([Namespace])
to allowlist this global if you trust this class/function.Hi, when I run this file in either sam_med3d_turbo.pth or sam_med3d.pth, I got this error message in both cases. How to fix this, thanks.
The text was updated successfully, but these errors were encountered: