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
eb186bc1
Unverified
Commit
eb186bc1
authored
Oct 16, 2020
by
Sylvain Gugger
Committed by
GitHub
Oct 16, 2020
Browse files
Small fixes to HP search (#7839)
parent
d8ca57d2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
1 deletion
+2
-1
src/transformers/trainer.py
src/transformers/trainer.py
+1
-1
src/transformers/trainer_utils.py
src/transformers/trainer_utils.py
+1
-0
No files found.
src/transformers/trainer.py
View file @
eb186bc1
...
...
@@ -520,7 +520,7 @@ class Trainer:
):
if
self
.
hp_search_backend
is
None
or
trial
is
None
:
return
self
.
objective
=
self
.
compute_objective
(
metrics
)
self
.
objective
=
self
.
compute_objective
(
metrics
.
copy
()
)
if
self
.
hp_search_backend
==
HPSearchBackend
.
OPTUNA
:
trial
.
report
(
self
.
objective
,
epoch
)
if
trial
.
should_prune
():
...
...
src/transformers/trainer_utils.py
View file @
eb186bc1
...
...
@@ -112,6 +112,7 @@ def default_compute_objective(metrics: Dict[str, float]) -> float:
"""
loss
=
metrics
.
pop
(
"eval_loss"
,
None
)
_
=
metrics
.
pop
(
"epoch"
,
None
)
_
=
metrics
.
pop
(
"total_flos"
,
None
)
return
loss
if
len
(
metrics
)
==
0
else
sum
(
metrics
.
values
())
...
...
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