You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes#8448
### Description
Classifier-free guidance scale can be used in the sampling methods of
diffusion models to strengthen the conditioning. It's been used in one
of the generative MONAI tutorials, but the actual Inferers
(DiffusionInferer, and ControlNetDiffusionInferer) do not support this
feature. This means that, whenever users want to use CFG, they have to
either copy the Inferer object or write their own sampling method.
This PR incorporates classifier-free guidance into the inferer objects
by modifying their sampling method and adding an argument cfg to the
sampling method to control this.
This should not change the default behaviour (cfg=None), although some
rewriting has been necessary.
### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [x] New tests added to cover the changes (to
test_controlnet_inferers.py, test_diffusion_inferer.py and
test_latent_diffusion_inferer.py).
- [x] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [x] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [x] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.
---------
Signed-off-by: Virginia Fernandez <[email protected]>
Co-authored-by: Virginia Fernandez <[email protected]>
Co-authored-by: Eric Kerfoot <[email protected]>
Co-authored-by: YunLiu <[email protected]>
Co-authored-by: Virginia Fernandez <virginia.fernandez.kcl.ac.uk>
0 commit comments