Skip to content
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

Merge genaidev Into Dev #7886

Merged
merged 36 commits into from
Jul 19, 2024
Merged

Merge genaidev Into Dev #7886

merged 36 commits into from
Jul 19, 2024

Conversation

ericspod
Copy link
Member

@ericspod ericspod commented Jun 28, 2024

Fixes #6676 .

Description

This merges the Generative Models code into dev. Everything has been checked by the generative team, tests all pass, and the changes that have been done recently are integrated. This is ready to merge.

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

marksgraham and others added 20 commits December 5, 2023 06:55
Partially fixes #6676 


### Description
Implements the AutoencoderKL network from MONAI Generative.

NB this network is subject to a planned refactor once the porting is
complete, [see
here](#7227).

### 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).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [x] New tests added to cover the changes.
- [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.
- [x] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Mark Graham <[email protected]>
Co-authored-by: Eric Kerfoot <[email protected]>
Co-authored-by: YunLiu <[email protected]>
Partially fixes #6676

### Description

Implements the VQ-VAE network, including the vector quantizer block,
from MONAI Generative.

### 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).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [x] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] 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: KumoLiu <[email protected]>
Signed-off-by: Mark Graham <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Co-authored-by: YunLiu <[email protected]>
Co-authored-by: KumoLiu <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Towards #6676  .

### Description

Adds a simple decoder-only transformer architecture. 

### 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).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [x] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [x] In-line docstrings updated.
- [x] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Mark Graham <[email protected]>
Towards #6676  .

### Description

Adds a DDPM unet. 

Refactoring for some of the blocks here is scheduled
[here](#7227).

### 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).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [x] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [x] In-line docstrings updated.
- [x] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Mark Graham <[email protected]>
Co-authored-by: YunLiu <[email protected]>
Part of #6676  .

### Description

Ports the ControlNet.

### 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).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [x] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [x] In-line docstrings updated.
- [x] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Mark Graham <[email protected]>
Part of #6676  .

### Description

Adds a patchgan-style discriminator, both single scale and multiscale.

### 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).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [x] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [x] In-line docstrings updated.
- [x] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Mark Graham <[email protected]>
Co-authored-by: YunLiu <[email protected]>
Towards #6676  .

### Description

This adds SPADE-enabled autoencoder and diffusion_model_unet
architectures. They are new implementations for each network, rather
than options in the existing network, because @virginiafdez and I felt
that adding additional options to the existing networks to enable spade
compatibility significantly reduced the readability of them for users
who were not interested in SPADE functionality.

These are the last networks to be ported over.

### 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).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [x] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [x] In-line docstrings updated.
- [x] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Mark Graham <[email protected]>
Signed-off-by: Mark Graham <[email protected]>
Co-authored-by: YunLiu <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Towards #6676  .

### Description
This adds some base classes for DDPM noise schedulers + three scheduler
types.

### 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).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [x] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [x] In-line docstrings updated.
- [x] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Mark Graham <[email protected]>
This is an update to PR #7332
- I addressed the comments but failed to push the changes before it was
merged! Changes are very minor.

### Description

A few sentences describing the changes proposed in this pull request.

### 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).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Mark Graham <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Towards #6676  .

### Description
This ordering util got missed out my previous PR for the Generative
utils.


### 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).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [x] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [x] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Mark Graham <[email protected]>
Part of #6676  .

### Description

Adds Inferers to assist with training and sampling from diffusion models
and controllers.

Also takes the opportunity to make two changes which slipped through the
previous PRs:
- rename the `num_channels` arg in the spade diffusion unet to
`channels` to be consistent with all the other models added from
Generative - this slipped through in the networks PR.
- add the `Ordering` class to `__init__.py` for easier import

### 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).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [x] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [x] In-line docstrings updated.
- [x] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Mark Graham <[email protected]>
Co-authored-by: YunLiu <[email protected]>
Fixes #7356

### Description

Add relative positinoal embedding in attention block as described in
https://arxiv.org/pdf/2112.01526.pdf
Largely inspired by
https://github.com/facebookresearch/segment-anything/blob/main/segment_anything/modeling/image_encoder.py

Can be useful for #6357

### 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).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [x] In-line docstrings updated.
- [x] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: vgrau98 <[email protected]>
Signed-off-by: vgrau98 <[email protected]>
Co-authored-by: Eric Kerfoot <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: YunLiu <[email protected]>
Part of #6676  .

### Description

A few sentences describing the changes proposed in this pull request.

### 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).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [x] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] 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: Wenqi Li <[email protected]>
Signed-off-by: Mark Graham <[email protected]>
Signed-off-by: dongy <[email protected]>
Signed-off-by: KumoLiu <[email protected]>
Signed-off-by: myron <[email protected]>
Signed-off-by: kaibo <[email protected]>
Signed-off-by: monai-bot <[email protected]>
Signed-off-by: elitap <[email protected]>
Signed-off-by: Felix Schnabel <[email protected]>
Signed-off-by: YanxuanLiu <[email protected]>
Signed-off-by: ytl0623 <[email protected]>
Signed-off-by: Dženan Zukić <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: Ishan Dutta <[email protected]>
Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Mark Graham <[email protected]>
Signed-off-by: vgrau98 <[email protected]>
Signed-off-by: vgrau98 <[email protected]>
Signed-off-by: heyufan1995 <[email protected]>
Signed-off-by: binliu <[email protected]>
Signed-off-by: axel.vlaminck <[email protected]>
Co-authored-by: Wenqi Li <[email protected]>
Co-authored-by: Dong Yang <[email protected]>
Co-authored-by: YunLiu <[email protected]>
Co-authored-by: myron <[email protected]>
Co-authored-by: Kaibo Tang <[email protected]>
Co-authored-by: monai-bot <[email protected]>
Co-authored-by: elitap <[email protected]>
Co-authored-by: Felix Schnabel <[email protected]>
Co-authored-by: YanxuanLiu <[email protected]>
Co-authored-by: ytl0623 <[email protected]>
Co-authored-by: Dženan Zukić <[email protected]>
Co-authored-by: Eric Kerfoot <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ishan Dutta <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: KumoLiu <[email protected]>
Co-authored-by: Kaibo Tang <[email protected]>
Co-authored-by: vgrau98 <[email protected]>
Co-authored-by: Yufan He <[email protected]>
Co-authored-by: binliunls <[email protected]>
Co-authored-by: Ben Murray <[email protected]>
Co-authored-by: axel.vlaminck <[email protected]>
Part of the refactoring in #7227 

### Description
Refactors autoencoderkl. Changes are:

- Introduce `CastToTempType` class for upsampling
- `Downsample` block removed and replaced by a `Sequential`
- The attention block now uses MONAI's `SABlock`, allowing a lot of code
to be removed
- Added a `load_old_state_dict` that allows for models trained on MONAI
Generative to be loaded in to this model, especially important given
some of the MONAI Generative's [model
zoo](https://github.com/Project-MONAI/GenerativeModels/tree/main/model-zoo)
uses this model. I have tested this works locally.

I discussed with @ericspod inheriting from `AutoEncoder` but after
experimentation have decided against it as it introduced changes that
made it very hard to ensure we could load model's trained in MONAI
Generative.

### 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).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [x] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: KumoLiu <[email protected]>
Signed-off-by: kaibo <[email protected]>
Signed-off-by: heyufan1995 <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: binliu <[email protected]>
Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: axel.vlaminck <[email protected]>
Signed-off-by: monai-bot <[email protected]>
Signed-off-by: Ibrahim Hadzic <[email protected]>
Signed-off-by: Behrooz <[email protected]>
Signed-off-by: Timothy Baker <[email protected]>
Signed-off-by: Mathijs de Boer <[email protected]>
Signed-off-by: Fabian Klopfer <[email protected]>
Signed-off-by: Lucas Robinet <[email protected]>
Signed-off-by: Lucas Robinet <[email protected]>
Signed-off-by: chaoliu <[email protected]>
Signed-off-by: cxlcl <[email protected]>
Signed-off-by: chaoliu <[email protected]>
Signed-off-by: Suraj Pai <[email protected]>
Signed-off-by: Juan Pablo de la Cruz Gutiérrez <[email protected]>
Signed-off-by: elitap <[email protected]>
Signed-off-by: Felix Schnabel <[email protected]>
Signed-off-by: YanxuanLiu <[email protected]>
Signed-off-by: ytl0623 <[email protected]>
Signed-off-by: Dženan Zukić <[email protected]>
Signed-off-by: Ishan Dutta <[email protected]>
Signed-off-by: John Zielke <[email protected]>
Signed-off-by: Mingxin Zheng <[email protected]>
Signed-off-by: Vladimir Chernyi <[email protected]>
Signed-off-by: Yiheng Wang <[email protected]>
Signed-off-by: Szabolcs Botond Lorincz Molnar <[email protected]>
Signed-off-by: Mark Graham <[email protected]>
Signed-off-by: Lucas Robinet <[email protected]>
Signed-off-by: Mingxin <[email protected]>
Signed-off-by: Han Wang <[email protected]>
Signed-off-by: Konstantin Sukharev <[email protected]>
Co-authored-by: YunLiu <[email protected]>
Co-authored-by: Kaibo Tang <[email protected]>
Co-authored-by: Yufan He <[email protected]>
Co-authored-by: binliunls <[email protected]>
Co-authored-by: Ben Murray <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Eric Kerfoot <[email protected]>
Co-authored-by: axel.vlaminck <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Mingxin Zheng <[email protected]>
Co-authored-by: monai-bot <[email protected]>
Co-authored-by: Ibrahim Hadzic <[email protected]>
Co-authored-by: Dr. Behrooz Hashemian <[email protected]>
Co-authored-by: Timothy J. Baker <[email protected]>
Co-authored-by: Mathijs de Boer <[email protected]>
Co-authored-by: Mathijs de Boer <[email protected]>
Co-authored-by: Fabian Klopfer <[email protected]>
Co-authored-by: Yiheng Wang <[email protected]>
Co-authored-by: Lucas Robinet <[email protected]>
Co-authored-by: Lucas Robinet <[email protected]>
Co-authored-by: cxlcl <[email protected]>
Co-authored-by: Suraj Pai <[email protected]>
Co-authored-by: Juampa <[email protected]>
Co-authored-by: elitap <[email protected]>
Co-authored-by: Felix Schnabel <[email protected]>
Co-authored-by: YanxuanLiu <[email protected]>
Co-authored-by: ytl0623 <[email protected]>
Co-authored-by: Dženan Zukić <[email protected]>
Co-authored-by: Ishan Dutta <[email protected]>
Co-authored-by: johnzielke <[email protected]>
Co-authored-by: Vladimir Chernyi <[email protected]>
Co-authored-by: Lőrincz-Molnár Szabolcs-Botond <[email protected]>
Co-authored-by: Nic Ma <[email protected]>
Co-authored-by: Lucas Robinet <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Konstantin Sukharev <[email protected]>
Part of #7227  .

### Description

A few sentences describing the changes proposed in this pull request.

### 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).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: KumoLiu <[email protected]>
Signed-off-by: kaibo <[email protected]>
Signed-off-by: heyufan1995 <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: binliu <[email protected]>
Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: axel.vlaminck <[email protected]>
Signed-off-by: monai-bot <[email protected]>
Signed-off-by: Ibrahim Hadzic <[email protected]>
Signed-off-by: Behrooz <[email protected]>
Signed-off-by: Timothy Baker <[email protected]>
Signed-off-by: Mathijs de Boer <[email protected]>
Signed-off-by: Fabian Klopfer <[email protected]>
Signed-off-by: Lucas Robinet <[email protected]>
Signed-off-by: Lucas Robinet <[email protected]>
Signed-off-by: chaoliu <[email protected]>
Signed-off-by: cxlcl <[email protected]>
Signed-off-by: chaoliu <[email protected]>
Signed-off-by: Suraj Pai <[email protected]>
Signed-off-by: Juan Pablo de la Cruz Gutiérrez <[email protected]>
Signed-off-by: elitap <[email protected]>
Signed-off-by: Felix Schnabel <[email protected]>
Signed-off-by: YanxuanLiu <[email protected]>
Signed-off-by: ytl0623 <[email protected]>
Signed-off-by: Dženan Zukić <[email protected]>
Signed-off-by: Ishan Dutta <[email protected]>
Signed-off-by: John Zielke <[email protected]>
Signed-off-by: Mingxin Zheng <[email protected]>
Signed-off-by: Vladimir Chernyi <[email protected]>
Signed-off-by: Yiheng Wang <[email protected]>
Signed-off-by: Szabolcs Botond Lorincz Molnar <[email protected]>
Signed-off-by: Lucas Robinet <[email protected]>
Signed-off-by: Mingxin <[email protected]>
Signed-off-by: Han Wang <[email protected]>
Signed-off-by: Konstantin Sukharev <[email protected]>
Signed-off-by: Ben Murray <[email protected]>
Signed-off-by: Matthew Vine <[email protected]>
Signed-off-by: Mark Graham <[email protected]>
Signed-off-by: Peter Kaplinsky <[email protected]>
Signed-off-by: Simon Jensen <[email protected]>
Signed-off-by: NabJa <[email protected]>
Co-authored-by: YunLiu <[email protected]>
Co-authored-by: Kaibo Tang <[email protected]>
Co-authored-by: Yufan He <[email protected]>
Co-authored-by: binliunls <[email protected]>
Co-authored-by: Ben Murray <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Eric Kerfoot <[email protected]>
Co-authored-by: axel.vlaminck <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Mingxin Zheng <[email protected]>
Co-authored-by: monai-bot <[email protected]>
Co-authored-by: Ibrahim Hadzic <[email protected]>
Co-authored-by: Dr. Behrooz Hashemian <[email protected]>
Co-authored-by: Timothy J. Baker <[email protected]>
Co-authored-by: Mathijs de Boer <[email protected]>
Co-authored-by: Mathijs de Boer <[email protected]>
Co-authored-by: Fabian Klopfer <[email protected]>
Co-authored-by: Yiheng Wang <[email protected]>
Co-authored-by: Lucas Robinet <[email protected]>
Co-authored-by: Lucas Robinet <[email protected]>
Co-authored-by: cxlcl <[email protected]>
Co-authored-by: Suraj Pai <[email protected]>
Co-authored-by: Juampa <[email protected]>
Co-authored-by: elitap <[email protected]>
Co-authored-by: Felix Schnabel <[email protected]>
Co-authored-by: YanxuanLiu <[email protected]>
Co-authored-by: ytl0623 <[email protected]>
Co-authored-by: Dženan Zukić <[email protected]>
Co-authored-by: Ishan Dutta <[email protected]>
Co-authored-by: johnzielke <[email protected]>
Co-authored-by: Vladimir Chernyi <[email protected]>
Co-authored-by: Lőrincz-Molnár Szabolcs-Botond <[email protected]>
Co-authored-by: Nic Ma <[email protected]>
Co-authored-by: Lucas Robinet <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Konstantin Sukharev <[email protected]>
Co-authored-by: Matthew Vine <[email protected]>
Co-authored-by: Pkaps25 <[email protected]>
Co-authored-by: Peter Kaplinsky <[email protected]>
Co-authored-by: Simon Jensen <[email protected]>
Co-authored-by: NabJa <[email protected]>
Part of #7227  .

### Description

A few sentences describing the changes proposed in this pull request.

### 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).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

Signed-off-by: Mark Graham <[email protected]>
Towards #7227  .

### Description
There were lots of contigous calls in the DiffusionModelUnet. It turns
out these are necessary after attention blocks, as the einops operation
sometimes leads to non-contigous tensors that can cause errors. I've
tidied the code up so the .contiguous calls are only after attention
calls.

A few sentences describing the changes proposed in this pull request.

### 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).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Mark Graham <[email protected]>
Co-authored-by: Eric Kerfoot <[email protected]>
Part of #7227  .

### Description
Tidies up some of controlnet

A few sentences describing the changes proposed in this pull request.

### 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).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Mark Graham <[email protected]>
Co-authored-by: YunLiu <[email protected]>
…tion (#7775)

- spade_network, and SPADENet (VAE-GAN)
- test_spade_vaegan (to test previously mentioned model) Modification
of:
- spade_diffusion_model_unet.py to change namings.
- SPADE normalisation layer, to use get_norm_layer function instead of
defining such layers directly.

Fixes # .

### Description

A few sentences describing the changes proposed in this pull request.

### 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).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [x] New tests added to cover the changes.
- [] 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.

---------

Signed-off-by: Mark Graham <[email protected]>
Signed-off-by: virginiafdez <[email protected]>
Co-authored-by: virginiafdez <[email protected]>
Co-authored-by: Mark Graham <[email protected]>
Co-authored-by: YunLiu <[email protected]>
Fixes # .

### Description

Fixes a bug in the inferer and adds clipping parameters to the DDIM/DDPM
schedulers.

### 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).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: virginiafdez <[email protected]>
Co-authored-by: virginiafdez <[email protected]>
@ericspod ericspod changed the title Gen ai dev Merge genaidev Into Dev Jun 28, 2024
### Description

This merges `dev` into `gen-ai-dev` and modifies/fixes some places in
code to remove undeclared variable errors raised by pylint. This should
all be non-breaking and not changing anything functional in this branch.
When completed, the branch should be ready for merging into `dev`.

This also resolves various conflicts which need to be checked for
correctness.

### 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).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: KumoLiu <[email protected]>
Signed-off-by: kaibo <[email protected]>
Signed-off-by: heyufan1995 <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: binliu <[email protected]>
Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: axel.vlaminck <[email protected]>
Signed-off-by: monai-bot <[email protected]>
Signed-off-by: Ibrahim Hadzic <[email protected]>
Signed-off-by: Behrooz <[email protected]>
Signed-off-by: Timothy Baker <[email protected]>
Signed-off-by: Mathijs de Boer <[email protected]>
Signed-off-by: Fabian Klopfer <[email protected]>
Signed-off-by: Lucas Robinet <[email protected]>
Signed-off-by: Lucas Robinet <[email protected]>
Signed-off-by: chaoliu <[email protected]>
Signed-off-by: cxlcl <[email protected]>
Signed-off-by: chaoliu <[email protected]>
Signed-off-by: Suraj Pai <[email protected]>
Signed-off-by: Juan Pablo de la Cruz Gutiérrez <[email protected]>
Signed-off-by: elitap <[email protected]>
Signed-off-by: Felix Schnabel <[email protected]>
Signed-off-by: YanxuanLiu <[email protected]>
Signed-off-by: ytl0623 <[email protected]>
Signed-off-by: Dženan Zukić <[email protected]>
Signed-off-by: Ishan Dutta <[email protected]>
Signed-off-by: John Zielke <[email protected]>
Signed-off-by: Mingxin Zheng <[email protected]>
Signed-off-by: Vladimir Chernyi <[email protected]>
Signed-off-by: Yiheng Wang <[email protected]>
Signed-off-by: Szabolcs Botond Lorincz Molnar <[email protected]>
Signed-off-by: Lucas Robinet <[email protected]>
Signed-off-by: Mingxin <[email protected]>
Signed-off-by: Han Wang <[email protected]>
Signed-off-by: Konstantin Sukharev <[email protected]>
Signed-off-by: Ben Murray <[email protected]>
Signed-off-by: Matthew Vine <[email protected]>
Signed-off-by: Peter Kaplinsky <[email protected]>
Signed-off-by: Simon Jensen <[email protected]>
Signed-off-by: NabJa <[email protected]>
Signed-off-by: Eric Kerfoot <[email protected]>
Co-authored-by: YunLiu <[email protected]>
Co-authored-by: Kaibo Tang <[email protected]>
Co-authored-by: Yufan He <[email protected]>
Co-authored-by: binliunls <[email protected]>
Co-authored-by: Ben Murray <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: axel.vlaminck <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Mingxin Zheng <[email protected]>
Co-authored-by: monai-bot <[email protected]>
Co-authored-by: Ibrahim Hadzic <[email protected]>
Co-authored-by: Dr. Behrooz Hashemian <[email protected]>
Co-authored-by: Timothy J. Baker <[email protected]>
Co-authored-by: Mathijs de Boer <[email protected]>
Co-authored-by: Mathijs de Boer <[email protected]>
Co-authored-by: Fabian Klopfer <[email protected]>
Co-authored-by: Yiheng Wang <[email protected]>
Co-authored-by: Lucas Robinet <[email protected]>
Co-authored-by: Lucas Robinet <[email protected]>
Co-authored-by: cxlcl <[email protected]>
Co-authored-by: Suraj Pai <[email protected]>
Co-authored-by: Juampa <[email protected]>
Co-authored-by: elitap <[email protected]>
Co-authored-by: Felix Schnabel <[email protected]>
Co-authored-by: YanxuanLiu <[email protected]>
Co-authored-by: ytl0623 <[email protected]>
Co-authored-by: Dženan Zukić <[email protected]>
Co-authored-by: Ishan Dutta <[email protected]>
Co-authored-by: johnzielke <[email protected]>
Co-authored-by: Vladimir Chernyi <[email protected]>
Co-authored-by: Lőrincz-Molnár Szabolcs-Botond <[email protected]>
Co-authored-by: Nic Ma <[email protected]>
Co-authored-by: Lucas Robinet <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Konstantin Sukharev <[email protected]>
Co-authored-by: Matthew Vine <[email protected]>
Co-authored-by: Pkaps25 <[email protected]>
Co-authored-by: Peter Kaplinsky <[email protected]>
Co-authored-by: Simon Jensen <[email protected]>
Co-authored-by: NabJa <[email protected]>
Co-authored-by: Yu <[email protected]>
@ericspod ericspod self-assigned this Jul 2, 2024
ericspod added 5 commits July 2, 2024 20:57
Signed-off-by: Eric Kerfoot <[email protected]>
Signed-off-by: Eric Kerfoot <[email protected]>
Signed-off-by: Eric Kerfoot <[email protected]>
Signed-off-by: Eric Kerfoot <[email protected]>
…ply.github.com>

I, Eric Kerfoot <[email protected]>, hereby add my Signed-off-by to this commit: 15ff663

Signed-off-by: Eric Kerfoot <[email protected]>
@ericspod ericspod marked this pull request as ready for review July 2, 2024 21:45
@ericspod
Copy link
Member Author

ericspod commented Jul 2, 2024

I've set DCO to pass again. My email should be configured correctly now. I attempted the remediation commit but that added a second remediation entry for myself instead. The given instructions are perhaps incorrect?

monai/data/utils.py Outdated Show resolved Hide resolved
monai/utils/misc.py Outdated Show resolved Hide resolved
@ericspod
Copy link
Member Author

Hi @KumoLiu I have gone through the PR with @virginiafdez and we're happy with it and all tests pass. A number of changes I did were to do with mypy code checking. The issue is that variables need to always exist in every code path, in many places variables are only assigned in one or another if-elif branch based on conditions that we know to be satisfied eventually. The code checker doesn't know this so the fix is to "declare" the variable first with an initial assignment.

@KumoLiu
Copy link
Contributor

KumoLiu commented Jul 19, 2024

/build

@KumoLiu
Copy link
Contributor

KumoLiu commented Jul 19, 2024

Hi @ericspod @virginiafdez, remaining issue in the blossom ci.
ENV: torch==1.9.1 torchvision==0.10.1 --extra-index-url https://download.pytorch.org/whl/cu111

[2024-07-19T06:09:52.702Z] ======================================================================
[2024-07-19T06:09:52.702Z] ERROR: test_compatibility_with_monai_generative (tests.test_transformer.TestDecoderOnlyTransformer)
[2024-07-19T06:09:52.702Z] ----------------------------------------------------------------------
[2024-07-19T06:09:52.702Z] Traceback (most recent call last):
[2024-07-19T06:09:52.702Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/tests/test_transformer.py", line 105, in test_compatibility_with_monai_generative
[2024-07-19T06:09:52.702Z]     net.load_old_state_dict(torch.load(weight_path), verbose=False)
[2024-07-19T06:09:52.702Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/monai/networks/nets/transformer.py", line 141, in load_old_state_dict
[2024-07-19T06:09:52.702Z]     new_state_dict[f"{block}.attn.qkv.weight"] = torch.concat(
[2024-07-19T06:09:52.702Z] AttributeError: module 'torch' has no attribute 'concat'
[2024-07-19T06:09:52.702Z] 
[2024-07-19T06:09:52.702Z] ----------------------------------------------------------------------

Signed-off-by: Eric Kerfoot <[email protected]>
@ericspod
Copy link
Member Author

Hi @ericspod @virginiafdez, remaining issue in the blossom ci.

This should just be a matter of changing the alias concat to cat.

@KumoLiu
Copy link
Contributor

KumoLiu commented Jul 19, 2024

/build

Signed-off-by: Eric Kerfoot <[email protected]>
@KumoLiu
Copy link
Contributor

KumoLiu commented Jul 19, 2024

/build

@ericspod
Copy link
Member Author

@KumoLiu I think we're good now if you wanted to review anything I've commented on above.

@KumoLiu
Copy link
Contributor

KumoLiu commented Jul 19, 2024

May need @virginiafdez approve to merge the PR.

Copy link
Contributor

@virginiafdez virginiafdez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked all the files with Eric; new additions - which passed the generative-relevant tests, mypy code check issues and some code redundancy in all of the tests.

@virginiafdez
Copy link
Contributor

virginiafdez commented Jul 19, 2024 via email

@KumoLiu KumoLiu merged commit d020fac into dev Jul 19, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Move MONAI Generative into core
5 participants