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
c8115260
Commit
c8115260
authored
Apr 24, 2020
by
Julien Chaumond
Browse files
[examples] For convenience, also save the tokenizer
Close #3921
parent
b0167632
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
0 deletions
+18
-0
examples/ner/run_ner.py
examples/ner/run_ner.py
+5
-0
examples/run_glue.py
examples/run_glue.py
+4
-0
examples/run_language_modeling.py
examples/run_language_modeling.py
+4
-0
examples/run_multiple_choice.py
examples/run_multiple_choice.py
+5
-0
No files found.
examples/ner/run_ner.py
View file @
c8115260
...
...
@@ -223,6 +223,11 @@ def main():
trainer
.
train
(
model_path
=
model_args
.
model_name_or_path
if
os
.
path
.
isdir
(
model_args
.
model_name_or_path
)
else
None
)
trainer
.
save_model
()
# For convenience, we also re-save the tokenizer to the same directory,
# so that you can share your model easily on huggingface.co/models =)
if
trainer
.
is_world_master
():
tokenizer
.
save_pretrained
(
training_args
.
output_dir
)
# Evaluation
results
=
{}
...
...
examples/run_glue.py
View file @
c8115260
...
...
@@ -164,6 +164,10 @@ def main():
model_path
=
model_args
.
model_name_or_path
if
os
.
path
.
isdir
(
model_args
.
model_name_or_path
)
else
None
)
trainer
.
save_model
()
# For convenience, we also re-save the tokenizer to the same directory,
# so that you can share your model easily on huggingface.co/models =)
if
trainer
.
is_world_master
():
tokenizer
.
save_pretrained
(
training_args
.
output_dir
)
# Evaluation
results
=
{}
...
...
examples/run_language_modeling.py
View file @
c8115260
...
...
@@ -253,6 +253,10 @@ def main():
)
trainer
.
train
(
model_path
=
model_path
)
trainer
.
save_model
()
# For convenience, we also re-save the tokenizer to the same directory,
# so that you can share your model easily on huggingface.co/models =)
if
trainer
.
is_world_master
():
tokenizer
.
save_pretrained
(
training_args
.
output_dir
)
# Evaluation
results
=
{}
...
...
examples/run_multiple_choice.py
View file @
c8115260
...
...
@@ -196,6 +196,11 @@ def main():
trainer
.
train
(
model_path
=
model_args
.
model_name_or_path
if
os
.
path
.
isdir
(
model_args
.
model_name_or_path
)
else
None
)
trainer
.
save_model
()
# For convenience, we also re-save the tokenizer to the same directory,
# so that you can share your model easily on huggingface.co/models =)
if
trainer
.
is_world_master
():
tokenizer
.
save_pretrained
(
training_args
.
output_dir
)
# Evaluation
results
=
{}
...
...
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