Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
6da129cb
Unverified
Commit
6da129cb
authored
May 25, 2021
by
Lysandre Debut
Committed by
GitHub
May 25, 2021
Browse files
Enable memory metrics in tests that need it (#11859)
parent
db0b2477
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
tests/test_trainer.py
tests/test_trainer.py
+3
-3
No files found.
tests/test_trainer.py
View file @
6da129cb
...
...
@@ -1102,7 +1102,7 @@ class TrainerIntegrationTest(TestCasePlus, TrainerIntegrationCommon):
def
test_mem_metrics
(
self
):
# with mem metrics enabled
trainer
=
get_regression_trainer
()
trainer
=
get_regression_trainer
(
skip_memory_metrics
=
False
)
self
.
check_mem_metrics
(
trainer
,
self
.
assertIn
)
# with mem metrics disabled
...
...
@@ -1123,7 +1123,7 @@ class TrainerIntegrationTest(TestCasePlus, TrainerIntegrationCommon):
b
=
torch
.
ones
(
1000
,
bs
)
-
0.001
# 1. with mem metrics enabled
trainer
=
get_regression_trainer
(
a
=
a
,
b
=
b
,
eval_len
=
16
)
trainer
=
get_regression_trainer
(
a
=
a
,
b
=
b
,
eval_len
=
16
,
skip_memory_metrics
=
False
)
metrics
=
trainer
.
evaluate
()
del
trainer
gc
.
collect
()
...
...
@@ -1144,7 +1144,7 @@ class TrainerIntegrationTest(TestCasePlus, TrainerIntegrationCommon):
self
.
assertLess
(
fp32_eval
,
5_000
)
# 2. with mem metrics disabled
trainer
=
get_regression_trainer
(
a
=
a
,
b
=
b
,
eval_len
=
16
,
fp16_full_eval
=
True
)
trainer
=
get_regression_trainer
(
a
=
a
,
b
=
b
,
eval_len
=
16
,
fp16_full_eval
=
True
,
skip_memory_metrics
=
False
)
metrics
=
trainer
.
evaluate
()
fp16_init
=
metrics
[
"init_mem_gpu_alloc_delta"
]
fp16_eval
=
metrics
[
"eval_mem_gpu_alloc_delta"
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment