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

Update AddChannel, AsChannelFirst with EnsureChannelFirst #509

Merged
merged 27 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a6df108
fix monai#7036
KumoLiu Sep 25, 2023
fdc1f18
Merge branch 'dev' of https://github.com/Project-MONAI/model-zoo into…
KumoLiu Sep 26, 2023
f6765e4
update lung_nodule_ct_detection
KumoLiu Oct 10, 2023
cbadbe8
update `ventricular_short_axis_3label`
KumoLiu Oct 11, 2023
94dfde0
try to fix np space error
KumoLiu Oct 11, 2023
12f4b0e
fix #517
KumoLiu Oct 11, 2023
bff4323
Merge branch 'dev' into ensurechannelfirst
KumoLiu Oct 11, 2023
c7d6e7b
update version
KumoLiu Oct 11, 2023
fd42a71
Merge branch 'ensurechannelfirst' of https://github.com/KumoLiu/model…
KumoLiu Oct 11, 2023
d460f83
minor fix
KumoLiu Oct 11, 2023
ccdea00
minor fix
KumoLiu Oct 12, 2023
7f01a28
Merge branch 'dev' into ensurechannelfirst
KumoLiu Oct 12, 2023
62aced2
temp test
KumoLiu Oct 12, 2023
184597e
fix flake8
KumoLiu Oct 12, 2023
8f032d7
minor fix
KumoLiu Oct 12, 2023
94a7b06
update hash
KumoLiu Oct 12, 2023
a7cc9a6
Merge branch 'dev' into ensurechannelfirst
KumoLiu Oct 12, 2023
57107f9
minor fix
KumoLiu Oct 12, 2023
32efc4d
minor fix
KumoLiu Oct 12, 2023
f4655d3
minor fix
KumoLiu Oct 12, 2023
cddd956
Merge branch 'dev' into ensurechannelfirst
wyli Oct 12, 2023
005d51b
Merge branch 'dev' into ensurechannelfirst
yiheng-wang-nv Oct 13, 2023
42d482a
Merge remote-tracking branch 'origin/dev' into ensurechannelfirst
KumoLiu Oct 13, 2023
507112d
revert temp test
KumoLiu Oct 13, 2023
7f908e1
rm cache
KumoLiu Oct 13, 2023
a670e9a
revert several bundles
KumoLiu Oct 13, 2023
cfa6e19
minor fix
KumoLiu Oct 13, 2023
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
10 changes: 9 additions & 1 deletion ci/get_bundle_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@

import argparse
import os
import re

from bundle_custom_data import install_dependency_dict
from utils import get_json_dict


def is_commit_hash(s):
return bool(re.match("^[0-9a-f]{7,40}$", s))


