-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add support for optional conditioning in PatchInferer, SliceInferer, and SlidingWindowInferer #8400
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
base: dev
Are you sure you want to change the base?
Conversation
53345d1
to
c4c65ae
Compare
I, FinnBehrendt <[email protected]>, hereby add my Signed-off-by to this commit: 248d3c3 I, FinnBehrendt <[email protected]>, hereby add my Signed-off-by to this commit: c4c65ae Signed-off-by: FinnBehrendt <[email protected]>
I, FinnBehrendt <[email protected]>, hereby add my Signed-off-by to this commit: dbb856a I, FinnBehrendt <[email protected]>, hereby add my Signed-off-by to this commit: 3c63c1d Signed-off-by: FinnBehrendt <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR looks good to me overall, with appropriate tests that pass. Not sure if it'll be better to derive the condition from an argument defaulted to None instead of kwargs, to be more transparent. If leaving to kwargs, I believe there should still be some mention on the dosctrings that it is possible to pass a "condition". Not sure about this either, but If the shape of both input and output have to match, then checking for this at the beginning of the inferer sampler would be good (+test).
Signed-off-by: FinnBehrendt <[email protected]>
Signed-off-by: FinnBehrendt <[email protected]>
Thanks a lot for the suggestions! I just pushed the updated changes. |
Fixes #8220
Description
This PR adds support for optional conditioning in MONAI’s inferers, allowing models to receive auxiliary inputs for conditioning that are processed (patched, sliced) the same way as the inputs. This is particularly relevant for generative models like conditional GANs or DMs.
Example Usage:
Types of changes
PatchInferer
,SliceInferer
, andSlidingWindowInferer
to optionally accept acondition
tensor (passed as a kwarg).condition
can now be:None
(default)inputs
./runtests.sh -f -u --net --coverage
../runtests.sh --quick --unittests --disttests
.make html
command in thedocs/
folder.Additional extensions such as support for dense vector conditioning (e.g., (1, C, Z), with Z being the conditional dimension) could be explored in a follow-up PR if there’s interest.