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
7d92009a
Unverified
Commit
7d92009a
authored
Jul 23, 2024
by
Deep Gandhi
Committed by
GitHub
Jul 23, 2024
Browse files
Added additional kwarg for successful running of optuna hyperparameter search (#31924)
Update integration_utils.py Added additional kwarg
parent
63700628
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
src/transformers/integrations/integration_utils.py
src/transformers/integrations/integration_utils.py
+2
-1
No files found.
src/transformers/integrations/integration_utils.py
View file @
7d92009a
...
...
@@ -252,10 +252,11 @@ def run_hp_search_optuna(trainer, n_trials: int, direction: str, **kwargs) -> Be
timeout
=
kwargs
.
pop
(
"timeout"
,
None
)
n_jobs
=
kwargs
.
pop
(
"n_jobs"
,
1
)
gc_after_trial
=
kwargs
.
pop
(
"gc_after_trial"
,
False
)
directions
=
direction
if
isinstance
(
direction
,
list
)
else
None
direction
=
None
if
directions
is
not
None
else
direction
study
=
optuna
.
create_study
(
direction
=
direction
,
directions
=
directions
,
**
kwargs
)
study
.
optimize
(
_objective
,
n_trials
=
n_trials
,
timeout
=
timeout
,
n_jobs
=
n_jobs
)
study
.
optimize
(
_objective
,
n_trials
=
n_trials
,
timeout
=
timeout
,
n_jobs
=
n_jobs
,
gc_after_trial
=
gc_after_trial
)
if
not
study
.
_is_multi_objective
():
best_trial
=
study
.
best_trial
return
BestRun
(
str
(
best_trial
.
number
),
best_trial
.
value
,
best_trial
.
params
)
...
...
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