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

Adding Tailored ControlNet Implementations into Generative Model Application #7875

Merged

Conversation

guopengf
Copy link
Contributor

Fixes #7874.

Description

Integrating a tailored ControlNet model into the generative model application to enable the training using high-dimensional 3D images (up to 512 x 512 x 768).

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.

@guopengf guopengf self-assigned this Jun 24, 2024
@guopengf guopengf force-pushed the fix-issue-7874-add-controlnet branch from 7e2a8b0 to 52428b0 Compare June 25, 2024 22:38
@guopengf guopengf marked this pull request as ready for review June 26, 2024 02:34
@KumoLiu KumoLiu requested review from ericspod and Nic-Ma June 26, 2024 03:15
guopengf and others added 15 commits June 26, 2024 15:14
Signed-off-by: Pengfei Guo <pengfeig@nvidia.com>
for more information, see https://pre-commit.ci

Signed-off-by: Pengfei Guo <pengfeig@nvidia.com>
Signed-off-by: Pengfei Guo <pengfeig@nvidia.com>
…ct-MONAI#7847)

Fixes Project-MONAI#7677 .

### 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).
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.

---------

Signed-off-by: alkamid <adam.klimont@cydar.co.uk>
Co-authored-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
Signed-off-by: Pengfei Guo <pengfeig@nvidia.com>
Signed-off-by: Pengfei Guo <pengfeig@nvidia.com>
Signed-off-by: Pengfei Guo <pengfeig@nvidia.com>
Signed-off-by: Pengfei Guo <pengfeig@nvidia.com>
Signed-off-by: Pengfei Guo <pengfeig@nvidia.com>
Signed-off-by: Pengfei Guo <pengfeig@nvidia.com>
Signed-off-by: Pengfei Guo <pengfeig@nvidia.com>
Signed-off-by: Pengfei Guo <pengfeig@nvidia.com>
Signed-off-by: Pengfei Guo <pengfeig@nvidia.com>
Signed-off-by: Pengfei Guo <pengfeig@nvidia.com>
Co-authored-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
Signed-off-by: Pengfei Guo <32000655+guopengf@users.noreply.github.com>
Signed-off-by: Pengfei Guo <pengfeig@nvidia.com>
Signed-off-by: Pengfei Guo <pengfeig@nvidia.com>
@guopengf guopengf force-pushed the fix-issue-7874-add-controlnet branch from 3afc58d to c342b23 Compare June 26, 2024 19:15
@KumoLiu
Copy link
Contributor

KumoLiu commented Jun 27, 2024

Hi @ericspod @Nic-Ma @mingxin-zheng, if you don't have more comments on this one, I will try to trigger more tests and merge this one. Thanks!

@KumoLiu
Copy link
Contributor

KumoLiu commented Jun 28, 2024

Hi @guopengf, could you please help solve the conflict then I will try to merge this PR, thanks!

Signed-off-by: Pengfei Guo <32000655+guopengf@users.noreply.github.com>
@guopengf
Copy link
Contributor Author

Hi @guopengf, could you please help solve the conflict then I will try to merge this PR, thanks!

Done, thanks!

@KumoLiu
Copy link
Contributor

KumoLiu commented Jun 28, 2024

/build

guopengf added 3 commits June 28, 2024 12:51
Signed-off-by: Pengfei Guo <pengfeig@nvidia.com>
Signed-off-by: Pengfei Guo <pengfeig@nvidia.com>
Signed-off-by: Pengfei Guo <pengfeig@nvidia.com>
Copy link
Member

@ericspod ericspod left a comment

Choose a reason for hiding this comment

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

I'm good here!

@KumoLiu
Copy link
Contributor

KumoLiu commented Jun 29, 2024

/build

Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
@KumoLiu
Copy link
Contributor

KumoLiu commented Jul 1, 2024

/build

Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
@KumoLiu
Copy link
Contributor

KumoLiu commented Jul 1, 2024

/build

@KumoLiu
Copy link
Contributor

KumoLiu commented Jul 1, 2024

Add monai-generative, will cause this error:


[2024-06-29T13:15:38.518Z] ======================================================================

[2024-06-29T13:15:38.518Z] FAIL: test_visible_devices (tests.test_set_visible_devices.TestVisibleDevices)

[2024-06-29T13:15:38.518Z] ----------------------------------------------------------------------

[2024-06-29T13:15:38.518Z] Traceback (most recent call last):

[2024-06-29T13:15:38.518Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/tests/test_set_visible_devices.py", line 38, in test_visible_devices

[2024-06-29T13:15:38.518Z]     self.assertEqual(num_gpus_before, num_gpus_after)

[2024-06-29T13:15:38.518Z] AssertionError: 0 != 1

[2024-06-29T13:15:38.518Z] 

[2024-06-29T13:15:38.518Z] ----------------------------------------------------------------------

Do you have any insights on this one? @ericspod @Nic-Ma @mingxin-zheng

@mingxin-zheng
Copy link
Contributor

Do you have any insights on this one? @ericspod @Nic-Ma @mingxin-zheng

It seems the error is caused by this line:

ControlNet, has_controlnet = optional_import("generative.networks.nets.controlnet", name="ControlNet")

@mingxin-zheng
Copy link
Contributor

mingxin-zheng commented Jul 1, 2024

Update: pinpointed that removing

@torch.cuda.amp.autocast

will solve the issue @KumoLiu

https://github.com/Project-MONAI/GenerativeModels/blob/a9b17d461d42b7b3487d0e29be265d9373b11d67/generative/networks/layers/vector_quantizer.py#L20

Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
@KumoLiu
Copy link
Contributor

KumoLiu commented Jul 1, 2024

/build

Copy link
Contributor

@mingxin-zheng mingxin-zheng left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@mingxin-zheng
Copy link
Contributor

I am merging this to unblock #7861.

@mingxin-zheng mingxin-zheng merged commit 55386e0 into Project-MONAI:dev Jul 1, 2024
28 checks passed
@KumoLiu KumoLiu added this to the Refactor MAISI [P0 v1.4] milestone Aug 19, 2024
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.

Adding Tailored ControlNet Implementations into Generative Model Application
5 participants