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
OpenDAS
MMCV
Commits
1263c91e
Commit
1263c91e
authored
Apr 06, 2019
by
Cao Yuhang
Committed by
Kai Chen
Apr 05, 2019
Browse files
add memory statistic (#41)
* add memory statistic * fix import order and cuda check
parent
a0ce998e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
mmcv/runner/hooks/logger/text.py
mmcv/runner/hooks/logger/text.py
+7
-0
No files found.
mmcv/runner/hooks/logger/text.py
View file @
1263c91e
import
datetime
import
torch
from
.base
import
LoggerHook
...
...
@@ -41,5 +43,10 @@ class TextLoggerHook(LoggerHook):
if
isinstance
(
val
,
float
):
val
=
'{:.4f}'
.
format
(
val
)
log_items
.
append
(
'{}: {}'
.
format
(
name
,
val
))
# statistic memory
if
runner
.
mode
==
'train'
and
torch
.
cuda
.
is_available
():
mem
=
torch
.
cuda
.
max_memory_allocated
()
mem_mb
=
int
(
mem
/
(
1024
*
1024
))
log_items
.
append
(
'{}: {}'
.
format
(
'memory'
,
mem_mb
))
log_str
+=
', '
.
join
(
log_items
)
runner
.
logger
.
info
(
log_str
)
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