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
c60bd4f0
"README.md" did not exist on "6935d377f60bb4a15e2c7047efafe553c10dba28"
Commit
c60bd4f0
authored
1 year ago
by
Daniel CARRON
Browse files
Options
Downloads
Patches
Plain Diff
Updated tests
parent
51efda26
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!4
Moved code to lightning
Pipeline
#72401
canceled
1 year ago
Stage: qa
Stage: test
Stage: doc
Stage: dist
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_cli.py
+45
-39
45 additions, 39 deletions
tests/test_cli.py
tests/test_summary.py
+3
-2
3 additions, 2 deletions
tests/test_summary.py
with
48 additions
and
41 deletions
tests/test_cli.py
+
45
−
39
View file @
c60bd4f0
...
@@ -195,14 +195,18 @@ def test_train_pasa_montgomery(temporary_basedir):
...
@@ -195,14 +195,18 @@ def test_train_pasa_montgomery(temporary_basedir):
_assert_exit_0
(
result
)
_assert_exit_0
(
result
)
assert
os
.
path
.
exists
(
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model_final_epoch.pt
h
"
)
os
.
path
.
join
(
output_folder
,
"
model_final_epoch.
ck
pt
"
)
)
)
assert
os
.
path
.
exists
(
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model_lowest_valid_loss.pt
h
"
)
os
.
path
.
join
(
output_folder
,
"
model_lowest_valid_loss.
ck
pt
"
)
)
)
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
last_checkpoint
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
constants.csv
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
constants.csv
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
trainlog.csv
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
logs_csv
"
,
"
version_0
"
,
"
metrics.csv
"
)
)
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
logs_tensorboard
"
,
"
version_0
"
)
)
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model_summary.txt
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model_summary.txt
"
))
keywords
=
{
keywords
=
{
...
@@ -210,10 +214,6 @@ def test_train_pasa_montgomery(temporary_basedir):
...
@@ -210,10 +214,6 @@ def test_train_pasa_montgomery(temporary_basedir):
r
"
^Found \(dedicated\)
'
__valid__
'
set for validation$
"
:
1
,
r
"
^Found \(dedicated\)
'
__valid__
'
set for validation$
"
:
1
,
r
"
^Continuing from epoch 0$
"
:
1
,
r
"
^Continuing from epoch 0$
"
:
1
,
r
"
^Saving model summary at.*$
"
:
1
,
r
"
^Saving model summary at.*$
"
:
1
,
r
"
^Model has.*$
"
:
1
,
r
"
^Saving checkpoint
"
:
2
,
r
"
^Total training time:
"
:
1
,
r
"
^Z-normalization with mean
"
:
1
,
}
}
buf
.
seek
(
0
)
buf
.
seek
(
0
)
logging_output
=
buf
.
read
()
logging_output
=
buf
.
read
()
...
@@ -247,13 +247,17 @@ def test_train_pasa_montgomery_from_checkpoint(temporary_basedir):
...
@@ -247,13 +247,17 @@ def test_train_pasa_montgomery_from_checkpoint(temporary_basedir):
)
)
_assert_exit_0
(
result0
)
_assert_exit_0
(
result0
)
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model_final_epoch.pt
h
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model_final_epoch.
ck
pt
"
))
assert
os
.
path
.
exists
(
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model_lowest_valid_loss.pt
h
"
)
os
.
path
.
join
(
output_folder
,
"
model_lowest_valid_loss.
ck
pt
"
)
)
)
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
last_checkpoint
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
constants.csv
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
constants.csv
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
trainlog.csv
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
logs_csv
"
,
"
version_0
"
,
"
metrics.csv
"
)
)
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
logs_tensorboard
"
,
"
version_0
"
)
)
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model_summary.txt
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model_summary.txt
"
))
with
stdout_logging
()
as
buf
:
with
stdout_logging
()
as
buf
:
...
@@ -272,25 +276,25 @@ def test_train_pasa_montgomery_from_checkpoint(temporary_basedir):
...
@@ -272,25 +276,25 @@ def test_train_pasa_montgomery_from_checkpoint(temporary_basedir):
_assert_exit_0
(
result
)
_assert_exit_0
(
result
)
assert
os
.
path
.
exists
(
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model_final_epoch.pt
h
"
)
os
.
path
.
join
(
output_folder
,
"
model_final_epoch.
ck
pt
"
)
)
)
assert
os
.
path
.
exists
(
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model_lowest_valid_loss.pt
h
"
)
os
.
path
.
join
(
output_folder
,
"
model_lowest_valid_loss.
ck
pt
"
)
)
)
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
last_checkpoint
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
constants.csv
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
constants.csv
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
trainlog.csv
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
logs_csv
"
,
"
version_0
"
,
"
metrics.csv
"
)
)
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
logs_tensorboard
"
,
"
version_0
"
)
)
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model_summary.txt
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model_summary.txt
"
))
keywords
=
{
keywords
=
{
r
"
^Found \(dedicated\)
'
__train__
'
set for training$
"
:
1
,
r
"
^Found \(dedicated\)
'
__train__
'
set for training$
"
:
1
,
r
"
^Found \(dedicated\)
'
__valid__
'
set for validation$
"
:
1
,
r
"
^Found \(dedicated\)
'
__valid__
'
set for validation$
"
:
1
,
r
"
^Continuing from epoch
1
$
"
:
1
,
r
"
^Continuing from epoch
0
$
"
:
1
,
r
"
^Saving model summary at.*$
"
:
1
,
r
"
^Saving model summary at.*$
"
:
1
,
r
"
^Model has.*$
"
:
1
,
r
"
^Found lowest validation loss from previous session.*$
"
:
1
,
r
"
^Total training time:
"
:
1
,
r
"
^Z-normalization with mean
"
:
1
,
}
}
buf
.
seek
(
0
)
buf
.
seek
(
0
)
logging_output
=
buf
.
read
()
logging_output
=
buf
.
read
()
...
@@ -302,10 +306,10 @@ def test_train_pasa_montgomery_from_checkpoint(temporary_basedir):
...
@@ -302,10 +306,10 @@ def test_train_pasa_montgomery_from_checkpoint(temporary_basedir):
f
"
instead of the expected
{
v
}
:
\n
Output:
\n
{
logging_output
}
"
f
"
instead of the expected
{
v
}
:
\n
Output:
\n
{
logging_output
}
"
)
)
extra_keyword
=
"
Saving checkpoint
"
#
extra_keyword = "Saving checkpoint"
assert
(
#
assert (
extra_keyword
in
logging_output
#
extra_keyword in logging_output
),
f
"
String
'
{
extra_keyword
}
'
did not appear at least once in the output:
\n
Output:
\n
{
logging_output
}
"
#
), f"String '{extra_keyword}' did not appear at least once in the output:\nOutput:\n{logging_output}"
@pytest.mark.skip_if_rc_var_not_set
(
"
datadir.montgomery
"
)
@pytest.mark.skip_if_rc_var_not_set
(
"
datadir.montgomery
"
)
...
@@ -513,14 +517,18 @@ def test_train_signstotb_montgomery_rs(temporary_basedir, datadir):
...
@@ -513,14 +517,18 @@ def test_train_signstotb_montgomery_rs(temporary_basedir, datadir):
_assert_exit_0
(
result
)
_assert_exit_0
(
result
)
assert
os
.
path
.
exists
(
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model_final_epoch.pt
h
"
)
os
.
path
.
join
(
output_folder
,
"
model_final_epoch.
ck
pt
"
)
)
)
assert
os
.
path
.
exists
(
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model_lowest_valid_loss.pt
h
"
)
os
.
path
.
join
(
output_folder
,
"
model_lowest_valid_loss.
ck
pt
"
)
)
)
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
last_checkpoint
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
constants.csv
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
constants.csv
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
trainlog.csv
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
logs_csv
"
,
"
version_0
"
,
"
metrics.csv
"
)
)
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
logs_tensorboard
"
,
"
version_0
"
)
)
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model_summary.txt
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model_summary.txt
"
))
keywords
=
{
keywords
=
{
...
@@ -528,9 +536,6 @@ def test_train_signstotb_montgomery_rs(temporary_basedir, datadir):
...
@@ -528,9 +536,6 @@ def test_train_signstotb_montgomery_rs(temporary_basedir, datadir):
r
"
^Found \(dedicated\)
'
__valid__
'
set for validation$
"
:
1
,
r
"
^Found \(dedicated\)
'
__valid__
'
set for validation$
"
:
1
,
r
"
^Continuing from epoch 0$
"
:
1
,
r
"
^Continuing from epoch 0$
"
:
1
,
r
"
^Saving model summary at.*$
"
:
1
,
r
"
^Saving model summary at.*$
"
:
1
,
r
"
^Model has.*$
"
:
1
,
r
"
^Saving checkpoint
"
:
2
,
r
"
^Total training time:
"
:
1
,
}
}
buf
.
seek
(
0
)
buf
.
seek
(
0
)
logging_output
=
buf
.
read
()
logging_output
=
buf
.
read
()
...
@@ -614,14 +619,18 @@ def test_train_logreg_montgomery_rs(temporary_basedir, datadir):
...
@@ -614,14 +619,18 @@ def test_train_logreg_montgomery_rs(temporary_basedir, datadir):
_assert_exit_0
(
result
)
_assert_exit_0
(
result
)
assert
os
.
path
.
exists
(
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model_final_epoch.pt
h
"
)
os
.
path
.
join
(
output_folder
,
"
model_final_epoch.
ck
pt
"
)
)
)
assert
os
.
path
.
exists
(
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model_lowest_valid_loss.pt
h
"
)
os
.
path
.
join
(
output_folder
,
"
model_lowest_valid_loss.
ck
pt
"
)
)
)
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
last_checkpoint
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
constants.csv
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
constants.csv
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
trainlog.csv
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
logs_csv
"
,
"
version_0
"
,
"
metrics.csv
"
)
)
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
logs_tensorboard
"
,
"
version_0
"
)
)
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model_summary.txt
"
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
output_folder
,
"
model_summary.txt
"
))
keywords
=
{
keywords
=
{
...
@@ -629,9 +638,6 @@ def test_train_logreg_montgomery_rs(temporary_basedir, datadir):
...
@@ -629,9 +638,6 @@ def test_train_logreg_montgomery_rs(temporary_basedir, datadir):
r
"
^Found \(dedicated\)
'
__valid__
'
set for validation$
"
:
1
,
r
"
^Found \(dedicated\)
'
__valid__
'
set for validation$
"
:
1
,
r
"
^Continuing from epoch 0$
"
:
1
,
r
"
^Continuing from epoch 0$
"
:
1
,
r
"
^Saving model summary at.*$
"
:
1
,
r
"
^Saving model summary at.*$
"
:
1
,
r
"
^Model has.*$
"
:
1
,
r
"
^Saving checkpoint
"
:
2
,
r
"
^Total training time:
"
:
1
,
}
}
buf
.
seek
(
0
)
buf
.
seek
(
0
)
logging_output
=
buf
.
read
()
logging_output
=
buf
.
read
()
...
...
This diff is collapsed.
Click to expand it.
tests/test_summary.py
+
3
−
2
View file @
c60bd4f0
...
@@ -4,7 +4,8 @@
...
@@ -4,7 +4,8 @@
import
unittest
import
unittest
from
ptbench.models.pasa
import
build_pasa
import
ptbench.configs.models.pasa
as
pasa_config
from
ptbench.utils.summary
import
summary
from
ptbench.utils.summary
import
summary
...
@@ -12,7 +13,7 @@ class Tester(unittest.TestCase):
...
@@ -12,7 +13,7 @@ class Tester(unittest.TestCase):
"""
Unit test for model architectures.
"""
"""
Unit test for model architectures.
"""
def
test_summary_driu
(
self
):
def
test_summary_driu
(
self
):
model
=
build_pasa
()
model
=
pasa_config
.
model
s
,
param
=
summary
(
model
)
s
,
param
=
summary
(
model
)
self
.
assertIsInstance
(
s
,
str
)
self
.
assertIsInstance
(
s
,
str
)
self
.
assertIsInstance
(
param
,
int
)
self
.
assertIsInstance
(
param
,
int
)
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