mirror of
https://github.com/saymrwulf/transformers.git
synced 2026-05-14 20:58:08 +00:00
Add documentation of Trainer.create_model_card (#19110)
* Add documentation of Trainer.create_model_card * Expand to TF version
This commit is contained in:
parent
6227078d0a
commit
801ebd045d
2 changed files with 57 additions and 5 deletions
|
|
@ -1601,6 +1601,33 @@ class TFPreTrainedModel(tf.keras.Model, TFModelUtilsMixin, TFGenerationMixin, Pu
|
|||
dataset: 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.
|
||||
from .modelcard import TrainingSummary # tests_ignore
|
||||
|
||||
|
|
|
|||
|
|
@ -3284,14 +3284,39 @@ class Trainer:
|
|||
self,
|
||||
language: Optional[str] = None,
|
||||
license: Optional[str] = None,
|
||||
tags: Optional[str] = None,
|
||||
tags: Union[str, List[str], None] = None,
|
||||
model_name: Optional[str] = None,
|
||||
finetuned_from: Optional[str] = None,
|
||||
tasks: Optional[str] = None,
|
||||
dataset_tags: Optional[Union[str, List[str]]] = None,
|
||||
dataset: Optional[Union[str, List[str]]] = None,
|
||||
dataset_args: Optional[Union[str, List[str]]] = None,
|
||||
tasks: Union[str, List[str], None] = None,
|
||||
dataset_tags: Union[str, List[str], None] = None,
|
||||
dataset: Union[str, List[str], None] = 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():
|
||||
return
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue