Commit c8115260 authored by Julien Chaumond's avatar Julien Chaumond
Browse files

[examples] For convenience, also save the tokenizer

Close #3921
parent b0167632
...@@ -223,6 +223,11 @@ def main(): ...@@ -223,6 +223,11 @@ def main():
trainer.train( trainer.train(
model_path=model_args.model_name_or_path if os.path.isdir(model_args.model_name_or_path) else None 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 # Evaluation
results = {} results = {}
......
...@@ -164,6 +164,10 @@ def main(): ...@@ -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 model_path=model_args.model_name_or_path if os.path.isdir(model_args.model_name_or_path) else None
) )
trainer.save_model() 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 # Evaluation
results = {} results = {}
......
...@@ -253,6 +253,10 @@ def main(): ...@@ -253,6 +253,10 @@ def main():
) )
trainer.train(model_path=model_path) trainer.train(model_path=model_path)
trainer.save_model() 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 # Evaluation
results = {} results = {}
......
...@@ -196,6 +196,11 @@ def main(): ...@@ -196,6 +196,11 @@ def main():
trainer.train( trainer.train(
model_path=model_args.model_name_or_path if os.path.isdir(model_args.model_name_or_path) else None 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 # Evaluation
results = {} results = {}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment