Open ZhengWei0918 opened 1 week ago
I have the same problem, I want to know if you solved it?
I have the same problem, I want to know if you solved it?
not yet
If you set weights_only=False
, it seems to work successfully, although a warning may appear.
If you set
weights_only=False
, it seems to work successfully, although a warning may appear.
Thanks, your solution works. But the result of medim_infer.py looks very strange:
the highlighted one is the gt, while the other one is the predicted one, have you ever gotten the similar result? (I'm using sam_med3d_turbo.pth offline)
If you set
weights_only=False
, it seems to work successfully, although a warning may appear.Thanks, your solution works. But the result of medim_infer.py looks very strange:
the highlighted one is the gt, while the other one is the predicted one, have you ever gotten the similar result? (I'm using sam_med3d_turbo.pth offline)
It may be that my segmentation objects are not the same as yours, so I don't have the same situation, but I also don't get good segmentation results on my task by sam_med3d_turbo.pth.
If you set
weights_only=False
, it seems to work successfully, although a warning may appear.Thanks, your solution works. But the result of medim_infer.py looks very strange: the highlighted one is the gt, while the other one is the predicted one, have you ever gotten the similar result? (I'm using sam_med3d_turbo.pth offline)
It may be that my segmentation objects are not the same as yours, so I don't have the same situation, but I also don't get good segmentation results on my task by sam_med3d_turbo.pth.
ok, maybe I'd like to look for and try other models then..
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 withweights_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 usetorch.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.