From 59ba4714fd7c5f1b1e5323df1475c3ea430d9f90 Mon Sep 17 00:00:00 2001 From: 12yuuuu Date: Wed, 30 Sep 2026 13:35:58 -0400 Subject: [PATCH 1/3] DiNTS bundles: make search code compatible with torch.load(weights_only=True) The search_code_18590.pt files hold numpy arrays (raw TopologySearch.decode() output), which the weights_only=True default of torch.load (PyTorch >= 2.6) refuses. See Project-MONAI/MONAI#9025. - scripts/search.py: save decode() results as tensors - inference.yaml / train.yaml: wrap arch_code in numpy.asarray() and node_a in torch.as_tensor() so both the legacy (numpy) and the new (tensor) files work, with or without the companion MONAI fix (Project-MONAI/MONAI#9143) - inference.yaml / train.yaml: load the search code with map_location='cpu'. It is architecture metadata consumed on the host (TopologyConstruction moves it to its own device; node_a is only indexed in DiNTS.forward), and with a tensor file map_location='cuda' would hand numpy.asarray a CUDA tensor - bump versions / changelog: pancreas 0.5.4, multi_organ 0.0.7 Validated on CPU only (no CUDA machine available). Signed-off-by: 12yuuuu --- models/multi_organ_segmentation/configs/inference.yaml | 9 +++++---- models/multi_organ_segmentation/configs/metadata.json | 3 ++- models/multi_organ_segmentation/configs/train.yaml | 7 ++++--- .../configs/inference.yaml | 8 ++++---- .../configs/metadata.json | 3 ++- .../pancreas_ct_dints_segmentation/configs/train.yaml | 7 ++++--- .../pancreas_ct_dints_segmentation/scripts/search.py | 10 ++++++---- 7 files changed, 27 insertions(+), 20 deletions(-) diff --git a/models/multi_organ_segmentation/configs/inference.yaml b/models/multi_organ_segmentation/configs/inference.yaml index 44eafd0e..1e37ab98 100644 --- a/models/multi_organ_segmentation/configs/inference.yaml +++ b/models/multi_organ_segmentation/configs/inference.yaml @@ -1,11 +1,12 @@ --- imports: +- "$import numpy" - "$import glob" - "$import os" input_channels: 1 output_classes: 8 arch_ckpt_path: "$@bundle_root + '/models/search_code_18590.pt'" -arch_ckpt: "$torch.load(@arch_ckpt_path, map_location=torch.device('cuda'))" +arch_ckpt: "$torch.load(@arch_ckpt_path, map_location='cpu')" bundle_root: "." output_dir: "$@bundle_root + '/eval'" dataset_dir: "/data/" @@ -20,8 +21,8 @@ dints_space: num_depths: 4 use_downsample: true arch_code: - - "$@arch_ckpt['arch_code_a']" - - "$@arch_ckpt['arch_code_c']" + - "$numpy.asarray(@arch_ckpt['arch_code_a'])" + - "$numpy.asarray(@arch_ckpt['arch_code_c'])" device: "$torch.device('cuda')" network_def: _target_: monai.networks.nets.DiNTS @@ -29,7 +30,7 @@ network_def: in_channels: "@input_channels" num_classes: "@output_classes" use_downsample: true - node_a: "$torch.from_numpy(@arch_ckpt['node_a'])" + node_a: "$torch.as_tensor(@arch_ckpt['node_a'])" network: "$@network_def.to(@device)" preprocessing: _target_: Compose diff --git a/models/multi_organ_segmentation/configs/metadata.json b/models/multi_organ_segmentation/configs/metadata.json index 25ba0079..671760da 100644 --- a/models/multi_organ_segmentation/configs/metadata.json +++ b/models/multi_organ_segmentation/configs/metadata.json @@ -1,7 +1,8 @@ { "schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20240725.json", - "version": "0.0.6", + "version": "0.0.7", "changelog": { + "0.0.7": "load search code with torch.as_tensor/numpy.asarray and save it as tensors for torch.load(weights_only=True) compatibility", "0.0.6": "enhance metadata with improved descriptions", "0.0.5": "update to huggingface hosting", "0.0.4": "Set image_only to False", diff --git a/models/multi_organ_segmentation/configs/train.yaml b/models/multi_organ_segmentation/configs/train.yaml index a9a1ca6f..3e53e8d7 100644 --- a/models/multi_organ_segmentation/configs/train.yaml +++ b/models/multi_organ_segmentation/configs/train.yaml @@ -1,5 +1,6 @@ --- imports: +- "$import numpy" - "$import glob" - "$import json" - "$import os" @@ -8,7 +9,7 @@ imports: input_channels: 1 output_classes: 8 arch_ckpt_path: "$@bundle_root + '/models/search_code_18590.pt'" -arch_ckpt: "$torch.load(@arch_ckpt_path, map_location=torch.device('cuda'))" +arch_ckpt: "$torch.load(@arch_ckpt_path, map_location='cpu')" bundle_root: "." ckpt_dir: "$@bundle_root + '/models'" output_dir: "$@bundle_root + '/eval'" @@ -26,8 +27,8 @@ dints_space: num_depths: 4 use_downsample: true arch_code: - - "$@arch_ckpt['arch_code_a']" - - "$@arch_ckpt['arch_code_c']" + - "$numpy.asarray(@arch_ckpt['arch_code_a'])" + - "$numpy.asarray(@arch_ckpt['arch_code_c'])" device: "$torch.device('cuda')" network_def: _target_: monai.networks.nets.DiNTS diff --git a/models/pancreas_ct_dints_segmentation/configs/inference.yaml b/models/pancreas_ct_dints_segmentation/configs/inference.yaml index 319af066..a8720e93 100644 --- a/models/pancreas_ct_dints_segmentation/configs/inference.yaml +++ b/models/pancreas_ct_dints_segmentation/configs/inference.yaml @@ -6,7 +6,7 @@ imports: input_channels: 1 output_classes: 3 arch_ckpt_path: "$@bundle_root + '/models/search_code_18590.pt'" -arch_ckpt: "$torch.load(@arch_ckpt_path, map_location=torch.device('cuda'))" +arch_ckpt: "$torch.load(@arch_ckpt_path, map_location='cpu')" bundle_root: "." image_key: "image" output_dir: "$@bundle_root + '/eval'" @@ -27,8 +27,8 @@ dints_space: num_depths: 4 use_downsample: true arch_code: - - "$@arch_ckpt['arch_code_a']" - - "$@arch_ckpt['arch_code_c']" + - "$numpy.asarray(@arch_ckpt['arch_code_a'])" + - "$numpy.asarray(@arch_ckpt['arch_code_c'])" device: "$torch.device('cuda')" network_def: _target_: monai.networks.nets.DiNTS @@ -36,7 +36,7 @@ network_def: in_channels: "@input_channels" num_classes: "@output_classes" use_downsample: true - node_a: "$torch.from_numpy(@arch_ckpt['node_a'])" + node_a: "$torch.as_tensor(@arch_ckpt['node_a'])" network: "$@network_def.to(@device)" preprocessing: _target_: Compose diff --git a/models/pancreas_ct_dints_segmentation/configs/metadata.json b/models/pancreas_ct_dints_segmentation/configs/metadata.json index 59d51d7d..25fd1aa3 100644 --- a/models/pancreas_ct_dints_segmentation/configs/metadata.json +++ b/models/pancreas_ct_dints_segmentation/configs/metadata.json @@ -1,7 +1,8 @@ { "schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20240725.json", - "version": "0.5.3", + "version": "0.5.4", "changelog": { + "0.5.4": "load search code with torch.as_tensor/numpy.asarray and save it as tensors for torch.load(weights_only=True) compatibility", "0.5.3": "modernize type annotations and string formatting without changing behavior", "0.5.2": "enhance metadata with improved descriptions", "0.5.1": "update to huggingface hosting", diff --git a/models/pancreas_ct_dints_segmentation/configs/train.yaml b/models/pancreas_ct_dints_segmentation/configs/train.yaml index e5551a7e..62f36e4f 100644 --- a/models/pancreas_ct_dints_segmentation/configs/train.yaml +++ b/models/pancreas_ct_dints_segmentation/configs/train.yaml @@ -1,5 +1,6 @@ --- imports: +- "$import numpy" - "$import glob" - "$import json" - "$import os" @@ -8,7 +9,7 @@ imports: input_channels: 1 output_classes: 3 arch_ckpt_path: "$@bundle_root + '/models/search_code_18590.pt'" -arch_ckpt: "$torch.load(@arch_ckpt_path, map_location=torch.device('cuda'))" +arch_ckpt: "$torch.load(@arch_ckpt_path, map_location='cpu')" bundle_root: "." ckpt_dir: "$@bundle_root + '/models'" output_dir: "$@bundle_root + '/eval'" @@ -26,8 +27,8 @@ dints_space: num_depths: 4 use_downsample: true arch_code: - - "$@arch_ckpt['arch_code_a']" - - "$@arch_ckpt['arch_code_c']" + - "$numpy.asarray(@arch_ckpt['arch_code_a'])" + - "$numpy.asarray(@arch_ckpt['arch_code_c'])" device: "$torch.device('cuda')" network_def: _target_: monai.networks.nets.DiNTS diff --git a/models/pancreas_ct_dints_segmentation/scripts/search.py b/models/pancreas_ct_dints_segmentation/scripts/search.py index 2645ecbe..0bc9364b 100644 --- a/models/pancreas_ct_dints_segmentation/scripts/search.py +++ b/models/pancreas_ct_dints_segmentation/scripts/search.py @@ -458,10 +458,12 @@ def run(config_file: str | Sequence[str]): # ruff: ignore[C901] FIXME: too com node_a_d, arch_code_a_d, arch_code_c_d, arch_code_a_max_d = dints_space.decode() torch.save( { - "node_a": node_a_d, - "arch_code_a": arch_code_a_d, - "arch_code_a_max": arch_code_a_max_d, - "arch_code_c": arch_code_c_d, + # save as tensors (not numpy arrays) so the file can be read with + # torch.load(weights_only=True), the default since PyTorch 2.6 + "node_a": torch.as_tensor(node_a_d), + "arch_code_a": torch.as_tensor(arch_code_a_d), + "arch_code_a_max": torch.as_tensor(arch_code_a_max_d), + "arch_code_c": torch.as_tensor(arch_code_c_d), "iter_num": idx_iter, "epochs": epoch + 1, "best_dsc": best_metric, From 0a44dd49d0331653b83ef8ca1a6f526789d385ab Mon Sep 17 00:00:00 2001 From: 12yuuuu Date: Thu, 8 Oct 2026 22:34:26 -0400 Subject: [PATCH 2/3] DiNTS bundles: ship search codes in-repo as tensors Per review: search_code_18590.pt is only ~4 kB per bundle, so commit it under models//models/ re-encoded as a tensor checkpoint (values and dtypes unchanged, verified against the hosted originals with torch.load(weights_only=True) and numpy.array_equal) and drop the entries from large_files.yml. Update the bundle changelogs accordingly. Signed-off-by: 12yuuuu --- .../configs/metadata.json | 2 +- models/multi_organ_segmentation/large_files.yml | 4 ---- .../models/search_code_18590.pt | Bin 0 -> 6113 bytes .../configs/metadata.json | 2 +- .../large_files.yml | 4 ---- .../models/search_code_18590.pt | Bin 0 -> 5345 bytes 6 files changed, 2 insertions(+), 10 deletions(-) create mode 100644 models/multi_organ_segmentation/models/search_code_18590.pt create mode 100644 models/pancreas_ct_dints_segmentation/models/search_code_18590.pt diff --git a/models/multi_organ_segmentation/configs/metadata.json b/models/multi_organ_segmentation/configs/metadata.json index 671760da..a49072fd 100644 --- a/models/multi_organ_segmentation/configs/metadata.json +++ b/models/multi_organ_segmentation/configs/metadata.json @@ -2,7 +2,7 @@ "schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20240725.json", "version": "0.0.7", "changelog": { - "0.0.7": "load search code with torch.as_tensor/numpy.asarray and save it as tensors for torch.load(weights_only=True) compatibility", + "0.0.7": "ship search code in the bundle as a tensor checkpoint loadable with torch.load(weights_only=True); load it on CPU via numpy.asarray/torch.as_tensor; search.py saves tensors", "0.0.6": "enhance metadata with improved descriptions", "0.0.5": "update to huggingface hosting", "0.0.4": "Set image_only to False", diff --git a/models/multi_organ_segmentation/large_files.yml b/models/multi_organ_segmentation/large_files.yml index 4cc0fbb5..d8f6d78c 100644 --- a/models/multi_organ_segmentation/large_files.yml +++ b/models/multi_organ_segmentation/large_files.yml @@ -1,8 +1,4 @@ large_files: - - path: "models/search_code_18590.pt" - url: "https://drive.google.com/uc?export=download&id=1G2YZo1HKkvf5sMvaaRQeZp_YA9GDlvL-" - hash_val: "55dc7fe4bee4a93d25a1dd329dfdd159" - hash_type: "md5" - path: "models/model.pt" url: "https://drive.google.com/uc?export=download&id=1kH0yTyiXUNqdYXpnSXI2p5-vFwDYoCzl" hash_val: "e21d663b33d29a8ca4e28d60a14a3d66" diff --git a/models/multi_organ_segmentation/models/search_code_18590.pt b/models/multi_organ_segmentation/models/search_code_18590.pt new file mode 100644 index 0000000000000000000000000000000000000000..dbebbb2ea0c3542a8505bc55c2e695094550c4e1 GIT binary patch literal 6113 zcmeI0&u<$=6vsD-yK;n9ylBL&mML(>^cFD3H)8}@{f!mhl zI*x78j@$Fp>;0zPx0_cx7FCIwtdWD19IBDS^@EJEcQ#CNq|M4`BlT5x&~WT=@}tA# zS@J|XuHU5O7*BdgS9i&AUFAtn+-`IB3MEh0$jSQAAlvAgH_0iV-}e8H969ZyR>!EP zeALrE>KRJT)X17prbV6&U^H^p$DA8up7Sx!`@S`f7by?-52(vEzmfP=|)L@g)V^^(GF3dFf*nG|M(!Tri-bZ}0@Izi&UO5w` zw9%wAOsCW8b?qLllvm}|ZRCgN<{k3;JWI|Gc>$M{^#}zt-lew7Cvl~GPM#OHs?(v= zv3U(2zx>N8zYX~zuOXqFk5B_&6|Q6|<+Gs$@Kes)|N7sa2S5A%>%eEmwcoye29^~JnleHllzg9DX~i+1!8CsX)A;dj5p*9Y~3i{E_DUb6V{sP!Qg zb$!TH$`?YP9R3q*+UEu;pEeHuv&PHfL_7LWx0Hp3Dx;GbW zUfB4wJkej)7xRYoWgO8C4pcTS+R;axOyLKGANqX#SX=t1@vp8QTJ-gUef$m^|3>7E zzk%}xI~3!n8+P<%D*E|!MF9`vP~-;>{-VMUig+me(FYHT{P2^h=!batqYppiLtU^# z;g5Lu!w!YNj3dT@hj>xJgJN8a!?H!A|zQ}_eD*E&F(ihANU#d|QPt;$mkK+7le;r1HXdxz_W?!j zJ9+aI1K8S$DASpD&`(C|;@>P6Z!C^)fGf97@!#0FT;zLq LipqYtzwi41zw?jM$39e%tja}N3dR-4Du#p%{*ui)C=wSYTD^SVy!XDbXLh|a zWqmd*L@Xu_G)=6EwT*hst|j(vwo1hnapRD7XXYa*;?<~c6P73IZcMEAw@~bNOe}B zxi^qeebbh6Z|Oo`)WiESrib;=zMQ{nn%!2*GVNx!)7ReY)vcaYztS{qO=_1aa>16T zDsr*9pj>KdV20_A^Rb2+MgygvYgGKSQ#>UfZ$$Omwp^m3r*v&!F6$ZyZ4$iMb=)|Z1iRP+LsZBv19dZquw{= zrK{Ty*S~(Z{lkOmyiz*(y_(&S>q^C(fbd`Nq&5}5$R!!o)Zm(Ul zjayc)uV$rGJag#cQR^v1);~Ua@Ci*eUH;Z9;xbte7mZPCHFrC0t7Dgn1wZ#g7A#BU zHfaFc@5|q3RB^ie2e2R_Y5+SQ*jASoS*aKjH(E{GZdv5<>E&O}(rrMOzeh}jhj-OR zvQ%_GvJyBS-HY@;HTp`Z{g406_dqkdapBiH_tgZ@b=1tRV`fvO;>9VKr2DD<*ghKF zULn9k4CHyle#mv;`Q_2?htL6ocpJzoR-IRJU%HO z?#pA;0rLLi#z8(o{k&cfKd7JkA%+f!{21x^@cnnO{7>p7g|4HX4;r2i=~6K|d_Dv{ z*HIZf#6X@$?1x+jo?jmQeh3{fh=+d8N6ZoY&HVs^x(mV$MEII`OtyK>wpgg4>1rr_+gyLL&p(%o`(+*{oo^yIzaF^VjSQhh96>J z5D)cHhwlGB-?+aPeE-jjdG-50+7U!sr6lsk^e4RC5RQ^;*)3R}rsHj~Sw^IMsGQbmP)Dw)b>bA@a+x0TFh zX_Vjg^y_goLb}R&$oZ;pa^yW7&{Y3q8=oU_op5k*t6Z|Lhr6{^7!l>N9asblB>M$ij%5jgvvQ8btp3V?RtM?!jT=mY|DBy`pS@fe)iRo m4oe7l)mdyp Date: Wed, 14 Oct 2026 09:57:37 -0400 Subject: [PATCH 3/3] DiNTS bundles: use the configured device instead of hard-coded CUDA Apply review suggestions: load the search code with map_location=@device and pass @device to the DiNTS search space. Since the arch codes can now be on a GPU, convert them with .cpu().numpy() instead of numpy.asarray(), so older MONAI versions that call torch.from_numpy still get NumPy arrays. Drop the numpy imports that are no longer needed. Signed-off-by: 12yuuuu --- models/multi_organ_segmentation/configs/inference.yaml | 9 ++++----- models/multi_organ_segmentation/configs/metadata.json | 2 +- models/multi_organ_segmentation/configs/train.yaml | 9 ++++----- .../configs/inference.yaml | 8 ++++---- .../pancreas_ct_dints_segmentation/configs/metadata.json | 2 +- models/pancreas_ct_dints_segmentation/configs/train.yaml | 9 ++++----- 6 files changed, 18 insertions(+), 21 deletions(-) diff --git a/models/multi_organ_segmentation/configs/inference.yaml b/models/multi_organ_segmentation/configs/inference.yaml index 1e37ab98..a59dd209 100644 --- a/models/multi_organ_segmentation/configs/inference.yaml +++ b/models/multi_organ_segmentation/configs/inference.yaml @@ -1,12 +1,11 @@ --- imports: -- "$import numpy" - "$import glob" - "$import os" input_channels: 1 output_classes: 8 arch_ckpt_path: "$@bundle_root + '/models/search_code_18590.pt'" -arch_ckpt: "$torch.load(@arch_ckpt_path, map_location='cpu')" +arch_ckpt: "$torch.load(@arch_ckpt_path, map_location=@device)" bundle_root: "." output_dir: "$@bundle_root + '/eval'" dataset_dir: "/data/" @@ -21,9 +20,9 @@ dints_space: num_depths: 4 use_downsample: true arch_code: - - "$numpy.asarray(@arch_ckpt['arch_code_a'])" - - "$numpy.asarray(@arch_ckpt['arch_code_c'])" - device: "$torch.device('cuda')" + - "$@arch_ckpt['arch_code_a'].cpu().numpy()" + - "$@arch_ckpt['arch_code_c'].cpu().numpy()" + device: "@device" network_def: _target_: monai.networks.nets.DiNTS dints_space: "@dints_space" diff --git a/models/multi_organ_segmentation/configs/metadata.json b/models/multi_organ_segmentation/configs/metadata.json index a49072fd..a192d4e5 100644 --- a/models/multi_organ_segmentation/configs/metadata.json +++ b/models/multi_organ_segmentation/configs/metadata.json @@ -2,7 +2,7 @@ "schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20240725.json", "version": "0.0.7", "changelog": { - "0.0.7": "ship search code in the bundle as a tensor checkpoint loadable with torch.load(weights_only=True); load it on CPU via numpy.asarray/torch.as_tensor; search.py saves tensors", + "0.0.7": "ship search code in the bundle as a tensor checkpoint loadable with torch.load(weights_only=True); search.py saves tensors; use the configured device instead of hard-coded cuda", "0.0.6": "enhance metadata with improved descriptions", "0.0.5": "update to huggingface hosting", "0.0.4": "Set image_only to False", diff --git a/models/multi_organ_segmentation/configs/train.yaml b/models/multi_organ_segmentation/configs/train.yaml index 3e53e8d7..e8fce7a2 100644 --- a/models/multi_organ_segmentation/configs/train.yaml +++ b/models/multi_organ_segmentation/configs/train.yaml @@ -1,6 +1,5 @@ --- imports: -- "$import numpy" - "$import glob" - "$import json" - "$import os" @@ -9,7 +8,7 @@ imports: input_channels: 1 output_classes: 8 arch_ckpt_path: "$@bundle_root + '/models/search_code_18590.pt'" -arch_ckpt: "$torch.load(@arch_ckpt_path, map_location='cpu')" +arch_ckpt: "$torch.load(@arch_ckpt_path, map_location=@device)" bundle_root: "." ckpt_dir: "$@bundle_root + '/models'" output_dir: "$@bundle_root + '/eval'" @@ -27,9 +26,9 @@ dints_space: num_depths: 4 use_downsample: true arch_code: - - "$numpy.asarray(@arch_ckpt['arch_code_a'])" - - "$numpy.asarray(@arch_ckpt['arch_code_c'])" - device: "$torch.device('cuda')" + - "$@arch_ckpt['arch_code_a'].cpu().numpy()" + - "$@arch_ckpt['arch_code_c'].cpu().numpy()" + device: "@device" network_def: _target_: monai.networks.nets.DiNTS dints_space: "@dints_space" diff --git a/models/pancreas_ct_dints_segmentation/configs/inference.yaml b/models/pancreas_ct_dints_segmentation/configs/inference.yaml index a8720e93..e235d603 100644 --- a/models/pancreas_ct_dints_segmentation/configs/inference.yaml +++ b/models/pancreas_ct_dints_segmentation/configs/inference.yaml @@ -6,7 +6,7 @@ imports: input_channels: 1 output_classes: 3 arch_ckpt_path: "$@bundle_root + '/models/search_code_18590.pt'" -arch_ckpt: "$torch.load(@arch_ckpt_path, map_location='cpu')" +arch_ckpt: "$torch.load(@arch_ckpt_path, map_location=@device)" bundle_root: "." image_key: "image" output_dir: "$@bundle_root + '/eval'" @@ -27,9 +27,9 @@ dints_space: num_depths: 4 use_downsample: true arch_code: - - "$numpy.asarray(@arch_ckpt['arch_code_a'])" - - "$numpy.asarray(@arch_ckpt['arch_code_c'])" - device: "$torch.device('cuda')" + - "$@arch_ckpt['arch_code_a'].cpu().numpy()" + - "$@arch_ckpt['arch_code_c'].cpu().numpy()" + device: "@device" network_def: _target_: monai.networks.nets.DiNTS dints_space: "@dints_space" diff --git a/models/pancreas_ct_dints_segmentation/configs/metadata.json b/models/pancreas_ct_dints_segmentation/configs/metadata.json index 4a4a3fbe..fc4a91b7 100644 --- a/models/pancreas_ct_dints_segmentation/configs/metadata.json +++ b/models/pancreas_ct_dints_segmentation/configs/metadata.json @@ -2,7 +2,7 @@ "schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20240725.json", "version": "0.5.4", "changelog": { - "0.5.4": "ship search code in the bundle as a tensor checkpoint loadable with torch.load(weights_only=True); load it on CPU via numpy.asarray/torch.as_tensor; search.py saves tensors", + "0.5.4": "ship search code in the bundle as a tensor checkpoint loadable with torch.load(weights_only=True); search.py saves tensors; use the configured device instead of hard-coded cuda", "0.5.3": "modernize type annotations and string formatting without changing behavior", "0.5.2": "enhance metadata with improved descriptions", "0.5.1": "update to huggingface hosting", diff --git a/models/pancreas_ct_dints_segmentation/configs/train.yaml b/models/pancreas_ct_dints_segmentation/configs/train.yaml index 62f36e4f..1c640e7f 100644 --- a/models/pancreas_ct_dints_segmentation/configs/train.yaml +++ b/models/pancreas_ct_dints_segmentation/configs/train.yaml @@ -1,6 +1,5 @@ --- imports: -- "$import numpy" - "$import glob" - "$import json" - "$import os" @@ -9,7 +8,7 @@ imports: input_channels: 1 output_classes: 3 arch_ckpt_path: "$@bundle_root + '/models/search_code_18590.pt'" -arch_ckpt: "$torch.load(@arch_ckpt_path, map_location='cpu')" +arch_ckpt: "$torch.load(@arch_ckpt_path, map_location=@device)" bundle_root: "." ckpt_dir: "$@bundle_root + '/models'" output_dir: "$@bundle_root + '/eval'" @@ -27,9 +26,9 @@ dints_space: num_depths: 4 use_downsample: true arch_code: - - "$numpy.asarray(@arch_ckpt['arch_code_a'])" - - "$numpy.asarray(@arch_ckpt['arch_code_c'])" - device: "$torch.device('cuda')" + - "$@arch_ckpt['arch_code_a'].cpu().numpy()" + - "$@arch_ckpt['arch_code_c'].cpu().numpy()" + device: "@device" network_def: _target_: monai.networks.nets.DiNTS dints_space: "@dints_space"