Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
1be8d56e
Unverified
Commit
1be8d56e
authored
Apr 28, 2022
by
conan1024hao
Committed by
GitHub
Apr 28, 2022
Browse files
Add parameter --config_overrides for run_mlm_wwm.py (#16961)
* dd parameter --config_overrides for run_mlm_wwm.py * linter
parent
1f9e8625
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
examples/research_projects/mlm_wwm/run_mlm_wwm.py
examples/research_projects/mlm_wwm/run_mlm_wwm.py
+17
-0
No files found.
examples/research_projects/mlm_wwm/run_mlm_wwm.py
View file @
1be8d56e
...
...
@@ -69,6 +69,13 @@ class ModelArguments:
default
=
None
,
metadata
=
{
"help"
:
"If training from scratch, pass a model type from the list: "
+
", "
.
join
(
MODEL_TYPES
)},
)
config_overrides
:
Optional
[
str
]
=
field
(
default
=
None
,
metadata
=
{
"help"
:
"Override some existing default config settings when a model is trained from scratch. Example: "
"n_embd=10,resid_pdrop=0.2,scale_attn_weights=false,summary_type=cls_index"
},
)
config_name
:
Optional
[
str
]
=
field
(
default
=
None
,
metadata
=
{
"help"
:
"Pretrained config name or path if not the same as model_name"
}
)
...
...
@@ -95,6 +102,12 @@ class ModelArguments:
},
)
def
__post_init__
(
self
):
if
self
.
config_overrides
is
not
None
and
(
self
.
config_name
is
not
None
or
self
.
model_name_or_path
is
not
None
):
raise
ValueError
(
"--config_overrides can't be used in combination with --config_name or --model_name_or_path"
)
@
dataclass
class
DataTrainingArguments
:
...
...
@@ -275,6 +288,10 @@ def main():
else
:
config
=
CONFIG_MAPPING
[
model_args
.
model_type
]()
logger
.
warning
(
"You are instantiating a new config instance from scratch."
)
if
model_args
.
config_overrides
is
not
None
:
logger
.
info
(
f
"Overriding config:
{
model_args
.
config_overrides
}
"
)
config
.
update_from_string
(
model_args
.
config_overrides
)
logger
.
info
(
f
"New config:
{
config
}
"
)
tokenizer_kwargs
=
{
"cache_dir"
:
model_args
.
cache_dir
,
...
...
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