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

monai generative: refactor autoencoderkl #7552

Merged
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
2fc0126
wholeBody_ct_segmentation failed to be download (#7280)
KumoLiu Dec 4, 2023
88f8dd2
update the Python version requirements for transformers (#7275)
KumoLiu Dec 5, 2023
d5585c3
7263 add diffusion loss (#7272)
kvttt Dec 5, 2023
8212458
Fix swinunetrv2 2D bug (#7302)
heyufan1995 Dec 8, 2023
b1c8b42
Fix `RuntimeError` in `DataAnalyzer` (#7310)
KumoLiu Dec 12, 2023
6126a6e
Support specified filenames in `Saveimage` (#7318)
KumoLiu Dec 14, 2023
4c546b3
Fix typo (#7321)
KumoLiu Dec 15, 2023
01a0ee1
fix optimizer pararmeter issue (#7322)
binliunls Dec 15, 2023
90d2acb
Fix `lazy` ignored in `SpatialPadd` (#7316)
KumoLiu Dec 18, 2023
f5327ad
Update openslide-python version (#7344)
KumoLiu Dec 28, 2023
b3d7a48
Upgrade the version of `transformers` (#7343)
KumoLiu Dec 29, 2023
02973f0
Bump github/codeql-action from 2 to 3 (#7354)
dependabot[bot] Jan 2, 2024
38ac573
Bump actions/upload-artifact from 3 to 4 (#7350)
dependabot[bot] Jan 2, 2024
454f89c
Bump actions/setup-python from 4 to 5 (#7351)
dependabot[bot] Jan 2, 2024
db6e81d
Bump actions/download-artifact from 3 to 4 (#7352)
dependabot[bot] Jan 2, 2024
8fa6931
Bump peter-evans/slash-command-dispatch from 3.0.1 to 3.0.2 (#7353)
dependabot[bot] Jan 3, 2024
445d750
Give more useful exception when batch is considered during matrix mul…
KumoLiu Jan 8, 2024
d7137cf
Fix incorrectly size compute in auto3dseg analyzer (#7374)
KumoLiu Jan 9, 2024
e1ffa7e
7380 mention demo in bending energy and diffusion docstrings (#7381)
kvttt Jan 10, 2024
25f1901
Pin gdown version to v4.6.3 (#7384)
KumoLiu Jan 12, 2024
78295c7
Fix Premerge (#7397)
KumoLiu Jan 18, 2024
80be1c3
Track applied operations in image filter (#7395)
vlaminckaxel Jan 18, 2024
facf176
Add `compile` support in `SupervisedTrainer` and `SupervisedEvaluator…
KumoLiu Jan 19, 2024
abe2e31
Fix CUDA_VISIBLE_DEVICES setting ignored (#7408)
KumoLiu Jan 22, 2024
6c9e49e
Fix Incorrect updated affine in `NrrdReader` and update docstring in …
KumoLiu Jan 25, 2024
df4cf92
Ignore E704 after update black (#7422)
KumoLiu Jan 30, 2024
7086b36
Merge branch 'dev' into gen-ai-dev
marksgraham Jan 30, 2024
61a9f73
Merge branch 'gen-ai-dev' of github.com:marksgraham/MONAI into gen-ai…
marksgraham Jan 30, 2024
81d34c6
Merge branch 'dev' into gen-ai-dev
marksgraham Jan 30, 2024
cd36c1c
update `rm -rf /opt/hostedtoolcache` avoid change the python version …
KumoLiu Feb 1, 2024
6def75e
Bump peter-evans/slash-command-dispatch from 3.0.2 to 4.0.0 (#7428)
dependabot[bot] Feb 1, 2024
ec01686
Merge branch 'Project-MONAI:gen-ai-dev' into gen-ai-dev
marksgraham Feb 1, 2024
6ea3e39
Bump peter-evans/create-or-update-comment from 3 to 4 (#7429)
dependabot[bot] Feb 2, 2024
5301443
Bump actions/cache from 3 to 4 (#7430)
dependabot[bot] Feb 2, 2024
aa4f578
Bump codecov/codecov-action from 3 to 4 (#7431)
dependabot[bot] Feb 2, 2024
33afaef
Update tensorboard version to fix deadlock (#7435)
KumoLiu Feb 2, 2024
718e4be
auto updates (#7439)
monai-bot Feb 5, 2024
ec2cc83
Instantiation mode `"partial"` to `"callable"`. Return the `_target_`…
ibro45 Feb 6, 2024
c27cc98
Add support for mlflow experiment name in auto3dseg (#7442)
drbeh Feb 6, 2024
ff43028
Update gdown version (#7448)
KumoLiu Feb 7, 2024
a8080fc
Skip "test_gaussian_filter" as a workaround for blossom killed (#7474)
KumoLiu Feb 20, 2024
50f9aea
auto updates (#7463)
monai-bot Feb 20, 2024
df37a22
Skip "test_resize" as a workaround for blossom killed (#7484)
KumoLiu Feb 21, 2024
1b93988
Fix Python 3.12 import AttributeError (#7482)
KumoLiu Feb 21, 2024
f4103c5
Update test_nnunetv2runner (#7483)
KumoLiu Feb 22, 2024
9c77a04
Fix github resource issue when build latest docker (#7450)
KumoLiu Feb 23, 2024
f6f9e81
Use int16 instead of int8 in `LabelStats` (#7489)
KumoLiu Feb 23, 2024
20512d3
auto updates (#7495)
monai-bot Feb 26, 2024
7cfa2c9
Add sample_std parameter to RandGaussianNoise. (#7492)
bakert1 Feb 26, 2024
9830525
Add __repr__ and __str__ to Metrics baseclass (#7487)
MathijsdeBoer Feb 28, 2024
02c7f53
Bump al-cheb/configure-pagefile-action from 1.3 to 1.4 (#7510)
dependabot[bot] Mar 1, 2024
e9e2738
Add arm support (#7500)
KumoLiu Mar 3, 2024
95f69de
Fix error in "test_bundle_trt_export" (#7524)
KumoLiu Mar 10, 2024
6b7568d
Fix typo in the PerceptualNetworkType Enum (#7548)
SomeUserName1 Mar 15, 2024
3650e45
Attempting to remove _Downsample block
marksgraham Mar 15, 2024
ec63e06
Update to use `log_sigmoid` in `FocalLoss` (#7534)
KumoLiu Mar 18, 2024
4f1306b
Adds missing import, adds temporary tests for loading in existing aut…
marksgraham Mar 20, 2024
de26f1b
Undo accidental changes to num_channels
marksgraham Mar 20, 2024
7e7de37
Adds util for loading old checkpoints, removes downsampling block
marksgraham Mar 21, 2024
35c93fd
Update integration_segmentation_3d result for PyTorch2403 (#7551)
KumoLiu Mar 22, 2024
c649934
Add Barlow Twins loss for representation learning (#7530)
Lucas-rbnt Mar 22, 2024
c3a7383
Stein's Unbiased Risk Estimator (SURE) loss and Conjugate Gradient (#…
cxlcl Mar 22, 2024
c86e790
auto updates (#7577)
monai-bot Mar 25, 2024
90b11ad
Move to new attention block, remove flash attention
marksgraham Mar 25, 2024
1cc52b6
Make use of casting class for interpolation
marksgraham Mar 25, 2024
a2c66dd
Remove xformers import
marksgraham Mar 25, 2024
1fc2645
Stick to existing resblock, cannot move to Monai residualunit due to …
marksgraham Mar 25, 2024
97678fa
Remove nested error propagation on `ConfigComponent` instantiate (#7569)
surajpaib Mar 26, 2024
e5bebfc
2872 implementation of mixup, cutmix and cutout (#7198)
juampatronics Mar 26, 2024
2716b6a
Remove device count cache when import monai (#7581)
KumoLiu Mar 27, 2024
c9fed96
Fixing gradient in sincos positional encoding in monai/networks/block…
Lucas-rbnt Mar 27, 2024
ba3c72c
Fix inconsistent alpha parameter/docs for RandGibbsNoise/RandGibbsNoi…
johnzielke Mar 27, 2024
7c0b10e
Fix bundle_root for NNIGen (#7586)
mingxin-zheng Mar 27, 2024
2d463a7
Auto3DSeg algo_template hash update (#7589)
monai-bot Mar 27, 2024
15d2abf
Utilizing subprocess for nnUNet training. (#7576)
KumoLiu Apr 1, 2024
ec4d946
typo fix (#7595)
scalyvladimir Apr 1, 2024
a7c2589
auto updates (#7599)
monai-bot Apr 1, 2024
c885100
7540 change bundle workflow args (#7549)
yiheng-wang-nv Apr 1, 2024
264b9e4
Add "properties_path" in BundleWorkflow (#7542)
KumoLiu Apr 1, 2024
bbaaf4c
Auto3DSeg algo_template hash update (#7603)
monai-bot Apr 1, 2024
5ec7305
ENH: generate_label_classes_crop_centers: warn only if ratio of missi…
lorinczszabolcs Apr 2, 2024
9085d96
Removes backwards compatibility tests that only run locally
marksgraham Apr 3, 2024
c9f3dc0
DCO Remediation Commit for Mark Graham <[email protected]>
marksgraham Apr 3, 2024
5b6518b
DCO
marksgraham Apr 3, 2024
0dc9bf4
optional imports for einops
marksgraham Apr 3, 2024
12f056e
optional imports for einops
marksgraham Apr 3, 2024
3893070
optional imports for einops
marksgraham Apr 3, 2024
af5b751
optional imports for einops
marksgraham Apr 3, 2024
763347d
Update base image to 2403 (#7600)
KumoLiu Apr 3, 2024
195d7dd
simplification of the sincos positional encoding in patchembedding.py…
Lucas-rbnt Apr 4, 2024
625967c
harmonization and clarification of dice losses variants docs and asso…
Lucas-rbnt Apr 5, 2024
c0b9cc0
Implementation of intensity clipping transform: bot hard and soft app…
Lucas-rbnt Apr 5, 2024
87152d1
Fix typo in `SSIMMetric` (#7612)
KumoLiu Apr 8, 2024
e9a5bfe
auto updates (#7614)
monai-bot Apr 10, 2024
54a6991
Fix test error in `test_soft_clipping_one_sided_high` (#7624)
KumoLiu Apr 11, 2024
3856c45
Fix deprecated warning in ruff (#7625)
KumoLiu Apr 11, 2024
da3ecdd
7601 fix mlflow artifacts (#7604)
binliunls Apr 12, 2024
1268488
Uninstall opencv included in base image (#7626)
KumoLiu Apr 12, 2024
9e2904a
Add checks for num_fold and fail early if wrong (#7634)
mingxin-zheng Apr 12, 2024
0497448
Auto3DSeg algo_template hash update (#7642)
monai-bot Apr 15, 2024
605ffe1
Auto3DSeg algo_template hash update (#7643)
monai-bot Apr 15, 2024
818ed8d
Moves to using inbuilt upsample block
marksgraham Apr 15, 2024
bff4b15
Remove source code of numcodecs in the Dockerfile (#7644)
KumoLiu Apr 15, 2024
d17ac2b
Brings back Downsample block for clarity
marksgraham Apr 15, 2024
16d4e2f
Remove memory_pool_limit in trt config (#7647)
KumoLiu Apr 16, 2024
d6e6b24
Add version requirement for mlflow (#7659)
KumoLiu Apr 19, 2024
ffd4454
Auto3DSeg algo_template hash update (#7674)
monai-bot Apr 19, 2024
224c47a
Fixed four test issues within test code. (#7662)
freddiewanah Apr 19, 2024
7a6b69f
Adapt to use assert raises (#7670)
freddiewanah Apr 19, 2024
03a5fa6
MedicalNetPerceptualSimilarity: Add multi-channel (#7568)
SomeUserName1 Apr 19, 2024
c6bf8e9
Workaround for B909 in flake8-bugbear (#7691)
KumoLiu Apr 22, 2024
a9cee62
Update monai/networks/blocks/upsample.py
marksgraham Apr 22, 2024
37a286f
Update monai/networks/nets/autoencoderkl.py
marksgraham Apr 22, 2024
618da31
Update monai/networks/nets/autoencoderkl.py
marksgraham Apr 22, 2024
178ebc8
Fix AttributeError in 'PerceptualLoss' (#7693)
KumoLiu Apr 22, 2024
46c39dc
Requested changes
marksgraham Apr 22, 2024
a3bc49e
Adds 3d cases
marksgraham Apr 22, 2024
90d96ca
Code formatting
marksgraham Apr 22, 2024
7d3cc2d
Attempted fix for upsampling
marksgraham Apr 22, 2024
2356591
Nice without negation
marksgraham Apr 22, 2024
ac9b186
Always convert input to C-order in distance_transform_edt (#7675)
KumoLiu Apr 23, 2024
a59676f
Auto3DSeg algo_template hash update (#7695)
monai-bot Apr 23, 2024
ec6aa33
Merge similar test components with parameterized (#7663)
freddiewanah Apr 23, 2024
dc58e5c
Add ResNet backbones for FlexibleUNet (#7571)
k-sukharev Apr 23, 2024
45992f8
Merge dev
marksgraham Apr 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions monai/networks/blocks/upsample.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import torch.nn as nn

from monai.networks.layers.factories import Conv, Pad, Pool
from monai.networks.utils import icnr_init, pixelshuffle
from monai.networks.utils import CastTempType, icnr_init, pixelshuffle
from monai.utils import InterpolateMode, UpsampleMode, ensure_tuple_rep, look_up_option

__all__ = ["Upsample", "UpSample", "SubpixelUpsample", "Subpixelupsample", "SubpixelUpSample"]
Expand Down Expand Up @@ -50,6 +50,7 @@ def __init__(
size: tuple[int] | int | None = None,
mode: UpsampleMode | str = UpsampleMode.DECONV,
pre_conv: nn.Module | str | None = "default",
post_conv: nn.Module | None = None,
interp_mode: str = InterpolateMode.LINEAR,
align_corners: bool | None = True,
bias: bool = True,
Expand All @@ -71,6 +72,7 @@ def __init__(
pre_conv: a conv block applied before upsampling. Defaults to "default".
When ``conv_block`` is ``"default"``, one reserved conv layer will be utilized when
Only used in the "nontrainable" or "pixelshuffle" mode.
post_conv: a conv block applied after upsampling. Defaults to None. Only used in the "nontrainable" mode.
interp_mode: {``"nearest"``, ``"linear"``, ``"bilinear"``, ``"bicubic"``, ``"trilinear"``}
Only used in the "nontrainable" mode.
If ends with ``"linear"`` will use ``spatial dims`` to determine the correct interpolation.
Expand Down Expand Up @@ -154,15 +156,21 @@ def __init__(
linear_mode = [InterpolateMode.LINEAR, InterpolateMode.BILINEAR, InterpolateMode.TRILINEAR]
if interp_mode in linear_mode: # choose mode based on dimensions
interp_mode = linear_mode[spatial_dims - 1]

upsample = nn.Upsample(
size=size,
scale_factor=None if size else scale_factor_,
mode=interp_mode.value,
align_corners=align_corners,
)
# Cast to float32 to as 'upsample_nearest2d_out_frame' op does not support bfloat16
marksgraham marked this conversation as resolved.
Show resolved Hide resolved
# https://github.com/pytorch/pytorch/issues/86679. This issue is solved in PyTorch 2.1
marksgraham marked this conversation as resolved.
Show resolved Hide resolved
self.add_module(
"upsample_non_trainable",
nn.Upsample(
size=size,
scale_factor=None if size else scale_factor_,
mode=interp_mode.value,
align_corners=align_corners,
),
CastTempType(initial_type=torch.bfloat16, temporary_type=torch.float32, submodule=upsample),
)
if post_conv:
self.add_module("postconv", post_conv)
elif up_mode == UpsampleMode.PIXELSHUFFLE:
self.add_module(
"pixelshuffle",
Expand Down
2 changes: 1 addition & 1 deletion monai/networks/layers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from .convutils import calculate_out_shape, gaussian_1d, polyval, same_padding, stride_minus_kernel_padding
from .drop_path import DropPath
from .factories import Act, Conv, Dropout, LayerFactory, Norm, Pad, Pool, split_args
from .factories import Act, Conv, Dropout, LayerFactory, Norm, Pad, Pool, RelPosEmbedding, split_args
from .filtering import BilateralFilter, PHLFilter, TrainableBilateralFilter, TrainableJointBilateralFilter
from .gmm import GaussianMixtureModel
from .simplelayers import (
Expand Down
Loading
Loading