-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Optional Torch Multiprocessing in nnUNet for Improved Security and Compatibility #2614
base: master
Are you sure you want to change the base?
Conversation
New environment variables: - nnUNet_npp - nnUNet_nps Default values remain unchanged, cli parameter -npp and -nps overwrite environment variables if set.
@FabianIsensee I have noticed some (significant) differences between |
Hey, thanks for the PR and sorry for being slow. I have too much on my plate. Can you please provide more information on the inconsistency in performance? What is the difference between the runs? This doesn't become quite clear from your message |
Hey @FabianIsensee thanks for the reply and no worries!
Good point! @surajpaib Looks like we can combine it to output each item right after preprocessing.
I ran some tests (with this submission model). All MHub models come with test and reference data, so I manually updated the version from |
Is there a way I can reproduce this locally to investigate? Like can you share both checkpoints + the reference data that gives Dice=1 in one case and 0.94 in the other? That way I can track down where things diverge |
Thank you @FabianIsensee for looking into this. You can use the BAMF NNUnet Lung and Nodules V2 (MHubAI/models#92) model for testing.
You can also build and run the model via MHub in a self-contained environment by following these steps below: $LOCAL_NNUNET_PATCH_DIR=/absolute/path/to/loacal/nnunet/patch
# build the model container
docker build \
-t mhubai-nnunet-test/bamf_nnunet_ct_lungnodules:latest \
--build-arg MHUB_MODELS_REPO=https://github.com/bamf-health/mhub-models.git::bamf_nnunet_ct_lung_v2 \
https://github.com/bamf-health/mhub-models.git#bamf_nnunet_ct_lung_v2:models/bamf_nnunet_ct_lungnodules/dockerfiles
# run the model container
docker run --rm -it --entrypoint bash --gpus all -v $LOCAL_NNUNET_PATCH_DIR:/nnunet-src mhubai-test/bamf_nnunet_ct_lungnodules:latest
# install nnunet in the container
uv pip install -e /nnunet-src
# update NNUnetRunnerV2 Module
sed -i 's/bash_command += \["-c", self.nnunet_config\]/bash_command += \["-c", self.nnunet_config, "-npp", "0", "-nps", "0"\]/' /app/models/bamf_nnunet_ct_lungnodules/utils/NNUnetRunnerV2.py
# run mhub test
mhub.test srmteyvx Let me know if you need anything else or if I can assist you in any way! |
Hey, thanks for sharing. I will try to find time this week to look into this. Since I will be running this locally (no docker): All I need to do is run the prediction on the provided reference sample with both versions and compare? |
Hi @FabianIsensee, thank you!
Correct! I'm curios what you will find. Let me know if there is anything I can help with! |
Hey so I looked into this. Yes the segmentations generated by the two versions diifer. Here are the predictions I generated: |
This PR resolves #2556.
-npp
and-nps
We have done some internal testing and get identical results between the latest
nnunetv2==2.5.1
and with our proposed patch.