Hi,
I am unable to use the Dental Segmentator module. I am using slicer 5.8, Pytorch version is 2.6.0 + cu118. I have tried manually downloading the weights and adding it to the Recources/ML folder. However, I am still getting the following error in the log:
2025/01/30 09:50:19.665 :: nnUNet is already installed (2.5.1) and compatible with requested version (nnunetv2).
2025/01/30 09:50:24.325 :: Transferring volume to nnUNet in C:/Users//AppData/Local/Temp/2/Slicer-OCVZwp
2025/01/30 09:50:30.096 :: Starting nnUNet with the following parameters:
2025/01/30 09:50:30.096 ::
2025/01/30 09:50:30.096 :: C:\Users\Slicer 5.8.0\lib\Python\Scripts\nnUNetv2_predict.exe -i C:/Users//AppData/Local/Temp/2/Slicer-OCVZwp/input -o C:/Users//AppData/Local/Temp/2/Slicer-OCVZwp/output -d Dataset111_453CT -tr nnUNetTrainer -p nnUNetPlans -c 3d_fullres -f 0 -npp 1 -nps 1 -step_size 0.5 -device cuda -chk checkpoint_final.pth --disable_tta
2025/01/30 09:50:30.096 ::
2025/01/30 09:50:30.096 :: JSON parameters :
2025/01/30 09:50:30.096 :: {
2025/01/30 09:50:30.096 :: “folds”: “0”,
2025/01/30 09:50:30.096 :: “device”: “cuda”,
2025/01/30 09:50:30.096 :: “stepSize”: 0.5,
2025/01/30 09:50:30.096 :: “disableTta”: true,
2025/01/30 09:50:30.096 :: “nProcessPreprocessing”: 1,
2025/01/30 09:50:30.096 :: “nProcessSegmentationExport”: 1,
2025/01/30 09:50:30.096 :: “checkPointName”: “”,
2025/01/30 09:50:30.096 :: “modelPath”: {
2025/01/30 09:50:30.096 :: “_path”: “C:\Users\Slicer 5.8.0\slicer.org\Extensions-33216\DentalSegmentator\lib\Slicer-5.8\qt-scripted-modules\Resources\ML”
2025/01/30 09:50:30.096 :: }
2025/01/30 09:50:30.096 :: }
2025/01/30 09:50:30.137 :: nnUNet preprocessing…
2025/01/30 09:50:33.686 :: Traceback (most recent call last):
2025/01/30 09:50:33.686 :: File “C:\Users\Slicer 5.8.0\lib\Python\Lib\runpy.py”, line 197, in _run_module_as_main
2025/01/30 09:50:33.781 :: return run_code(code, main_globals, None,
2025/01/30 09:50:33.781 :: File “C:\Users\Slicer 5.8.0\lib\Python\Lib\runpy.py”, line 87, in run_code
2025/01/30 09:50:33.781 :: exec(code, run_globals)
2025/01/30 09:50:33.781 :: File "C:\Users\Slicer 5.8.0\lib\Python\Scripts\nnUNetv2_predict.exe_main.py", line 7, in
2025/01/30 09:50:33.781 :: File “C:\Users\Slicer 5.8.0\lib\Python\Lib\site-packages\nnunetv2\inference\predict_from_raw_data.py”, line 861, in predict_entry_point
2025/01/30 09:50:33.781 :: predictor.initialize_from_trained_model_folder(
2025/01/30 09:50:33.781 :: File “C:\Users\Slicer 5.8.0\lib\Python\Lib\site-packages\nnunetv2\inference\predict_from_raw_data.py”, line 84, in initialize_from_trained_model_folder
2025/01/30 09:50:33.781 :: checkpoint = torch.load(join(model_training_output_dir, f’fold{f}', checkpoint_name),
2025/01/30 09:50:33.781 :: File “C:\Users\Slicer 5.8.0\lib\Python\Lib\site-packages\torch\serialization.py”, line 1470, in load
2025/01/30 09:50:33.781 :: raise pickle.UnpicklingError(_get_wo_message(str(e))) from None
2025/01/30 09:50:33.781 :: _pickle.UnpicklingError: Weights only load failed. This file can still be loaded, to do so you have two options, e[1mdo those steps only if you trust the source of the checkpointe[0m.
2025/01/30 09:50:33.781 :: (1) In PyTorch 2.6, we changed the default value of the weights_only
argument in torch.load
from False
to True
. Re-running torch.load
with weights_only
set to False
will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.
2025/01/30 09:50:33.781 :: (2) Alternatively, to load with weights_only=True
please check the recommended steps in the following error message.
2025/01/30 09:50:33.781 :: WeightsUnpickler error: Unsupported global: GLOBAL numpy.core.multiarray.scalar was not an allowed global by default. Please use torch.serialization.add_safe_globals([scalar])
or the torch.serialization.safe_globals([scalar])
context manager to allowlist this global if you trust this class/function.
2025/01/30 09:50:33.781 ::
2025/01/30 09:50:33.781 :: Check the documentation of torch.load to learn more about types accepted by default with weights_only torch.load — PyTorch 2.6 documentation.
2025/01/30 09:50:33.781 ::
2025/01/30 09:50:33.781 :: #######################################################################
2025/01/30 09:50:33.781 :: Please cite the following paper when using nnU-Net:
2025/01/30 09:50:33.781 :: Isensee, F., Jaeger, P. F., Kohl, S. A., Petersen, J., & Maier-Hein, K. H. (2021). nnU-Net: a self-configuring method for deep learning-based biomedical image segmentation. Nature methods, 18(2), 203-211.
2025/01/30 09:50:33.781 :: #######################################################################
2025/01/30 09:50:34.073 :: Loading inference results…
2025/01/30 09:50:36.366 :: Error loading results :
2025/01/30 09:50:36.366 :: Failed to load the segmentation.
2025/01/30 09:50:36.366 :: Something went wrong during the nnUNet processing.
2025/01/30 09:50:36.366 :: Please check the logs for potential errors and contact the library maintainers."
Could someone please look into the issue and recommend some possible workarounds?