"docs/source/vscode:/vscode.git/clone" did not exist on "1124d95dbb1a3512d3e80791d73d0f541d1d7e9f"
Unverified Commit 054b6013 authored by elishowk's avatar elishowk Committed by GitHub
Browse files

separate model card git push from the rest (#13514)


Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
parent 9f318be3
...@@ -341,8 +341,8 @@ Add a model card ...@@ -341,8 +341,8 @@ Add a model card
To make sure everyone knows what your model can do, what its limitations, potential bias or ethical considerations are, To make sure everyone knows what your model can do, what its limitations, potential bias or ethical considerations are,
please add a README.md model card to your model repo. You can just create it, or there's also a convenient button please add a README.md model card to your model repo. You can just create it, or there's also a convenient button
titled "Add a README.md" on your model page. A model card template can be found `here titled "Add a README.md" on your model page. A model card documentation can be found `here
<https://github.com/huggingface/model_card>`__ (meta-suggestions are welcome). model card template (meta-suggestions <https://huggingface.co/docs/hub/model-repos>`__ (meta-suggestions are welcome). model card template (meta-suggestions
are welcome). are welcome).
.. note:: .. note::
......
...@@ -2625,7 +2625,6 @@ class Trainer: ...@@ -2625,7 +2625,6 @@ class Trainer:
model_name = Path(self.args.output_dir).name model_name = Path(self.args.output_dir).name
else: else:
model_name = self.args.hub_model_id.split("/")[-1] model_name = self.args.hub_model_id.split("/")[-1]
self.create_model_card(model_name=model_name, **kwargs)
# Needs to be executed on all processes for TPU training, but will only save on the processed determined by # Needs to be executed on all processes for TPU training, but will only save on the processed determined by
# self.args.should_save. # self.args.should_save.
self.save_model() self.save_model()
...@@ -2634,7 +2633,16 @@ class Trainer: ...@@ -2634,7 +2633,16 @@ class Trainer:
if not self.is_world_process_zero(): if not self.is_world_process_zero():
return return
return self.repo.push_to_hub(commit_message=commit_message, blocking=blocking) git_head_commit_url = self.repo.push_to_hub(commit_message=commit_message, blocking=blocking)
# push separately the model card to be independant from the rest of the model
if self.args.should_save:
self.create_model_card(model_name=model_name, **kwargs)
try:
self.repo.push_to_hub(commit_message="update model card README.md", blocking=blocking)
except EnvironmentError as exc:
logger.error(f"Error pushing update to the model card. Please read logs and retry.\n${exc}")
return git_head_commit_url
# #
# Deprecated code # Deprecated code
......
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