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
a6609caf
Unverified
Commit
a6609caf
authored
Aug 16, 2023
by
Zach Mueller
Committed by
GitHub
Aug 16, 2023
Browse files
More frozen args (#25540)
parent
f61f072b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
src/transformers/trainer.py
src/transformers/trainer.py
+6
-0
No files found.
src/transformers/trainer.py
View file @
a6609caf
...
@@ -1165,6 +1165,8 @@ class Trainer:
...
@@ -1165,6 +1165,8 @@ class Trainer:
elif
self
.
hp_search_backend
==
HPSearchBackend
.
WANDB
:
elif
self
.
hp_search_backend
==
HPSearchBackend
.
WANDB
:
params
=
trial
params
=
trial
# Unfreeze args for hyperparameter search
delattr
(
self
.
args
,
"_frozen"
)
for
key
,
value
in
params
.
items
():
for
key
,
value
in
params
.
items
():
if
not
hasattr
(
self
.
args
,
key
):
if
not
hasattr
(
self
.
args
,
key
):
logger
.
warning
(
logger
.
warning
(
...
@@ -1176,6 +1178,7 @@ class Trainer:
...
@@ -1176,6 +1178,7 @@ class Trainer:
# Casting value to the proper type
# Casting value to the proper type
if
old_attr
is
not
None
:
if
old_attr
is
not
None
:
value
=
type
(
old_attr
)(
value
)
value
=
type
(
old_attr
)(
value
)
setattr
(
self
.
args
,
key
,
value
)
setattr
(
self
.
args
,
key
,
value
)
if
self
.
hp_search_backend
==
HPSearchBackend
.
OPTUNA
:
if
self
.
hp_search_backend
==
HPSearchBackend
.
OPTUNA
:
logger
.
info
(
f
"Trial:
{
trial
.
params
}
"
)
logger
.
info
(
f
"Trial:
{
trial
.
params
}
"
)
...
@@ -1194,6 +1197,9 @@ class Trainer:
...
@@ -1194,6 +1197,9 @@ class Trainer:
self
.
args
.
hf_deepspeed_config
=
HfTrainerDeepSpeedConfig
(
self
.
args
.
deepspeed
)
self
.
args
.
hf_deepspeed_config
=
HfTrainerDeepSpeedConfig
(
self
.
args
.
deepspeed
)
self
.
args
.
hf_deepspeed_config
.
trainer_config_process
(
self
.
args
)
self
.
args
.
hf_deepspeed_config
.
trainer_config_process
(
self
.
args
)
self
.
args
.
deepspeed_plugin
=
DeepSpeedPlugin
(
hf_ds_config
=
self
.
args
.
hf_deepspeed_config
)
self
.
args
.
deepspeed_plugin
=
DeepSpeedPlugin
(
hf_ds_config
=
self
.
args
.
hf_deepspeed_config
)
# Re-freeze them
setattr
(
self
.
args
,
"_frozen"
,
True
)
self
.
create_accelerator_and_postprocess
()
self
.
create_accelerator_and_postprocess
()
def
_report_to_hp_search
(
self
,
trial
:
Union
[
"optuna.Trial"
,
Dict
[
str
,
Any
]],
step
:
int
,
metrics
:
Dict
[
str
,
float
]):
def
_report_to_hp_search
(
self
,
trial
:
Union
[
"optuna.Trial"
,
Dict
[
str
,
Any
]],
step
:
int
,
metrics
:
Dict
[
str
,
float
]):
...
...
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