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
0b8acd2b
Unverified
Commit
0b8acd2b
authored
Oct 29, 2020
by
Wang Xinjiang
Committed by
GitHub
Oct 29, 2020
Browse files
Use config_file to get config dict in PaviLogger (#630)
* Add 'config' keyword in meta for pavi logger * Use config file
parent
f4de390b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
10 deletions
+23
-10
mmcv/runner/hooks/logger/pavi.py
mmcv/runner/hooks/logger/pavi.py
+23
-10
No files found.
mmcv/runner/hooks/logger/pavi.py
View file @
0b8acd2b
...
@@ -41,16 +41,29 @@ class PaviLoggerHook(LoggerHook):
...
@@ -41,16 +41,29 @@ class PaviLoggerHook(LoggerHook):
self
.
init_kwargs
=
dict
()
self
.
init_kwargs
=
dict
()
self
.
init_kwargs
[
'task'
]
=
self
.
run_name
self
.
init_kwargs
[
'task'
]
=
self
.
run_name
self
.
init_kwargs
[
'model'
]
=
runner
.
_model_name
self
.
init_kwargs
[
'model'
]
=
runner
.
_model_name
if
runner
.
meta
is
not
None
and
'config_dict'
in
runner
.
meta
:
if
runner
.
meta
is
not
None
:
config_dict
=
runner
.
meta
[
'config_dict'
].
copy
()
if
'config_dict'
in
runner
.
meta
:
# 'max_.*iter' is parsed in pavi sdk as the maximum iterations
config_dict
=
runner
.
meta
[
'config_dict'
]
# to properly set up the progress bar.
assert
isinstance
(
config_dict
.
setdefault
(
'max_iter'
,
runner
.
max_iters
)
config_dict
,
# non-serializable values are first converted in mmcv.dump to json
dict
),
(
'meta["config_dict"] has to be of a dict, '
config_dict
=
json
.
loads
(
f
'but got
{
type
(
config_dict
)
}
'
)
mmcv
.
dump
(
config_dict
,
file_format
=
'json'
))
elif
'config_file'
in
runner
.
meta
:
session_text
=
yaml
.
dump
(
config_dict
)
config_file
=
runner
.
meta
[
'config_file'
]
self
.
init_kwargs
[
'session_text'
]
=
session_text
config_dict
=
dict
(
mmcv
.
Config
.
fromfile
(
config_file
))
else
:
config_dict
=
None
if
config_dict
is
not
None
:
# 'max_.*iter' is parsed in pavi sdk as the maximum iterations
# to properly set up the progress bar.
config_dict
=
config_dict
.
copy
()
config_dict
.
setdefault
(
'max_iter'
,
runner
.
max_iters
)
# non-serializable values are first converted in
# mmcv.dump to json
config_dict
=
json
.
loads
(
mmcv
.
dump
(
config_dict
,
file_format
=
'json'
))
session_text
=
yaml
.
dump
(
config_dict
)
self
.
init_kwargs
[
'session_text'
]
=
session_text
self
.
writer
=
SummaryWriter
(
**
self
.
init_kwargs
)
self
.
writer
=
SummaryWriter
(
**
self
.
init_kwargs
)
if
self
.
add_graph
:
if
self
.
add_graph
:
...
...
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