Project-MONAI / Project-MONAI/MONAI

Fix seeds per default to global state

Open
#7,546 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
8.7k
Forks
1.6k
Avg merge
5d 1h
Merged PRs (30d)
20

Description

Without calling set_random_state on the monai.transforms.Compose , my trainings with Pytorch Lightning are not reproducable, since the seed of Randomizable.set_random_state per default is None.

To enable reproducible trainings using lightnings seed_everything, I would recommend to use the singleton RandomState instance of numpy instead of None per default here.

But I am curious to hear if this was an intentional choice for monai.

https://github.com/Lightning-AI/pytorch-lightning/issues/19600

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the default handling for Randomizable.set_random_state in monai/utils/misc.py around line 81, then review how Compose uses it. Check the linked MONAI documentation and PyTorch Lightning seed_everything context to understand the reproducibility expectation. Done means the default behavior is intentional and documented or changed with evidence that the training behavior is reproducible.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.