Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mednet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
medai
software
mednet
Commits
2ff36c7b
Commit
2ff36c7b
authored
1 year ago
by
Daniel CARRON
Browse files
Options
Downloads
Patches
Plain Diff
[tests] Add tests for experiment
parent
2b40fbd6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!18
Update tests
,
!16
Make square centre-padding a model transform
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_cli.py
+64
-0
64 additions, 0 deletions
tests/test_cli.py
with
64 additions
and
0 deletions
tests/test_cli.py
+
64
−
0
View file @
2ff36c7b
...
@@ -436,6 +436,70 @@ def test_evaluate_pasa_montgomery(temporary_basedir):
...
@@ -436,6 +436,70 @@ def test_evaluate_pasa_montgomery(temporary_basedir):
)
)
@pytest.mark.skip_if_rc_var_not_set
(
"
datadir.montgomery
"
)
def
test_experiment
(
temporary_basedir
):
from
mednet.scripts.experiment
import
experiment
runner
=
CliRunner
()
output_folder
=
str
(
temporary_basedir
/
"
experiment
"
)
num_epochs
=
2
result
=
runner
.
invoke
(
experiment
,
[
"
-vv
"
,
"
pasa
"
,
"
montgomery
"
,
f
"
--epochs=
{
num_epochs
}
"
,
f
"
--output-folder=
{
output_folder
}
"
,
],
)
_assert_exit_0
(
result
)
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
command.sh
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
predictions.json
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model
"
,
"
command.sh
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model
"
,
"
constants.csv
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model
"
,
f
"
model-at-epoch=
{
num_epochs
-
1
}
.ckpt
"
)
)
# Need to glob because we cannot be sure of the checkpoint with lowest validation loss
assert
(
len
(
glob
.
glob
(
os
.
path
.
join
(
output_folder
,
"
model
"
,
"
model-at-lowest-validation-loss-epoch=*.ckpt
"
,
)
)
)
==
1
)
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model
"
,
"
model-summary.txt
"
)
)
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model
"
,
"
trainlog.pdf
"
))
assert
(
len
(
glob
.
glob
(
os
.
path
.
join
(
output_folder
,
"
model
"
,
"
logs
"
,
"
events.out.tfevents.*
"
)
)
)
==
1
)
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
evaluation
"
,
"
plots.pdf
"
)
)
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
evaluation
"
,
"
summary.rst
"
)
)
# This script does not work anymore, either fix or remove the script + this test
# This script does not work anymore, either fix or remove the script + this test
# def test_evaluatevis(temporary_basedir):
# def test_evaluatevis(temporary_basedir):
# import pandas as pd
# import pandas as pd
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment