From 9025295705861f9e332f4658a152c24535194ba2 Mon Sep 17 00:00:00 2001 From: YunLiu <55491388+KumoLiu@users.noreply.github.com> Date: Thu, 12 Jun 2025 17:26:05 +0800 Subject: [PATCH 1/3] fix #8479 Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> --- .../test_integration_classification_2d.py | 4 +- .../test_integration_workflows_adversarial.py | 2 +- tests/testing_data/integration_answers.py | 155 +++++++++++------- 3 files changed, 100 insertions(+), 61 deletions(-) diff --git a/tests/integration/test_integration_classification_2d.py b/tests/integration/test_integration_classification_2d.py index aecfa2efab..88351292b0 100644 --- a/tests/integration/test_integration_classification_2d.py +++ b/tests/integration/test_integration_classification_2d.py @@ -256,7 +256,7 @@ def train_and_infer(self, idx=0): # check training properties self.assertTrue(test_integration_value(TASK, key="losses", data=losses, rtol=1e-2)) self.assertTrue(test_integration_value(TASK, key="best_metric", data=best_metric, rtol=1e-4)) - np.testing.assert_allclose(best_metric_epoch, 4) + np.testing.assert_allclose(best_metric_epoch, 1) model_file = os.path.join(self.data_dir, "best_metric_model.pth") self.assertTrue(os.path.exists(model_file)) # check inference properties @@ -268,7 +268,7 @@ def train_and_infer(self, idx=0): def test_training(self): repeated = [] - for i in range(1): + for i in range(2): results = self.train_and_infer(i) repeated.append(results) np.testing.assert_allclose(repeated[0], repeated[1]) diff --git a/tests/integration/test_integration_workflows_adversarial.py b/tests/integration/test_integration_workflows_adversarial.py index 5badafcc41..febae9b46d 100644 --- a/tests/integration/test_integration_workflows_adversarial.py +++ b/tests/integration/test_integration_workflows_adversarial.py @@ -158,7 +158,7 @@ def tearDown(self): set_determinism(seed=None) shutil.rmtree(self.data_dir) - @TimedCall(seconds=200, daemon=False) + @TimedCall(seconds=300, daemon=False) def test_training(self): torch.manual_seed(0) diff --git a/tests/testing_data/integration_answers.py b/tests/testing_data/integration_answers.py index 1dbab8e544..7c6662c132 100644 --- a/tests/testing_data/integration_answers.py +++ b/tests/testing_data/integration_answers.py @@ -70,64 +70,6 @@ ], } }, - { # test answers for PyTorch 1.13 - "integration_workflows": { - "output_sums_2": [ - 0.14264830205979873, - 0.15264129328718357, - 0.1519652511118344, - 0.14003114557361543, - 0.18870416611118465, - 0.1699260498246968, - 0.14727475398203582, - 0.16870874483246967, - 0.15757932277023196, - 0.1797779694564011, - 0.16310501082450635, - 0.16850569170136015, - 0.14472958359864832, - 0.11402527744419455, - 0.16217657428257873, - 0.20135486560244975, - 0.17627557567092866, - 0.09802074024435596, - 0.19418729084978026, - 0.20339278025379662, - 0.1966174446916041, - 0.20872528599049203, - 0.16246183433492764, - 0.1323750751202327, - 0.14830347036335728, - 0.14300732028781024, - 0.23163101813922762, - 0.1612925258625139, - 0.1489573676973957, - 0.10299491921717041, - 0.11921404797064328, - 0.1300212751422368, - 0.11437829790254125, - 0.1524755276727056, - 0.16350584736767904, - 0.19424317961257148, - 0.2229762916892286, - 0.18121074825540173, - 0.19064286213535897, - 0.0747544243069024, - ] - }, - "integration_segmentation_3d": { # for the mixed readers - "losses": [ - 0.5451162219047546, - 0.4709601759910583, - 0.45201429128646853, - 0.4443251401185989, - 0.4341257899999619, - 0.4350819975137711, - ], - "best_metric": 0.9316844940185547, - "infer_metric": 0.9316383600234985, - }, - }, { # test answers for cuda 12 "integration_segmentation_3d": { "losses": [ @@ -296,6 +238,103 @@ ], } }, + { # test answers for 24.10 + "integration_classification_2d": { + "losses": 0.7806512035761669, + "best_metric": 0.9977695200407783, + "infer_prop": [805, 727, 955, 1033, 321, 993], + }, + "integration_workflows": { + "best_metric": 0.9207136034965515, + "best_metric_2": 0.9216295480728149, + "infer_metric": 0.920440673828125, + "infer_metric_2": 0.9203161001205444, + "output_sums": [ + 0.1423349380493164, + 0.15172767639160156, + 0.1382155418395996, + 0.13398218154907227, + 0.18552064895629883, + 0.16435527801513672, + 0.14128494262695312, + 0.16725540161132812, + 0.15690851211547852, + 0.17731285095214844, + 0.16189050674438477, + 0.16543960571289062, + 0.14431238174438477, + 0.11064529418945312, + 0.16129302978515625, + 0.1970067024230957, + 0.17503118515014648, + 0.053476810455322266, + 0.1914362907409668, + 0.2001795768737793, + 0.19636154174804688, + 0.2040243148803711, + 0.1606454849243164, + 0.13213014602661133, + 0.15132904052734375, + 0.1370987892150879, + 0.22805070877075195, + 0.16170072555541992, + 0.1477980613708496, + 0.10428047180175781, + 0.1195521354675293, + 0.13089942932128906, + 0.11238527297973633, + 0.15204906463623047, + 0.1603565216064453, + 0.19054937362670898, + 0.21789216995239258, + 0.17824840545654297, + 0.18654584884643555, + 0.03622245788574219, + ], + "output_sums_2": [ + 0.1423349380493164, + 0.15172767639160156, + 0.1382155418395996, + 0.13398218154907227, + 0.18552064895629883, + 0.16435527801513672, + 0.14128494262695312, + 0.16725540161132812, + 0.15690851211547852, + 0.17731285095214844, + 0.16189050674438477, + 0.16543960571289062, + 0.14431238174438477, + 0.11064529418945312, + 0.16129302978515625, + 0.1970067024230957, + 0.17503118515014648, + 0.053476810455322266, + 0.1914362907409668, + 0.2001795768737793, + 0.19636154174804688, + 0.2040243148803711, + 0.1606454849243164, + 0.13213014602661133, + 0.15132904052734375, + 0.1370987892150879, + 0.22805070877075195, + 0.16170072555541992, + 0.1477980613708496, + 0.10428047180175781, + 0.1195521354675293, + 0.13089942932128906, + 0.11238527297973633, + 0.15204906463623047, + 0.1603565216064453, + 0.19054937362670898, + 0.21789216995239258, + 0.17824840545654297, + 0.18654584884643555, + 0.03622245788574219, + ], + }, + }, ] From 15625a533d1f7b7c315e8f9b2f3d7e294b9e8e9e Mon Sep 17 00:00:00 2001 From: YunLiu <55491388+KumoLiu@users.noreply.github.com> Date: Thu, 12 Jun 2025 17:29:46 +0800 Subject: [PATCH 2/3] try fix coverage Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 0067ab5f40..46ba425fed 100644 --- a/setup.cfg +++ b/setup.cfg @@ -278,7 +278,7 @@ disallow_incomplete_defs = True [coverage:run] concurrency = multiprocessing -source = . +source = monai data_file = .coverage/.coverage omit = setup.py From 8a0e60b64b60f7c3d48b6b3c60623b987ed311c9 Mon Sep 17 00:00:00 2001 From: YunLiu <55491388+KumoLiu@users.noreply.github.com> Date: Thu, 12 Jun 2025 23:12:08 +0800 Subject: [PATCH 3/3] revert coverage config change Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 46ba425fed..0067ab5f40 100644 --- a/setup.cfg +++ b/setup.cfg @@ -278,7 +278,7 @@ disallow_incomplete_defs = True [coverage:run] concurrency = multiprocessing -source = monai +source = . data_file = .coverage/.coverage omit = setup.py