def get_requirements(bundle, models_path):
"""
This function is used to produce a requirements txt file, and print a string
Expand All @@ -29,7 +34,10 @@ def get_requirements(bundle, models_path):
libs = []
if "monai_version" in metadata.keys():
monai_version = metadata["monai_version"]
libs.append(f"monai=={monai_version}")
if is_commit_hash(monai_version):
libs.append(f"git+https://github.com/Project-MONAI/MONAI@{monai_version}#egg=monai")
else:
libs.append(f"monai=={monai_version}")
if "pytorch_version" in metadata.keys():
pytorch_version = metadata["pytorch_version"]
libs.append(f"torch=={pytorch_version}")
Expand Down
1 change: 1 addition & 0 deletions ci/run_premerge_cpu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ elif [[ $# -gt 1 ]]; then
fi

verify_bundle() {
rm -rf /opt/hostedtoolcache
echo 'Run verify bundle...'
pip install -r requirements.txt
head_ref=$(git rev-parse HEAD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def test_autoencoder_train(self, override):
sys.path = [bundle_root] + sys.path

trainer = ConfigWorkflow(
workflow="train",
workflow_type="train",
config_file=os.path.join(bundle_root, "configs/train_autoencoder.json"),
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -108,7 +108,7 @@ def test_autoencoder_infer(self, override):
sys.path = [bundle_root] + sys.path

inferrer = ConfigWorkflow(
workflow="infer",
workflow_type="infer",
config_file=os.path.join(bundle_root, "configs/inference_autoencoder.json"),
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -125,7 +125,7 @@ def test_diffusion_train(self, override):
diffusion_file = os.path.join(bundle_root, "configs/train_diffusion.json")

trainer = ConfigWorkflow(
workflow="train",
workflow_type="train",
config_file=[autoencoder_file, diffusion_file],
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -140,7 +140,7 @@ def test_diffusion_infer(self, override):
sys.path = [bundle_root] + sys.path

inferrer = ConfigWorkflow(
workflow="infer",
workflow_type="infer",
config_file=os.path.join(bundle_root, "configs/inference.json"),
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand Down
8 changes: 4 additions & 4 deletions ci/unit_tests/test_brats_mri_generative_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def test_autoencoder_train(self, override):
sys.path = [bundle_root] + sys.path

trainer = ConfigWorkflow(
workflow="train",
workflow_type="train",
config_file=os.path.join(bundle_root, "configs/train_autoencoder.json"),
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -122,7 +122,7 @@ def test_autoencoder_infer(self, override):
sys.path = [bundle_root] + sys.path

inferrer = ConfigWorkflow(
workflow="infer",
workflow_type="infer",
config_file=os.path.join(bundle_root, "configs/inference_autoencoder.json"),
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -139,7 +139,7 @@ def test_diffusion_train(self, override):
diffusion_file = os.path.join(bundle_root, "configs/train_diffusion.json")

trainer = ConfigWorkflow(
workflow="train",
workflow_type="train",
config_file=[autoencoder_file, diffusion_file],
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -154,7 +154,7 @@ def test_diffusion_infer(self, override):
sys.path = [bundle_root] + sys.path

inferrer = ConfigWorkflow(
workflow="infer",
workflow_type="infer",
config_file=os.path.join(bundle_root, "configs/inference.json"),
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand Down
6 changes: 3 additions & 3 deletions ci/unit_tests/test_brats_mri_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def test_train_eval_config(self, override):
eval_file = os.path.join(bundle_root, "configs/evaluate.json")

trainer = ConfigWorkflow(
workflow="train",
workflow_type="train",
config_file=train_file,
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -80,7 +80,7 @@ def test_train_eval_config(self, override):

validator = ConfigWorkflow(
# override train.json, thus set the workflow to "train" rather than "eval"
workflow="train",
workflow_type="train",
config_file=[train_file, eval_file],
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -94,7 +94,7 @@ def test_infer_config(self, override):
bundle_root = override["bundle_root"]

inferrer = ConfigWorkflow(
workflow="infer",
workflow_type="infer",
config_file=os.path.join(bundle_root, "configs/inference.json"),
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand Down
6 changes: 3 additions & 3 deletions ci/unit_tests/test_endoscopic_inbody_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def test_train_eval_config(self, override):
eval_file = os.path.join(bundle_root, "configs/evaluate.json")

trainer = ConfigWorkflow(
workflow="train",
workflow_type="train",
config_file=train_file,
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -82,7 +82,7 @@ def test_train_eval_config(self, override):

validator = ConfigWorkflow(
# override train.json, thus set the workflow to "train" rather than "eval"
workflow="train",
workflow_type="train",
config_file=[train_file, eval_file],
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -96,7 +96,7 @@ def test_infer_config(self, override):
bundle_root = override["bundle_root"]

inferrer = ConfigWorkflow(
workflow="infer",
workflow_type="infer",
config_file=os.path.join(bundle_root, "configs/inference.json"),
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand Down
6 changes: 3 additions & 3 deletions ci/unit_tests/test_endoscopic_tool_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def test_train_eval_config(self, override):
eval_file = os.path.join(bundle_root, "configs/evaluate.json")

trainer = ConfigWorkflow(
workflow="train",
workflow_type="train",
config_file=train_file,
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -81,7 +81,7 @@ def test_train_eval_config(self, override):

validator = ConfigWorkflow(
# override train.json, thus set the workflow to "train" rather than "eval"
workflow="train",
workflow_type="train",
config_file=[train_file, eval_file],
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -95,7 +95,7 @@ def test_infer_config(self, override):
bundle_root = override["bundle_root"]

inferrer = ConfigWorkflow(
workflow="infer",
workflow_type="infer",
config_file=os.path.join(bundle_root, "configs/inference.json"),
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand Down
6 changes: 3 additions & 3 deletions ci/unit_tests/test_lung_nodule_ct_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_train_eval_config(self, override):

sys.path.append(bundle_root)
trainer = ConfigWorkflow(
workflow="train",
workflow_type="train",
config_file=train_file,
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -96,7 +96,7 @@ def test_train_eval_config(self, override):

validator = ConfigWorkflow(
# override train.json, thus set the workflow to "train" rather than "eval"
workflow="train",
workflow_type="train",
config_file=[train_file, eval_file],
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -111,7 +111,7 @@ def test_infer_config(self, override):
bundle_root = override["bundle_root"]

inferrer = ConfigWorkflow(
workflow="infer",
workflow_type="infer",
config_file=os.path.join(bundle_root, "configs/inference.json"),
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand Down
6 changes: 3 additions & 3 deletions ci/unit_tests/test_pancreas_ct_dints_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def test_train(self, override):
train_file = os.path.join(bundle_root, "configs/train.yaml")

trainer = ConfigWorkflow(
workflow="train",
workflow_type="train",
config_file=train_file,
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -146,7 +146,7 @@ def test_eval(self, override):

validator = ConfigWorkflow(
# override train.json, thus set the workflow to "train" rather than "eval"
workflow="train",
workflow_type="train",
config_file=[train_file, eval_file],
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -161,7 +161,7 @@ def test_infer_config(self, override):
arch_name = get_searched_arch(os.path.join(bundle_root, "models"))
override["arch_ckpt_path"] = os.path.join(bundle_root, "models", arch_name)
inferrer = ConfigWorkflow(
workflow="infer",
workflow_type="infer",
config_file=os.path.join(bundle_root, "configs/inference.yaml"),
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand Down
6 changes: 3 additions & 3 deletions ci/unit_tests/test_pathology_nuclei_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def test_train_eval_config(self, override):
eval_file = os.path.join(bundle_root, "configs/evaluate.json")

trainer = ConfigWorkflow(
workflow="train",
workflow_type="train",
config_file=train_file,
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -109,7 +109,7 @@ def test_train_eval_config(self, override):

validator = ConfigWorkflow(
# override train.json, thus set the workflow to "train" rather than "eval"
workflow="train",
workflow_type="train",
config_file=[train_file, eval_file],
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -124,7 +124,7 @@ def test_infer_config(self, override):

sys.path.append(bundle_root)
inferrer = ConfigWorkflow(
workflow="infer",
workflow_type="infer",
config_file=os.path.join(bundle_root, "configs/inference.json"),
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_train_eval_config(self, override):
eval_file = os.path.join(bundle_root, "configs/evaluate.json")

trainer = ConfigWorkflow(
workflow="train",
workflow_type="train",
config_file=train_file,
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -97,7 +97,7 @@ def test_train_eval_config(self, override):

validator = ConfigWorkflow(
# override train.json, thus set the workflow to "train" rather than "eval"
workflow="train",
workflow_type="train",
config_file=[train_file, eval_file],
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -111,7 +111,7 @@ def test_infer_config(self, override):
bundle_root = override["bundle_root"]

inferrer = ConfigWorkflow(
workflow="infer",
workflow_type="infer",
config_file=os.path.join(bundle_root, "configs/inference.json"),
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand Down
6 changes: 3 additions & 3 deletions ci/unit_tests/test_pathology_nuclick_annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def test_train_eval_config(self, override):
eval_file = os.path.join(bundle_root, "configs/evaluate.json")

trainer = ConfigWorkflow(
workflow="train",
workflow_type="train",
config_file=train_file,
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -109,7 +109,7 @@ def test_train_eval_config(self, override):

validator = ConfigWorkflow(
# override train.json, thus set the workflow to "train" rather than "eval"
workflow="train",
workflow_type="train",
config_file=[train_file, eval_file],
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -124,7 +124,7 @@ def test_infer_config(self, override):

sys.path.append(bundle_root)
inferrer = ConfigWorkflow(
workflow="infer",
workflow_type="infer",
config_file=os.path.join(bundle_root, "configs/inference.json"),
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand Down
4 changes: 2 additions & 2 deletions ci/unit_tests/test_pathology_tumor_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def test_train_infer_config(self, override, override_infer):
train_file = os.path.join(bundle_root, "configs/train.json")

trainer = ConfigWorkflow(
workflow="train",
workflow_type="train",
config_file=train_file,
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -89,7 +89,7 @@ def test_train_infer_config(self, override, override_infer):
override_infer["dataset_dir"] = self.dataset_dir

inferrer = ConfigWorkflow(
workflow="infer",
workflow_type="infer",
config_file=os.path.join(bundle_root, "configs/inference.json"),
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand Down
6 changes: 3 additions & 3 deletions ci/unit_tests/test_renalStructures_CECT_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def test_train_config(self, override):
sys.path.append(bundle_root)

trainer = ConfigWorkflow(
workflow="train",
workflow_type="train",
config_file=os.path.join(bundle_root, "configs/train.json"),
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -113,7 +113,7 @@ def test_eval_config(self, override):

validator = ConfigWorkflow(
# override train.json, thus set the workflow to "train" rather than "eval"
workflow="train",
workflow_type="train",
config_file=[train_file, eval_file],
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -127,7 +127,7 @@ def test_infer_config(self, override):
bundle_root = override["bundle_root"]

inferrer = ConfigWorkflow(
workflow="infer",
workflow_type="infer",
config_file=os.path.join(bundle_root, "configs/inference.json"),
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand Down
6 changes: 3 additions & 3 deletions ci/unit_tests/test_spleen_ct_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_train_eval_config(self, override):
eval_file = os.path.join(bundle_root, "configs/evaluate.json")

trainer = ConfigWorkflow(
workflow="train",
workflow_type="train",
config_file=train_file,
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -78,7 +78,7 @@ def test_train_eval_config(self, override):

validator = ConfigWorkflow(
# override train.json, thus set the workflow to "train" rather than "eval"
workflow="train",
workflow_type="train",
config_file=[train_file, eval_file],
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand All @@ -92,7 +92,7 @@ def test_infer_config(self, override):
bundle_root = override["bundle_root"]

inferrer = ConfigWorkflow(
workflow="infer",
workflow_type="infer",
config_file=os.path.join(bundle_root, "configs/inference.json"),
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
Expand Down
Loading
Loading