Unverified Commit 801ebd04 authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Add documentation of Trainer.create_model_card (#19110)

* Add documentation of Trainer.create_model_card

* Expand to TF version
parent 6227078d
...@@ -1601,6 +1601,33 @@ class TFPreTrainedModel(tf.keras.Model, TFModelUtilsMixin, TFGenerationMixin, Pu ...@@ -1601,6 +1601,33 @@ class TFPreTrainedModel(tf.keras.Model, TFModelUtilsMixin, TFGenerationMixin, Pu
dataset: Optional[Union[str, List[str]]] = None, dataset: Optional[Union[str, List[str]]] = None,
dataset_args: Optional[Union[str, List[str]]] = None, dataset_args: Optional[Union[str, List[str]]] = None,
): ):
"""
Creates a draft of a model card using the information available to the `Trainer`.
Args:
output_dir (`str` or `os.PathLike`):
The folder in which to create the model card.
model_name (`str`, *optional*):
The name of the model.
language (`str`, *optional*):
The language of the model (if applicable)
license (`str`, *optional*):
The license of the model. Will default to the license of the pretrained model used, if the original
model given to the `Trainer` comes from a repo on the Hub.
tags (`str` or `List[str]`, *optional*):
Some tags to be included in the metadata of the model card.
finetuned_from (`str`, *optional*):
The name of the model used to fine-tune this one (if applicable). Will default to the name of the repo
of the original model given to the `Trainer` (if it comes from the Hub).
tasks (`str` or `List[str]`, *optional*):
One or several task identifiers, to be included in the metadata of the model card.
dataset_tags (`str` or `List[str]`, *optional*):
One or several dataset tags, to be included in the metadata of the model card.
dataset (`str` or `List[str]`, *optional*):
One or several dataset identifiers, to be included in the metadata of the model card.
dataset_args (`str` or `List[str]`, *optional*):
One or several dataset arguments, to be included in the metadata of the model card.
"""
# Avoids a circular import by doing this when necessary. # Avoids a circular import by doing this when necessary.
from .modelcard import TrainingSummary # tests_ignore from .modelcard import TrainingSummary # tests_ignore
......
...@@ -3284,14 +3284,39 @@ class Trainer: ...@@ -3284,14 +3284,39 @@ class Trainer:
self, self,
language: Optional[str] = None, language: Optional[str] = None,
license: Optional[str] = None, license: Optional[str] = None,
tags: Optional[str] = None, tags: Union[str, List[str], None] = None,
model_name: Optional[str] = None, model_name: Optional[str] = None,
finetuned_from: Optional[str] = None, finetuned_from: Optional[str] = None,
tasks: Optional[str] = None, tasks: Union[str, List[str], None] = None,
dataset_tags: Optional[Union[str, List[str]]] = None, dataset_tags: Union[str, List[str], None] = None,
dataset: Optional[Union[str, List[str]]] = None, dataset: Union[str, List[str], None] = None,
dataset_args: Optional[Union[str, List[str]]] = None, dataset_args: Union[str, List[str], None] = None,
): ):
"""
Creates a draft of a model card using the information available to the `Trainer`.
Args:
language (`str`, *optional*):
The language of the model (if applicable)
license (`str`, *optional*):
The license of the model. Will default to the license of the pretrained model used, if the original
model given to the `Trainer` comes from a repo on the Hub.
tags (`str` or `List[str]`, *optional*):
Some tags to be included in the metadata of the model card.
model_name (`str`, *optional*):
The name of the model.
finetuned_from (`str`, *optional*):
The name of the model used to fine-tune this one (if applicable). Will default to the name of the repo
of the original model given to the `Trainer` (if it comes from the Hub).
tasks (`str` or `List[str]`, *optional*):
One or several task identifiers, to be included in the metadata of the model card.
dataset_tags (`str` or `List[str]`, *optional*):
One or several dataset tags, to be included in the metadata of the model card.
dataset (`str` or `List[str]`, *optional*):
One or several dataset identifiers, to be included in the metadata of the model card.
dataset_args (`str` or `List[str]`, *optional*):
One or several dataset arguments, to be included in the metadata of the model card.
"""
if not self.is_world_process_zero(): if not self.is_world_process_zero():
return return
......
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