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
858b1d1e
Commit
858b1d1e
authored
Apr 27, 2020
by
jaymody
Committed by
Julien Chaumond
May 04, 2020
Browse files
allow an already created tensorboard SummaryWriter be passed to Trainer
parent
8e67573a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
src/transformers/trainer.py
src/transformers/trainer.py
+4
-1
No files found.
src/transformers/trainer.py
View file @
858b1d1e
...
...
@@ -123,6 +123,7 @@ class Trainer:
eval_dataset
:
Optional
[
Dataset
]
=
None
,
compute_metrics
:
Optional
[
Callable
[[
EvalPrediction
],
Dict
]]
=
None
,
prediction_loss_only
=
False
,
tb_writer
:
Optional
[
"SummaryWriter"
]
=
None
,
):
"""
Trainer is a simple but feature-complete training and eval loop for PyTorch,
...
...
@@ -142,7 +143,9 @@ class Trainer:
self
.
eval_dataset
=
eval_dataset
self
.
compute_metrics
=
compute_metrics
self
.
prediction_loss_only
=
prediction_loss_only
if
is_tensorboard_available
()
and
self
.
args
.
local_rank
in
[
-
1
,
0
]:
if
tb_writer
is
not
None
:
self
.
tb_writer
=
tb_writer
elif
is_tensorboard_available
()
and
self
.
args
.
local_rank
in
[
-
1
,
0
]:
self
.
tb_writer
=
SummaryWriter
(
log_dir
=
self
.
args
.
logging_dir
)
if
not
is_tensorboard_available
():
logger
.
warning
(
...
...
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