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
dfed4ec2
Unverified
Commit
dfed4ec2
authored
Apr 08, 2021
by
Sylvain Gugger
Committed by
GitHub
Apr 08, 2021
Browse files
Don't duplicate logs in TensorBoard and handle --use_env (#11141)
parent
9c9b8e70
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
src/transformers/integrations.py
src/transformers/integrations.py
+5
-3
src/transformers/training_args.py
src/transformers/training_args.py
+6
-0
No files found.
src/transformers/integrations.py
View file @
dfed4ec2
...
...
@@ -604,9 +604,11 @@ class TensorBoardCallback(TrainerCallback):
self
.
tb_writer
.
add_hparams
(
args
.
to_sanitized_dict
(),
metric_dict
=
{})
def
on_log
(
self
,
args
,
state
,
control
,
logs
=
None
,
**
kwargs
):
if
state
.
is_world_process_zero
:
if
self
.
tb_writer
is
None
:
self
.
_init_summary_writer
(
args
)
if
not
state
.
is_world_process_zero
:
return
if
self
.
tb_writer
is
None
:
self
.
_init_summary_writer
(
args
)
if
self
.
tb_writer
is
not
None
:
logs
=
rewrite_logs
(
logs
)
...
...
src/transformers/training_args.py
View file @
dfed4ec2
...
...
@@ -531,6 +531,12 @@ class TrainingArguments:
)
def
__post_init__
(
self
):
# Handle --use_env option in torch.distributed.launch (local_rank not passed as an arg then).
# This needs to happen before any call to self.device or self.n_gpu.
env_local_rank
=
int
(
os
.
environ
.
get
(
"LOCAL_RANK"
,
-
1
))
if
env_local_rank
!=
-
1
and
env_local_rank
!=
self
.
local_rank
:
self
.
local_rank
=
env_local_rank
# expand paths, if not os.makedirs("~/bar") will make directory
# in the current directory instead of the actual home
# see https://github.com/huggingface/transformers/issues/10628
...
...
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