Skip to content

Fix integration test in 24.10 #8480

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

Merged
merged 4 commits into from
Jun 13, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ disallow_incomplete_defs = True

[coverage:run]
concurrency = multiprocessing
source = .
source = monai
data_file = .coverage/.coverage
omit = setup.py

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_integration_classification_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
155 changes: 97 additions & 58 deletions tests/testing_data/integration_answers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -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,
],
},
},
]


Expand Down
Loading