Project-MONAI / Project-MONAI/MONAI

data analyzer set_grad_enabled

Open
#5,889 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug
the torch.set_grad_enabled(False) in the data analyzer may disable the pytorch autograd completely, and reenable it later:

https://github.com/Project-MONAI/MONAI/blob/ae7f86ef187e1de7a32ca3e8589511a180f76e89/monai/auto3dseg/analyzer.py#L240
https://github.com/Project-MONAI/MONAI/blob/ae7f86ef187e1de7a32ca3e8589511a180f76e89/monai/auto3dseg/analyzer.py#L266

for the unit test cases, if the program exits somewhere between these two commands, it may leave the autograd 'off' and break the other test cases.

I think the relevant test cases should be improved so that any failure of this module wouldn't change the system's pytorch config.

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 with monai/auto3dseg/analyzer.py at the referenced lines around the two torch.set_grad_enabled calls, then locate the analyzer unit tests. Check how failures between those calls affect PyTorch autograd state. Done means the tests verify that a failure in this module does not leave the surrounding PyTorch configuration changed.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.