monai-weekly 1.5.dev2519__py3-none-any.whl → 1.5.dev2520__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- monai/__init__.py +1 -1
- monai/_version.py +3 -3
- monai/bundle/scripts.py +0 -2
- monai/networks/nets/autoencoderkl.py +8 -8
- monai/visualize/occlusion_sensitivity.py +1 -1
- {monai_weekly-1.5.dev2519.dist-info → monai_weekly-1.5.dev2520.dist-info}/METADATA +1 -1
- {monai_weekly-1.5.dev2519.dist-info → monai_weekly-1.5.dev2520.dist-info}/RECORD +11 -11
- {monai_weekly-1.5.dev2519.dist-info → monai_weekly-1.5.dev2520.dist-info}/WHEEL +1 -1
- tests/bundle/test_bundle_download.py +3 -16
- {monai_weekly-1.5.dev2519.dist-info → monai_weekly-1.5.dev2520.dist-info}/licenses/LICENSE +0 -0
- {monai_weekly-1.5.dev2519.dist-info → monai_weekly-1.5.dev2520.dist-info}/top_level.txt +0 -0
monai/__init__.py
CHANGED
monai/_version.py
CHANGED
@@ -8,11 +8,11 @@ import json
|
|
8
8
|
|
9
9
|
version_json = '''
|
10
10
|
{
|
11
|
-
"date": "2025-05-
|
11
|
+
"date": "2025-05-18T02:35:03+0000",
|
12
12
|
"dirty": false,
|
13
13
|
"error": null,
|
14
|
-
"full-revisionid": "
|
15
|
-
"version": "1.5.
|
14
|
+
"full-revisionid": "cc43efa2f524c91686c29a51b04e31e47206dec8",
|
15
|
+
"version": "1.5.dev2520"
|
16
16
|
}
|
17
17
|
''' # END VERSION_JSON
|
18
18
|
|
monai/bundle/scripts.py
CHANGED
@@ -702,8 +702,6 @@ def load(
|
|
702
702
|
3. If `load_ts_module` is `True`, return a triple that include a TorchScript module,
|
703
703
|
the corresponding metadata dict, and extra files dict.
|
704
704
|
please check `monai.data.load_net_with_metadata` for more details.
|
705
|
-
4. If `return_state_dict` is True, return model weights, only used for compatibility
|
706
|
-
when `model` and `net_name` are all `None`.
|
707
705
|
|
708
706
|
"""
|
709
707
|
bundle_dir_ = _process_bundle_dir(bundle_dir)
|
@@ -153,9 +153,9 @@ class Encoder(nn.Module):
|
|
153
153
|
channels: sequence of block output channels.
|
154
154
|
out_channels: number of channels in the bottom layer (latent space) of the autoencoder.
|
155
155
|
num_res_blocks: number of residual blocks (see _ResBlock) per level.
|
156
|
-
norm_num_groups: number of groups for the GroupNorm layers,
|
156
|
+
norm_num_groups: number of groups for the GroupNorm layers, channels must be divisible by this number.
|
157
157
|
norm_eps: epsilon for the normalization.
|
158
|
-
attention_levels: indicate which level from
|
158
|
+
attention_levels: indicate which level from channels contain an attention block.
|
159
159
|
with_nonlocal_attn: if True use non-local attention block.
|
160
160
|
include_fc: whether to include the final linear layer. Default to True.
|
161
161
|
use_combined_linear: whether to use a single linear layer for qkv projection, default to False.
|
@@ -299,9 +299,9 @@ class Decoder(nn.Module):
|
|
299
299
|
in_channels: number of channels in the bottom layer (latent space) of the autoencoder.
|
300
300
|
out_channels: number of output channels.
|
301
301
|
num_res_blocks: number of residual blocks (see _ResBlock) per level.
|
302
|
-
norm_num_groups: number of groups for the GroupNorm layers,
|
302
|
+
norm_num_groups: number of groups for the GroupNorm layers, channels must be divisible by this number.
|
303
303
|
norm_eps: epsilon for the normalization.
|
304
|
-
attention_levels: indicate which level from
|
304
|
+
attention_levels: indicate which level from channels contain an attention block.
|
305
305
|
with_nonlocal_attn: if True use non-local attention block.
|
306
306
|
use_convtranspose: if True, use ConvTranspose to upsample feature maps in decoder.
|
307
307
|
include_fc: whether to include the final linear layer. Default to True.
|
@@ -483,7 +483,7 @@ class AutoencoderKL(nn.Module):
|
|
483
483
|
channels: number of output channels for each block.
|
484
484
|
attention_levels: sequence of levels to add attention.
|
485
485
|
latent_channels: latent embedding dimension.
|
486
|
-
norm_num_groups: number of groups for the GroupNorm layers,
|
486
|
+
norm_num_groups: number of groups for the GroupNorm layers, channels must be divisible by this number.
|
487
487
|
norm_eps: epsilon for the normalization.
|
488
488
|
with_encoder_nonlocal_attn: if True use non-local attention block in the encoder.
|
489
489
|
with_decoder_nonlocal_attn: if True use non-local attention block in the decoder.
|
@@ -518,10 +518,10 @@ class AutoencoderKL(nn.Module):
|
|
518
518
|
|
519
519
|
# All number of channels should be multiple of num_groups
|
520
520
|
if any((out_channel % norm_num_groups) != 0 for out_channel in channels):
|
521
|
-
raise ValueError("AutoencoderKL expects all
|
521
|
+
raise ValueError("AutoencoderKL expects all channels being multiple of norm_num_groups")
|
522
522
|
|
523
523
|
if len(channels) != len(attention_levels):
|
524
|
-
raise ValueError("AutoencoderKL expects
|
524
|
+
raise ValueError("AutoencoderKL expects channels being same size of attention_levels")
|
525
525
|
|
526
526
|
if isinstance(num_res_blocks, int):
|
527
527
|
num_res_blocks = ensure_tuple_rep(num_res_blocks, len(channels))
|
@@ -529,7 +529,7 @@ class AutoencoderKL(nn.Module):
|
|
529
529
|
if len(num_res_blocks) != len(channels):
|
530
530
|
raise ValueError(
|
531
531
|
"`num_res_blocks` should be a single integer or a tuple of integers with the same length as "
|
532
|
-
"`
|
532
|
+
"`channels`."
|
533
533
|
)
|
534
534
|
|
535
535
|
self.encoder: nn.Module = Encoder(
|
@@ -1,5 +1,5 @@
|
|
1
|
-
monai/__init__.py,sha256=
|
2
|
-
monai/_version.py,sha256=
|
1
|
+
monai/__init__.py,sha256=kZDFttD2rvFD_euw09ICobt_wX4jw1k0qDTs3kCJyDE,4095
|
2
|
+
monai/_version.py,sha256=sWFMjgtn66w242ewwqrmMrt1OTynXCSfg5N75J91qqc,503
|
3
3
|
monai/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
monai/_extensions/__init__.py,sha256=NEBPreRhQ8H9gVvgrLr_y52_TmqB96u_u4VQmeNT93I,642
|
5
5
|
monai/_extensions/loader.py,sha256=7SiKw36q-nOzH8CRbBurFrz7GM40GCu7rc93Tm8XpnI,3643
|
@@ -115,7 +115,7 @@ monai/bundle/config_item.py,sha256=rMjXSGkjJZdi04BwSHwCcIwzIb_TflmC3xDhC3SVJRs,1
|
|
115
115
|
monai/bundle/config_parser.py,sha256=cGyEn-cqNk0rEEZ1Qiv6UydmIDvtWZcMVljyfVm5i50,23025
|
116
116
|
monai/bundle/properties.py,sha256=iN3K4FVmN9ny1Hw9p5j7_ULcCdSD8PmrR7qXxbNz49k,11582
|
117
117
|
monai/bundle/reference_resolver.py,sha256=GXCMK4iogxxE6VocsmAbUrcXosmC5arnjeG9zYhHKpg,16748
|
118
|
-
monai/bundle/scripts.py,sha256=
|
118
|
+
monai/bundle/scripts.py,sha256=ZFNlQf2R2XOyRnZciuxsYlx_-GKmVQvnnOGKbL16OPM,89560
|
119
119
|
monai/bundle/utils.py,sha256=t-22uFvLn7Yy-dr1v1U33peNOxgAmU4TJiGAbsBrUKs,10108
|
120
120
|
monai/bundle/workflows.py,sha256=6OUyC0a_hsG5yGe-uVvFNeHzjf4W86NHu-XNGuNkdZo,33179
|
121
121
|
monai/config/__init__.py,sha256=CN28CfTdsp301gv8YXfVvkbztCfbAqrLKrJi_C8oP9s,1048
|
@@ -298,7 +298,7 @@ monai/networks/nets/__init__.py,sha256=QS_r_mjmymo3YX6DnWftREug1zVRUV56b2xjj5rvW
|
|
298
298
|
monai/networks/nets/ahnet.py,sha256=RT-loCa5Z_3I2DWB8lmRkhxGXSsnMVBCEDpwo68-YB4,21570
|
299
299
|
monai/networks/nets/attentionunet.py,sha256=lqsrzpy0sRuuFjAtKUUJ0hT3lGF9skpepWXLG0JBo-k,9427
|
300
300
|
monai/networks/nets/autoencoder.py,sha256=QuLdDfDwhefIqA2n8XfmFyi5T8enP6O4PETdBKmFMKc,12586
|
301
|
-
monai/networks/nets/autoencoderkl.py,sha256=
|
301
|
+
monai/networks/nets/autoencoderkl.py,sha256=FWOMTdbRNPeJVxgEF6Kq5lbiazrTwSzSw_jpghF-lqg,28566
|
302
302
|
monai/networks/nets/basic_unet.py,sha256=K76Q-WXuCPGNf8X9qa1wwtiv1gzwlERrL6BKqKcpzlQ,10951
|
303
303
|
monai/networks/nets/basic_unetplusplus.py,sha256=M2sSCgWvqgpiRq1tpR164udnbN1WkO1a81PmgCfV5lU,7961
|
304
304
|
monai/networks/nets/cell_sam_wrapper.py,sha256=88bzdzzw_1_wncYdxt2EAtUN7c0EPdzNaLp1lW1I__s,3326
|
@@ -423,10 +423,10 @@ monai/visualize/__init__.py,sha256=p7dv9-hRa9vAhlpHyk86yap9HgeDeJRO3pXmFhDx8Mc,1
|
|
423
423
|
monai/visualize/class_activation_maps.py,sha256=w4BpnriGPBtspqjICrwakvxeWkhK2E05fTbqfzlmPFE,16122
|
424
424
|
monai/visualize/gradient_based.py,sha256=oXqMxqIClVlrgloZwgdTUl4pWllsoS0ysbjuvAbu-Kg,6278
|
425
425
|
monai/visualize/img2tensorboard.py,sha256=n4ztSa5BQAUxSTGvi2tp45v-F7-RNgSlbsdy-9YGL78,9228
|
426
|
-
monai/visualize/occlusion_sensitivity.py,sha256=
|
426
|
+
monai/visualize/occlusion_sensitivity.py,sha256=0SwhLO7ePDfIXJj67_UmXDZLxXItMeM-uNrPaCE0xXg,18159
|
427
427
|
monai/visualize/utils.py,sha256=B-MhTVs7sQbIqYS3yPnpBwPw2K82rE2PBtGIfpwZtWM,9894
|
428
428
|
monai/visualize/visualizer.py,sha256=qckyaMZCbezYUwE20k5yc-Pb7UozVavMDbrmyQwfYHY,1377
|
429
|
-
monai_weekly-1.5.
|
429
|
+
monai_weekly-1.5.dev2520.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
430
430
|
tests/apps/__init__.py,sha256=s9djSd6kvViPnFvMR11Dgd30Lv4oY6FaPJr4ZZJZLq0,573
|
431
431
|
tests/apps/test_auto3dseg_bundlegen.py,sha256=FpTJo9Lfe8vdhGuWeZ9y1BQmqYwTt-s8mDVtoLGAz_I,5594
|
432
432
|
tests/apps/test_check_hash.py,sha256=MuZslW2DDCxHKEo6-PiL7hnbxGuZRRYf6HOh3ZQv1qQ,1761
|
@@ -508,7 +508,7 @@ tests/apps/vista3d/test_vista3d_sampler.py,sha256=-luQCe3Hhle2PC9AkFCUgK8gozOD0O
|
|
508
508
|
tests/apps/vista3d/test_vista3d_transforms.py,sha256=nAPiDBNWeXLoW7ax3HHL63t5jqzQ3HFa-6wTvdyqVJk,3280
|
509
509
|
tests/bundle/__init__.py,sha256=s9djSd6kvViPnFvMR11Dgd30Lv4oY6FaPJr4ZZJZLq0,573
|
510
510
|
tests/bundle/test_bundle_ckpt_export.py,sha256=VnpigCoBAAc2lo0rWOpVMg0IYGB6vbHXL8xLtB1Pkio,4622
|
511
|
-
tests/bundle/test_bundle_download.py,sha256=
|
511
|
+
tests/bundle/test_bundle_download.py,sha256=snf7bfFbiLaQoXOC9nR3w7RVYQv1t2l1qMjSlzyIBDE,20213
|
512
512
|
tests/bundle/test_bundle_get_data.py,sha256=lQh321mev_7fsLXRg0Tq5uEjuQILethDHRKzB6VV0o4,3667
|
513
513
|
tests/bundle/test_bundle_push_to_hf_hub.py,sha256=Zjl6xDwRKgkS6jvO5dzMBaTLEd4EXyMXp0_wzDNSY3g,1740
|
514
514
|
tests/bundle/test_bundle_trt_export.py,sha256=png-2SGjBSt46LXSz-PLprOXwJ0WkC_3YLR3Ibk_WBc,6344
|
@@ -1189,7 +1189,7 @@ tests/visualize/test_vis_gradcam.py,sha256=WpA-pvTB75eZs7JoIc5qyvOV9PwgkzWI8-Vow
|
|
1189
1189
|
tests/visualize/utils/__init__.py,sha256=s9djSd6kvViPnFvMR11Dgd30Lv4oY6FaPJr4ZZJZLq0,573
|
1190
1190
|
tests/visualize/utils/test_blend_images.py,sha256=RVs2p_8RWQDfhLHDNNtZaMig27v8o0km7XxNa-zWjKE,2274
|
1191
1191
|
tests/visualize/utils/test_matshow3d.py,sha256=wXYj77L5Jvnp0f6DvL1rsi_-YlCxS0HJ9hiPmrbpuP8,5021
|
1192
|
-
monai_weekly-1.5.
|
1193
|
-
monai_weekly-1.5.
|
1194
|
-
monai_weekly-1.5.
|
1195
|
-
monai_weekly-1.5.
|
1192
|
+
monai_weekly-1.5.dev2520.dist-info/METADATA,sha256=cEQRrwHZy0OXogNJ_cv8V4R0rgImFPY_Cqbs3ysjtvQ,12033
|
1193
|
+
monai_weekly-1.5.dev2520.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
1194
|
+
monai_weekly-1.5.dev2520.dist-info/top_level.txt,sha256=hn2Y6P9xBf2R8faMeVMHhPMvrdDKxMsIOwMDYI0yTjs,12
|
1195
|
+
monai_weekly-1.5.dev2520.dist-info/RECORD,,
|
@@ -268,11 +268,10 @@ class TestLoad(unittest.TestCase):
|
|
268
268
|
@skip_if_quick
|
269
269
|
def test_load_weights(self, bundle_files, bundle_name, repo, device, model_file):
|
270
270
|
with skip_if_downloading_fails():
|
271
|
-
# download bundle, and load weights from the downloaded path
|
272
271
|
with tempfile.TemporaryDirectory() as tempdir:
|
273
272
|
bundle_root = os.path.join(tempdir, bundle_name)
|
274
273
|
# load weights
|
275
|
-
|
274
|
+
model_1 = load(
|
276
275
|
name=bundle_name,
|
277
276
|
model_file=model_file,
|
278
277
|
bundle_dir=tempdir,
|
@@ -280,7 +279,6 @@ class TestLoad(unittest.TestCase):
|
|
280
279
|
source="github",
|
281
280
|
progress=False,
|
282
281
|
device=device,
|
283
|
-
return_state_dict=True,
|
284
282
|
)
|
285
283
|
# prepare network
|
286
284
|
with open(os.path.join(bundle_root, bundle_files[2])) as f:
|
@@ -289,7 +287,7 @@ class TestLoad(unittest.TestCase):
|
|
289
287
|
del net_args["_target_"]
|
290
288
|
model = getattr(nets, model_name)(**net_args)
|
291
289
|
model.to(device)
|
292
|
-
model.load_state_dict(
|
290
|
+
model.load_state_dict(model_1)
|
293
291
|
model.eval()
|
294
292
|
|
295
293
|
# prepare data and test
|
@@ -313,13 +311,11 @@ class TestLoad(unittest.TestCase):
|
|
313
311
|
progress=False,
|
314
312
|
device=device,
|
315
313
|
source="github",
|
316
|
-
return_state_dict=False,
|
317
314
|
)
|
318
315
|
model_2.eval()
|
319
316
|
output_2 = model_2.forward(input_tensor)
|
320
317
|
assert_allclose(output_2, expected_output, atol=1e-4, rtol=1e-4, type_test=False)
|
321
318
|
|
322
|
-
# test compatibility with return_state_dict=True.
|
323
319
|
model_3 = load(
|
324
320
|
name=bundle_name,
|
325
321
|
model_file=model_file,
|
@@ -328,7 +324,6 @@ class TestLoad(unittest.TestCase):
|
|
328
324
|
device=device,
|
329
325
|
net_name=model_name,
|
330
326
|
source="github",
|
331
|
-
return_state_dict=False,
|
332
327
|
**net_args,
|
333
328
|
)
|
334
329
|
model_3.eval()
|
@@ -343,14 +338,7 @@ class TestLoad(unittest.TestCase):
|
|
343
338
|
# download bundle, and load weights from the downloaded path
|
344
339
|
with tempfile.TemporaryDirectory() as tempdir:
|
345
340
|
# load weights
|
346
|
-
model = load(
|
347
|
-
name=bundle_name,
|
348
|
-
bundle_dir=tempdir,
|
349
|
-
source="monaihosting",
|
350
|
-
progress=False,
|
351
|
-
device=device,
|
352
|
-
return_state_dict=False,
|
353
|
-
)
|
341
|
+
model = load(name=bundle_name, bundle_dir=tempdir, source="monaihosting", progress=False, device=device)
|
354
342
|
|
355
343
|
# prepare data and test
|
356
344
|
input_tensor = torch.rand(1, 1, 96, 96, 96).to(device)
|
@@ -371,7 +359,6 @@ class TestLoad(unittest.TestCase):
|
|
371
359
|
source="monaihosting",
|
372
360
|
progress=False,
|
373
361
|
device=device,
|
374
|
-
return_state_dict=False,
|
375
362
|
net_override=net_override,
|
376
363
|
)
|
377
364
|
|
File without changes
|
File without changes
|