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

6676 port diffusion schedulers #7332

Merged

Conversation

marksgraham
Copy link
Contributor

Towards #6676 .

Description

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

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.

Signed-off-by: Mark Graham <[email protected]>
Signed-off-by: Mark Graham <[email protected]>
… ensure the output from a sampling run did not change

Signed-off-by: Mark Graham <[email protected]>
Signed-off-by: Mark Graham <[email protected]>
Signed-off-by: Mark Graham <[email protected]>
@marksgraham
Copy link
Contributor Author

I'm getting a mypy error that I'm struggling to fix for the ddim scheduler:

monai/networks/schedulers/ddim.py:219:21: error: No overload variant of "to" of "_TensorBase" matches argument type "object"  [call-overload]
monai/networks/schedulers/ddim.py:219:21: note: Possible overload variants:
monai/networks/schedulers/ddim.py:219:21: note:     def to(self, dtype: dtype, non_blocking: bool = ..., copy: bool = ...) -> Tensor
monai/networks/schedulers/ddim.py:219:21: note:     def to(self, device: Union[device, str, None] = ..., dtype: Optional[dtype] = ..., non_blocking: bool = ..., copy: bool = ...) -> Tensor
monai/networks/schedulers/ddim.py:219:21: note:     def to(self, other: Tensor, non_blocking: bool = ..., copy: bool = ...) -> Tensor

any ideas would be appreciated!

@ericspod
Copy link
Member

any ideas would be appreciated!

Line 218 may have to be device: torch.device = torch.device(model_output.device if torch.is_tensor(model_output) else "cpu")

Signed-off-by: Mark Graham <[email protected]>
monai/networks/schedulers/ddim.py Show resolved Hide resolved
monai/networks/schedulers/ddim.py Show resolved Hide resolved
monai/networks/schedulers/ddpm.py Show resolved Hide resolved
monai/networks/schedulers/ddpm.py Show resolved Hide resolved
@KumoLiu
Copy link
Contributor

KumoLiu commented Jan 3, 2024

/build

@KumoLiu KumoLiu requested a review from Nic-Ma January 3, 2024 02:44
Copy link
Contributor

@KumoLiu KumoLiu left a comment

Choose a reason for hiding this comment

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

Thanks for the update, overall looks good to me.
Do you have any other comments? Otherwise will merge this PR.
cc @ericspod @Nic-Ma

@ericspod
Copy link
Member

ericspod commented Jan 3, 2024

I had a minor question but good to merge this otherwise.

@ericspod ericspod merged commit 3447b09 into Project-MONAI:gen-ai-dev Jan 3, 2024
28 checks passed
@marksgraham marksgraham mentioned this pull request Jan 4, 2024
7 tasks
KumoLiu pushed a commit that referenced this pull request Jan 5, 2024
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>
marksgraham added a commit to marksgraham/MONAI that referenced this pull request Jan 30, 2024
Towards Project-MONAI#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]>
marksgraham added a commit to marksgraham/MONAI that referenced this pull request Jan 30, 2024
This is an update to PR Project-MONAI#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>
Signed-off-by: Mark Graham <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants