Skip to content

Commit eedadf6

Browse files
551 Fix premerge py version issue (Project-MONAI#552)
Fixes Project-MONAI#551 ### Description This PR does the following three changes: 1. fix the python version issue in permerge cpu test 2. update two bundles to support black 24.1 3. update weekly cpu test to enable new bundles tests ### Status **Ready** ### Please ensure all the checkboxes: <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Codeformat tests passed locally by running `./runtests.sh --codeformat`. - [ ] In-line docstrings updated. - [ ] Update `version` and `changelog` in `metadata.json` if changing an existing bundle. - [ ] Please ensure the naming rules in config files meet our requirements (please refer to: `CONTRIBUTING.md`). - [ ] Ensure versions of packages such as `monai`, `pytorch` and `numpy` are correct in `metadata.json`. - [ ] Descriptions should be consistent with the content, such as `eval_metrics` of the provided weights and TorchScript modules. - [ ] Files larger than 25MB are excluded and replaced by providing download links in `large_file.yml`. - [ ] Avoid using path that contains personal information within config files (such as use `/home/your_name/` for `"bundle_root"`). --------- Signed-off-by: Yiheng Wang <vennw@nvidia.com>
1 parent de59608 commit eedadf6

File tree

8 files changed

+19
-23
lines changed

8 files changed

+19
-23
lines changed

.github/workflows/premerge-cpu.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- uses: actions/checkout@v2
20-
- name: Set up Python 3.8
20+
- name: Set up Python 3.9
2121
uses: actions/setup-python@v2
2222
with:
23-
python-version: 3.8
23+
python-version: 3.9
2424
- name: cache weekly timestamp
2525
id: pip-cache
2626
run: |
@@ -34,8 +34,6 @@ jobs:
3434
- name: Install dependencies
3535
run: |
3636
python -m pip install --upgrade pip wheel
37-
python -m pip install -r requirements-dev.txt
38-
python -m pip install cffi && python -m pip install pipenv
3937
- name: check
4038
run: |
4139
# clean up temporary files

ci/get_bundle_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from utils import get_sub_folders
1616

1717
# new added bundles should temporarily be added to this list, and remove until they can be downloaded successfully
18-
EXCLUDE_LIST = ["segmentation_template", "classification_template"]
18+
EXCLUDE_LIST = []
1919

2020

2121
def main(models_path):

ci/run_premerge_cpu.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ elif [[ $# -gt 1 ]]; then
3030
fi
3131

3232
verify_bundle() {
33-
rm -rf /opt/hostedtoolcache
33+
for dir in /opt/hostedtoolcache/*; do
34+
if [[ $dir != "/opt/hostedtoolcache/Python" ]]; then
35+
rm -rf "$dir"
36+
fi
37+
done
3438
echo 'Run verify bundle...'
3539
pip install -r requirements.txt
3640
head_ref=$(git rev-parse HEAD)

ci/unit_tests/test_spleen_deepedit_annotation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ def test_infer_config(self, override):
124124
@parameterized.expand([TEST_CASE_2])
125125
def test_infer_click_config(self, override):
126126
override["dataset_dir"] = self.dataset_dir
127-
override[
128-
"dataset#data"
129-
] = "$[{'image': i, 'background': [], 'spleen': [[6, 6, 6], [8, 8, 8]]} for i in @datalist]"
127+
override["dataset#data"] = (
128+
"$[{'image': i, 'background': [], 'spleen': [[6, 6, 6], [8, 8, 8]]} for i in @datalist]"
129+
)
130130
bundle_root = override["bundle_root"]
131131
sys.path = [bundle_root] + sys.path
132132

models/renalStructures_UNEST_segmentation/configs/metadata.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20220324.json",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"changelog": {
5+
"0.2.4": "fix black 24.1 format error",
56
"0.2.3": "update AddChanneld with EnsureChannelFirstd and remove meta_dict",
67
"0.2.2": "add name tag",
78
"0.2.1": "fix license Copyright error",

models/renalStructures_UNEST_segmentation/scripts/networks/nest/utils.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ def drop_block_2d(
3737
total_size = w * h
3838
clipped_block_size = min(block_size, min(w, h))
3939
# seed_drop_rate, the gamma parameter
40-
gamma = (
41-
gamma_scale * drop_prob * total_size / clipped_block_size**2 / ((w - block_size + 1) * (h - block_size + 1))
42-
)
40+
gamma = gamma_scale * drop_prob * total_size / clipped_block_size**2 / ((w - block_size + 1) * (h - block_size + 1))
4341

4442
# Forces the block to be inside the feature map.
4543
w_i, h_i = torch.meshgrid(torch.arange(w).to(x.device), torch.arange(h).to(x.device))
@@ -89,9 +87,7 @@ def drop_block_fast_2d(
8987
b, c, h, w = x.shape
9088
total_size = w * h
9189
clipped_block_size = min(block_size, min(w, h))
92-
gamma = (
93-
gamma_scale * drop_prob * total_size / clipped_block_size**2 / ((w - block_size + 1) * (h - block_size + 1))
94-
)
90+
gamma = gamma_scale * drop_prob * total_size / clipped_block_size**2 / ((w - block_size + 1) * (h - block_size + 1))
9591

9692
block_mask = torch.empty_like(x).bernoulli_(gamma)
9793
block_mask = F.max_pool2d(

models/wholeBrainSeg_Large_UNEST_segmentation/configs/metadata.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20220324.json",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"changelog": {
5+
"0.2.4": "fix black 24.1 format error",
56
"0.2.3": "fix PYTHONPATH in readme.md",
67
"0.2.2": "add name tag",
78
"0.2.1": "fix license Copyright error",

models/wholeBrainSeg_Large_UNEST_segmentation/scripts/networks/nest/utils.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ def drop_block_2d(
3737
total_size = w * h
3838
clipped_block_size = min(block_size, min(w, h))
3939
# seed_drop_rate, the gamma parameter
40-
gamma = (
41-
gamma_scale * drop_prob * total_size / clipped_block_size**2 / ((w - block_size + 1) * (h - block_size + 1))
42-
)
40+
gamma = gamma_scale * drop_prob * total_size / clipped_block_size**2 / ((w - block_size + 1) * (h - block_size + 1))
4341

4442
# Forces the block to be inside the feature map.
4543
w_i, h_i = torch.meshgrid(torch.arange(w).to(x.device), torch.arange(h).to(x.device))
@@ -89,9 +87,7 @@ def drop_block_fast_2d(
8987
b, c, h, w = x.shape
9088
total_size = w * h
9189
clipped_block_size = min(block_size, min(w, h))
92-
gamma = (
93-
gamma_scale * drop_prob * total_size / clipped_block_size**2 / ((w - block_size + 1) * (h - block_size + 1))
94-
)
90+
gamma = gamma_scale * drop_prob * total_size / clipped_block_size**2 / ((w - block_size + 1) * (h - block_size + 1))
9591

9692
block_mask = torch.empty_like(x).bernoulli_(gamma)
9793
block_mask = F.max_pool2d(

0 commit comments

Comments
 (0)