Unverified Commit cf450b77 authored by Matt's avatar Matt Committed by GitHub
Browse files

Fix TF start docstrings (#18991)

* Update our TF 2.0 input format tip across all models

* make style
parent adbf3a40
...@@ -694,23 +694,28 @@ ALBERT_START_DOCSTRING = r""" ...@@ -694,23 +694,28 @@ ALBERT_START_DOCSTRING = r"""
<Tip> <Tip>
TF 2.0 models accepts two formats as inputs: TensorFlow models and layers in `transformers` accept two formats as input:
- having all inputs as keyword arguments (like PyTorch models), or - having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments. - having all inputs as a list, tuple or dict in the first positional argument.
This second option is useful when using [`tf.keras.Model.fit`] method which currently requires having all the The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
tensors in the first argument of the model call function: `model(inputs)`. and layers. Because of this support, when using methods like `model.fit()` things should "just work" for you - just
pass your inputs and labels in any format that `model.fit()` supports! If, however, you want to use the second
format outside of Keras methods like `fit()` and `predict()`, such as when creating your own layers or models with
the Keras `Functional` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:
If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the - a single Tensor with `input_ids` only and nothing else: `model(input_ids)`
first positional argument :
- a single Tensor with `input_ids` only and nothing else: `model(inputs_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: - a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])` `model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])`
- a dictionary with one or several input Tensors associated to the input names given in the docstring: - a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model({"input_ids": input_ids, "token_type_ids": token_type_ids})` `model({"input_ids": input_ids, "token_type_ids": token_type_ids})`
Note that when creating models and layers with
[subclassing](https://keras.io/guides/making_new_layers_and_models_via_subclassing/) then you don't need to worry
about any of this, as you can just pass inputs like you would to any other Python function!
</Tip> </Tip>
Args: Args:
......
...@@ -514,16 +514,17 @@ BART_START_DOCSTRING = r""" ...@@ -514,16 +514,17 @@ BART_START_DOCSTRING = r"""
<Tip> <Tip>
TF 2.0 models accepts two formats as inputs: TensorFlow models and layers in `transformers` accept two formats as input:
- having all inputs as keyword arguments (like PyTorch models), or - having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments. - having all inputs as a list, tuple or dict in the first positional argument.
This second option is useful when using [`tf.keras.Model.fit`] method which currently requires having all the The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
tensors in the first argument of the model call function: `model(inputs)`. and layers. Because of this support, when using methods like `model.fit()` things should "just work" for you - just
pass your inputs and labels in any format that `model.fit()` supports! If, however, you want to use the second
If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the format outside of Keras methods like `fit()` and `predict()`, such as when creating your own layers or models with
first positional argument : the Keras `Functional` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:
- a single Tensor with `input_ids` only and nothing else: `model(input_ids)` - a single Tensor with `input_ids` only and nothing else: `model(input_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: - a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
...@@ -531,6 +532,10 @@ BART_START_DOCSTRING = r""" ...@@ -531,6 +532,10 @@ BART_START_DOCSTRING = r"""
- a dictionary with one or several input Tensors associated to the input names given in the docstring: - a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model({"input_ids": input_ids, "token_type_ids": token_type_ids})` `model({"input_ids": input_ids, "token_type_ids": token_type_ids})`
Note that when creating models and layers with
[subclassing](https://keras.io/guides/making_new_layers_and_models_via_subclassing/) then you don't need to worry
about any of this, as you can just pass inputs like you would to any other Python function!
</Tip> </Tip>
Args: Args:
......
...@@ -964,23 +964,28 @@ BERT_START_DOCSTRING = r""" ...@@ -964,23 +964,28 @@ BERT_START_DOCSTRING = r"""
<Tip> <Tip>
TF 2.0 models accepts two formats as inputs: TensorFlow models and layers in `transformers` accept two formats as input:
- having all inputs as keyword arguments (like PyTorch models), or - having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments. - having all inputs as a list, tuple or dict in the first positional argument.
This second option is useful when using [`tf.keras.Model.fit`] method which currently requires having all the The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
tensors in the first argument of the model call function: `model(inputs)`. and layers. Because of this support, when using methods like `model.fit()` things should "just work" for you - just
pass your inputs and labels in any format that `model.fit()` supports! If, however, you want to use the second
format outside of Keras methods like `fit()` and `predict()`, such as when creating your own layers or models with
the Keras `Functional` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:
If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the - a single Tensor with `input_ids` only and nothing else: `model(input_ids)`
first positional argument :
- a single Tensor with `input_ids` only and nothing else: `model(inputs_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: - a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])` `model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])`
- a dictionary with one or several input Tensors associated to the input names given in the docstring: - a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model({"input_ids": input_ids, "token_type_ids": token_type_ids})` `model({"input_ids": input_ids, "token_type_ids": token_type_ids})`
Note that when creating models and layers with
[subclassing](https://keras.io/guides/making_new_layers_and_models_via_subclassing/) then you don't need to worry
about any of this, as you can just pass inputs like you would to any other Python function!
</Tip> </Tip>
Args: Args:
......
...@@ -514,16 +514,17 @@ BLENDERBOT_START_DOCSTRING = r""" ...@@ -514,16 +514,17 @@ BLENDERBOT_START_DOCSTRING = r"""
<Tip> <Tip>
TF 2.0 models accepts two formats as inputs: TensorFlow models and layers in `transformers` accept two formats as input:
- having all inputs as keyword arguments (like PyTorch models), or - having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments. - having all inputs as a list, tuple or dict in the first positional argument.
This second option is useful when using [`tf.keras.Model.fit`] method which currently requires having all the The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
tensors in the first argument of the model call function: `model(inputs)`. and layers. Because of this support, when using methods like `model.fit()` things should "just work" for you - just
pass your inputs and labels in any format that `model.fit()` supports! If, however, you want to use the second
If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the format outside of Keras methods like `fit()` and `predict()`, such as when creating your own layers or models with
first positional argument : the Keras `Functional` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:
- a single Tensor with `input_ids` only and nothing else: `model(input_ids)` - a single Tensor with `input_ids` only and nothing else: `model(input_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: - a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
...@@ -531,6 +532,10 @@ BLENDERBOT_START_DOCSTRING = r""" ...@@ -531,6 +532,10 @@ BLENDERBOT_START_DOCSTRING = r"""
- a dictionary with one or several input Tensors associated to the input names given in the docstring: - a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model({"input_ids": input_ids, "token_type_ids": token_type_ids})` `model({"input_ids": input_ids, "token_type_ids": token_type_ids})`
Note that when creating models and layers with
[subclassing](https://keras.io/guides/making_new_layers_and_models_via_subclassing/) then you don't need to worry
about any of this, as you can just pass inputs like you would to any other Python function!
</Tip> </Tip>
Args: Args:
......
...@@ -514,16 +514,17 @@ BLENDERBOT_SMALL_START_DOCSTRING = r""" ...@@ -514,16 +514,17 @@ BLENDERBOT_SMALL_START_DOCSTRING = r"""
<Tip> <Tip>
TF 2.0 models accepts two formats as inputs: TensorFlow models and layers in `transformers` accept two formats as input:
- having all inputs as keyword arguments (like PyTorch models), or - having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments. - having all inputs as a list, tuple or dict in the first positional argument.
This second option is useful when using [`tf.keras.Model.fit`] method which currently requires having all the The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
tensors in the first argument of the model call function: `model(inputs)`. and layers. Because of this support, when using methods like `model.fit()` things should "just work" for you - just
pass your inputs and labels in any format that `model.fit()` supports! If, however, you want to use the second
If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the format outside of Keras methods like `fit()` and `predict()`, such as when creating your own layers or models with
first positional argument : the Keras `Functional` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:
- a single Tensor with `input_ids` only and nothing else: `model(input_ids)` - a single Tensor with `input_ids` only and nothing else: `model(input_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: - a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
...@@ -531,6 +532,10 @@ BLENDERBOT_SMALL_START_DOCSTRING = r""" ...@@ -531,6 +532,10 @@ BLENDERBOT_SMALL_START_DOCSTRING = r"""
- a dictionary with one or several input Tensors associated to the input names given in the docstring: - a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model({"input_ids": input_ids, "token_type_ids": token_type_ids})` `model({"input_ids": input_ids, "token_type_ids": token_type_ids})`
Note that when creating models and layers with
[subclassing](https://keras.io/guides/making_new_layers_and_models_via_subclassing/) then you don't need to worry
about any of this, as you can just pass inputs like you would to any other Python function!
</Tip> </Tip>
Args: Args:
......
...@@ -47,23 +47,28 @@ CAMEMBERT_START_DOCSTRING = r""" ...@@ -47,23 +47,28 @@ CAMEMBERT_START_DOCSTRING = r"""
<Tip> <Tip>
TF 2.0 models accepts two formats as inputs: TensorFlow models and layers in `transformers` accept two formats as input:
- having all inputs as keyword arguments (like PyTorch models), or - having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments. - having all inputs as a list, tuple or dict in the first positional argument.
This second option is useful when using [`tf.keras.Model.fit`] method which currently requires having all the The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
tensors in the first argument of the model call function: `model(inputs)`. and layers. Because of this support, when using methods like `model.fit()` things should "just work" for you - just
pass your inputs and labels in any format that `model.fit()` supports! If, however, you want to use the second
format outside of Keras methods like `fit()` and `predict()`, such as when creating your own layers or models with
the Keras `Functional` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:
If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the - a single Tensor with `input_ids` only and nothing else: `model(input_ids)`
first positional argument :
- a single Tensor with `input_ids` only and nothing else: `model(inputs_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: - a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])` `model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])`
- a dictionary with one or several input Tensors associated to the input names given in the docstring: - a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model({"input_ids": input_ids, "token_type_ids": token_type_ids})` `model({"input_ids": input_ids, "token_type_ids": token_type_ids})`
Note that when creating models and layers with
[subclassing](https://keras.io/guides/making_new_layers_and_models_via_subclassing/) then you don't need to worry
about any of this, as you can just pass inputs like you would to any other Python function!
</Tip> </Tip>
Parameters: Parameters:
......
...@@ -913,16 +913,17 @@ CLIP_START_DOCSTRING = r""" ...@@ -913,16 +913,17 @@ CLIP_START_DOCSTRING = r"""
<Tip> <Tip>
TF 2.0 models accepts two formats as inputs: TensorFlow models and layers in `transformers` accept two formats as input:
- having all inputs as keyword arguments (like PyTorch models), or - having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments. - having all inputs as a list, tuple or dict in the first positional argument.
This second option is useful when using [`tf.keras.Model.fit`] method which currently requires having all the The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
tensors in the first argument of the model call function: `model(inputs)`. and layers. Because of this support, when using methods like `model.fit()` things should "just work" for you - just
pass your inputs and labels in any format that `model.fit()` supports! If, however, you want to use the second
If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the format outside of Keras methods like `fit()` and `predict()`, such as when creating your own layers or models with
first positional argument : the Keras `Functional` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:
- a single Tensor with `input_ids` only and nothing else: `model(input_ids)` - a single Tensor with `input_ids` only and nothing else: `model(input_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: - a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
...@@ -930,6 +931,10 @@ CLIP_START_DOCSTRING = r""" ...@@ -930,6 +931,10 @@ CLIP_START_DOCSTRING = r"""
- a dictionary with one or several input Tensors associated to the input names given in the docstring: - a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model({"input_ids": input_ids, "token_type_ids": token_type_ids})` `model({"input_ids": input_ids, "token_type_ids": token_type_ids})`
Note that when creating models and layers with
[subclassing](https://keras.io/guides/making_new_layers_and_models_via_subclassing/) then you don't need to worry
about any of this, as you can just pass inputs like you would to any other Python function!
</Tip> </Tip>
Args: Args:
......
...@@ -638,23 +638,28 @@ CONVBERT_START_DOCSTRING = r""" ...@@ -638,23 +638,28 @@ CONVBERT_START_DOCSTRING = r"""
<Tip> <Tip>
TF 2.0 models accepts two formats as inputs: TensorFlow models and layers in `transformers` accept two formats as input:
- having all inputs as keyword arguments (like PyTorch models), or - having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments. - having all inputs as a list, tuple or dict in the first positional argument.
This second option is useful when using [`tf.keras.Model.fit`] method which currently requires having all the The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
tensors in the first argument of the model call function: `model(inputs)`. and layers. Because of this support, when using methods like `model.fit()` things should "just work" for you - just
pass your inputs and labels in any format that `model.fit()` supports! If, however, you want to use the second
format outside of Keras methods like `fit()` and `predict()`, such as when creating your own layers or models with
the Keras `Functional` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:
If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the - a single Tensor with `input_ids` only and nothing else: `model(input_ids)`
first positional argument :
- a single Tensor with `input_ids` only and nothing else: `model(inputs_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: - a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])` `model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])`
- a dictionary with one or several input Tensors associated to the input names given in the docstring: - a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model({"input_ids": input_ids, "token_type_ids": token_type_ids})` `model({"input_ids": input_ids, "token_type_ids": token_type_ids})`
Note that when creating models and layers with
[subclassing](https://keras.io/guides/making_new_layers_and_models_via_subclassing/) then you don't need to worry
about any of this, as you can just pass inputs like you would to any other Python function!
</Tip> </Tip>
Args: Args:
......
...@@ -399,13 +399,27 @@ CONVNEXT_START_DOCSTRING = r""" ...@@ -399,13 +399,27 @@ CONVNEXT_START_DOCSTRING = r"""
<Tip> <Tip>
TF 2.0 models accepts two formats as inputs: TensorFlow models and layers in `transformers` accept two formats as input:
- having all inputs as keyword arguments (like PyTorch models), or - having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments. - having all inputs as a list, tuple or dict in the first positional argument.
This second option is useful when using [`tf.keras.Model.fit`] method which currently requires having all the The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
tensors in the first argument of the model call function: `model(inputs)`. and layers. Because of this support, when using methods like `model.fit()` things should "just work" for you - just
pass your inputs and labels in any format that `model.fit()` supports! If, however, you want to use the second
format outside of Keras methods like `fit()` and `predict()`, such as when creating your own layers or models with
the Keras `Functional` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:
- a single Tensor with `pixel_values` only and nothing else: `model(pixel_values)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`model([pixel_values, attention_mask])` or `model([pixel_values, attention_mask, token_type_ids])`
- a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model({"pixel_values": pixel_values, "token_type_ids": token_type_ids})`
Note that when creating models and layers with
[subclassing](https://keras.io/guides/making_new_layers_and_models_via_subclassing/) then you don't need to worry
about any of this, as you can just pass inputs like you would to any other Python function!
</Tip> </Tip>
......
...@@ -418,23 +418,28 @@ CTRL_START_DOCSTRING = r""" ...@@ -418,23 +418,28 @@ CTRL_START_DOCSTRING = r"""
<Tip> <Tip>
TF 2.0 models accepts two formats as inputs: TensorFlow models and layers in `transformers` accept two formats as input:
- having all inputs as keyword arguments (like PyTorch models), or - having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments. - having all inputs as a list, tuple or dict in the first positional argument.
This second option is useful when using [`tf.keras.Model.fit`] method which currently requires having all the The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
tensors in the first argument of the model call function: `model(inputs)`. and layers. Because of this support, when using methods like `model.fit()` things should "just work" for you - just
pass your inputs and labels in any format that `model.fit()` supports! If, however, you want to use the second
format outside of Keras methods like `fit()` and `predict()`, such as when creating your own layers or models with
the Keras `Functional` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:
If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the - a single Tensor with `input_ids` only and nothing else: `model(input_ids)`
first positional argument :
- a single Tensor with `input_ids` only and nothing else: `model(inputs_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: - a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])` `model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])`
- a dictionary with one or several input Tensors associated to the input names given in the docstring: - a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model({"input_ids": input_ids, "token_type_ids": token_type_ids})` `model({"input_ids": input_ids, "token_type_ids": token_type_ids})`
Note that when creating models and layers with
[subclassing](https://keras.io/guides/making_new_layers_and_models_via_subclassing/) then you don't need to worry
about any of this, as you can just pass inputs like you would to any other Python function!
</Tip> </Tip>
Parameters: Parameters:
......
...@@ -816,13 +816,27 @@ DATA2VEC_VISION_START_DOCSTRING = r""" ...@@ -816,13 +816,27 @@ DATA2VEC_VISION_START_DOCSTRING = r"""
<Tip> <Tip>
TF 2.0 models accepts two formats as inputs: TensorFlow models and layers in `transformers` accept two formats as input:
- having all inputs as keyword arguments (like PyTorch models), or - having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments. - having all inputs as a list, tuple or dict in the first positional argument.
This second option is useful when using [`tf.keras.Model.fit`] method which currently requires having all the The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
tensors in the first argument of the model call function: `model(inputs)`. and layers. Because of this support, when using methods like `model.fit()` things should "just work" for you - just
pass your inputs and labels in any format that `model.fit()` supports! If, however, you want to use the second
format outside of Keras methods like `fit()` and `predict()`, such as when creating your own layers or models with
the Keras `Functional` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:
- a single Tensor with `pixel_values` only and nothing else: `model(pixel_values)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`model([pixel_values, attention_mask])` or `model([pixel_values, attention_mask, token_type_ids])`
- a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model({"pixel_values": pixel_values, "token_type_ids": token_type_ids})`
Note that when creating models and layers with
[subclassing](https://keras.io/guides/making_new_layers_and_models_via_subclassing/) then you don't need to worry
about any of this, as you can just pass inputs like you would to any other Python function!
</Tip> </Tip>
......
...@@ -1004,23 +1004,28 @@ DEBERTA_START_DOCSTRING = r""" ...@@ -1004,23 +1004,28 @@ DEBERTA_START_DOCSTRING = r"""
<Tip> <Tip>
TF 2.0 models accepts two formats as inputs: TensorFlow models and layers in `transformers` accept two formats as input:
- having all inputs as keyword arguments (like PyTorch models), or - having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments. - having all inputs as a list, tuple or dict in the first positional argument.
This second option is useful when using [`tf.keras.Model.fit`] method which currently requires having all the The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
tensors in the first argument of the model call function: `model(inputs)`. and layers. Because of this support, when using methods like `model.fit()` things should "just work" for you - just
pass your inputs and labels in any format that `model.fit()` supports! If, however, you want to use the second
format outside of Keras methods like `fit()` and `predict()`, such as when creating your own layers or models with
the Keras `Functional` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:
If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the - a single Tensor with `input_ids` only and nothing else: `model(input_ids)`
first positional argument :
- a single Tensor with `input_ids` only and nothing else: `model(inputs_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: - a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])` `model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])`
- a dictionary with one or several input Tensors associated to the input names given in the docstring: - a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model({"input_ids": input_ids, "token_type_ids": token_type_ids})` `model({"input_ids": input_ids, "token_type_ids": token_type_ids})`
Note that when creating models and layers with
[subclassing](https://keras.io/guides/making_new_layers_and_models_via_subclassing/) then you don't need to worry
about any of this, as you can just pass inputs like you would to any other Python function!
</Tip> </Tip>
Parameters: Parameters:
......
...@@ -1097,23 +1097,28 @@ DEBERTA_START_DOCSTRING = r""" ...@@ -1097,23 +1097,28 @@ DEBERTA_START_DOCSTRING = r"""
<Tip> <Tip>
TF 2.0 models accepts two formats as inputs: TensorFlow models and layers in `transformers` accept two formats as input:
- having all inputs as keyword arguments (like PyTorch models), or - having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments. - having all inputs as a list, tuple or dict in the first positional argument.
This second option is useful when using [`tf.keras.Model.fit`] method which currently requires having all the The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
tensors in the first argument of the model call function: `model(inputs)`. and layers. Because of this support, when using methods like `model.fit()` things should "just work" for you - just
pass your inputs and labels in any format that `model.fit()` supports! If, however, you want to use the second
format outside of Keras methods like `fit()` and `predict()`, such as when creating your own layers or models with
the Keras `Functional` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:
If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the - a single Tensor with `input_ids` only and nothing else: `model(input_ids)`
first positional argument :
- a single Tensor with `input_ids` only and nothing else: `model(inputs_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: - a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])` `model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])`
- a dictionary with one or several input Tensors associated to the input names given in the docstring: - a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model({"input_ids": input_ids, "token_type_ids": token_type_ids})` `model({"input_ids": input_ids, "token_type_ids": token_type_ids})`
Note that when creating models and layers with
[subclassing](https://keras.io/guides/making_new_layers_and_models_via_subclassing/) then you don't need to worry
about any of this, as you can just pass inputs like you would to any other Python function!
</Tip> </Tip>
Parameters: Parameters:
......
...@@ -447,22 +447,27 @@ DISTILBERT_START_DOCSTRING = r""" ...@@ -447,22 +447,27 @@ DISTILBERT_START_DOCSTRING = r"""
<Tip> <Tip>
TF 2.0 models accepts two formats as inputs: TensorFlow models and layers in `transformers` accept two formats as input:
- having all inputs as keyword arguments (like PyTorch models), or - having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments. - having all inputs as a list, tuple or dict in the first positional argument.
This second option is useful when using [`tf.keras.Model.fit`] method which currently requires having all the The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
tensors in the first argument of the model call function: `model(inputs)`. and layers. Because of this support, when using methods like `model.fit()` things should "just work" for you - just
pass your inputs and labels in any format that `model.fit()` supports! If, however, you want to use the second
format outside of Keras methods like `fit()` and `predict()`, such as when creating your own layers or models with
the Keras `Functional` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:
If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the - a single Tensor with `input_ids` only and nothing else: `model(input_ids)`
first positional argument :
- a single Tensor with `input_ids` only and nothing else: `model(inputs_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: - a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`model([input_ids, attention_mask])` `model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])`
- a dictionary with one or several input Tensors associated to the input names given in the docstring: - a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model({"input_ids": input_ids})` `model({"input_ids": input_ids, "token_type_ids": token_type_ids})`
Note that when creating models and layers with
[subclassing](https://keras.io/guides/making_new_layers_and_models_via_subclassing/) then you don't need to worry
about any of this, as you can just pass inputs like you would to any other Python function!
</Tip> </Tip>
......
...@@ -404,23 +404,28 @@ TF_DPR_START_DOCSTRING = r""" ...@@ -404,23 +404,28 @@ TF_DPR_START_DOCSTRING = r"""
<Tip> <Tip>
TF 2.0 models accepts two formats as inputs: TensorFlow models and layers in `transformers` accept two formats as input:
- having all inputs as keyword arguments (like PyTorch models), or - having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments. - having all inputs as a list, tuple or dict in the first positional argument.
This second option is useful when using [`tf.keras.Model.fit`] method which currently requires having all the The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
tensors in the first argument of the model call function: `model(inputs)`. and layers. Because of this support, when using methods like `model.fit()` things should "just work" for you - just
pass your inputs and labels in any format that `model.fit()` supports! If, however, you want to use the second
format outside of Keras methods like `fit()` and `predict()`, such as when creating your own layers or models with
the Keras `Functional` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:
If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the - a single Tensor with `input_ids` only and nothing else: `model(input_ids)`
first positional argument :
- a single Tensor with `input_ids` only and nothing else: `model(inputs_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: - a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])` `model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])`
- a dictionary with one or several input Tensors associated to the input names given in the docstring: - a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model({"input_ids": input_ids, "token_type_ids": token_type_ids})` `model({"input_ids": input_ids, "token_type_ids": token_type_ids})`
Note that when creating models and layers with
[subclassing](https://keras.io/guides/making_new_layers_and_models_via_subclassing/) then you don't need to worry
about any of this, as you can just pass inputs like you would to any other Python function!
</Tip> </Tip>
Parameters: Parameters:
......
...@@ -841,23 +841,28 @@ ELECTRA_START_DOCSTRING = r""" ...@@ -841,23 +841,28 @@ ELECTRA_START_DOCSTRING = r"""
<Tip> <Tip>
TF 2.0 models accepts two formats as inputs: TensorFlow models and layers in `transformers` accept two formats as input:
- having all inputs as keyword arguments (like PyTorch models), or - having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments. - having all inputs as a list, tuple or dict in the first positional argument.
This second option is useful when using [`tf.keras.Model.fit`] method which currently requires having all the The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
tensors in the first argument of the model call function: `model(inputs)`. and layers. Because of this support, when using methods like `model.fit()` things should "just work" for you - just
pass your inputs and labels in any format that `model.fit()` supports! If, however, you want to use the second
format outside of Keras methods like `fit()` and `predict()`, such as when creating your own layers or models with
the Keras `Functional` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:
If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the - a single Tensor with `input_ids` only and nothing else: `model(input_ids)`
first positional argument :
- a single Tensor with `input_ids` only and nothing else: `model(inputs_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: - a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])` `model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])`
- a dictionary with one or several input Tensors associated to the input names given in the docstring: - a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model({"input_ids": input_ids, "token_type_ids": token_type_ids})` `model({"input_ids": input_ids, "token_type_ids": token_type_ids})`
Note that when creating models and layers with
[subclassing](https://keras.io/guides/making_new_layers_and_models_via_subclassing/) then you don't need to worry
about any of this, as you can just pass inputs like you would to any other Python function!
</Tip> </Tip>
Parameters: Parameters:
......
...@@ -73,23 +73,28 @@ FLAUBERT_START_DOCSTRING = r""" ...@@ -73,23 +73,28 @@ FLAUBERT_START_DOCSTRING = r"""
<Tip> <Tip>
TF 2.0 models accepts two formats as inputs: TensorFlow models and layers in `transformers` accept two formats as input:
- having all inputs as keyword arguments (like PyTorch models), or - having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments. - having all inputs as a list, tuple or dict in the first positional argument.
This second option is useful when using [`tf.keras.Model.fit`] method which currently requires having all the The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
tensors in the first argument of the model call function: `model(inputs)`. and layers. Because of this support, when using methods like `model.fit()` things should "just work" for you - just
pass your inputs and labels in any format that `model.fit()` supports! If, however, you want to use the second
format outside of Keras methods like `fit()` and `predict()`, such as when creating your own layers or models with
the Keras `Functional` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:
If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the - a single Tensor with `input_ids` only and nothing else: `model(input_ids)`
first positional argument :
- a single Tensor with `input_ids` only and nothing else: `model(inputs_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: - a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])` `model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])`
- a dictionary with one or several input Tensors associated to the input names given in the docstring: - a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model({"input_ids": input_ids, "token_type_ids": token_type_ids})` `model({"input_ids": input_ids, "token_type_ids": token_type_ids})`
Note that when creating models and layers with
[subclassing](https://keras.io/guides/making_new_layers_and_models_via_subclassing/) then you don't need to worry
about any of this, as you can just pass inputs like you would to any other Python function!
</Tip> </Tip>
Parameters: Parameters:
......
...@@ -1015,23 +1015,28 @@ FUNNEL_START_DOCSTRING = r""" ...@@ -1015,23 +1015,28 @@ FUNNEL_START_DOCSTRING = r"""
<Tip> <Tip>
TF 2.0 models accepts two formats as inputs: TensorFlow models and layers in `transformers` accept two formats as input:
- having all inputs as keyword arguments (like PyTorch models), or - having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments. - having all inputs as a list, tuple or dict in the first positional argument.
This second option is useful when using [`tf.keras.Model.fit`] method which currently requires having all the The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
tensors in the first argument of the model call function: `model(inputs)`. and layers. Because of this support, when using methods like `model.fit()` things should "just work" for you - just
pass your inputs and labels in any format that `model.fit()` supports! If, however, you want to use the second
format outside of Keras methods like `fit()` and `predict()`, such as when creating your own layers or models with
the Keras `Functional` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:
If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the - a single Tensor with `input_ids` only and nothing else: `model(input_ids)`
first positional argument :
- a single Tensor with `input_ids` only and nothing else: `model(inputs_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: - a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])` `model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])`
- a dictionary with one or several input Tensors associated to the input names given in the docstring: - a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model({"input_ids": input_ids, "token_type_ids": token_type_ids})` `model({"input_ids": input_ids, "token_type_ids": token_type_ids})`
Note that when creating models and layers with
[subclassing](https://keras.io/guides/making_new_layers_and_models_via_subclassing/) then you don't need to worry
about any of this, as you can just pass inputs like you would to any other Python function!
</Tip> </Tip>
Parameters: Parameters:
......
...@@ -607,23 +607,28 @@ GPT2_START_DOCSTRING = r""" ...@@ -607,23 +607,28 @@ GPT2_START_DOCSTRING = r"""
<Tip> <Tip>
TF 2.0 models accepts two formats as inputs: TensorFlow models and layers in `transformers` accept two formats as input:
- having all inputs as keyword arguments (like PyTorch models), or - having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments. - having all inputs as a list, tuple or dict in the first positional argument.
This second option is useful when using [`tf.keras.Model.fit`] method which currently requires having all the The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
tensors in the first argument of the model call function: `model(inputs)`. and layers. Because of this support, when using methods like `model.fit()` things should "just work" for you - just
pass your inputs and labels in any format that `model.fit()` supports! If, however, you want to use the second
format outside of Keras methods like `fit()` and `predict()`, such as when creating your own layers or models with
the Keras `Functional` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:
If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the - a single Tensor with `input_ids` only and nothing else: `model(input_ids)`
first positional argument :
- a single Tensor with `input_ids` only and nothing else: `model(inputs_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: - a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])` `model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])`
- a dictionary with one or several input Tensors associated to the input names given in the docstring: - a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model({"input_ids": input_ids, "token_type_ids": token_type_ids})` `model({"input_ids": input_ids, "token_type_ids": token_type_ids})`
Note that when creating models and layers with
[subclassing](https://keras.io/guides/making_new_layers_and_models_via_subclassing/) then you don't need to worry
about any of this, as you can just pass inputs like you would to any other Python function!
</Tip> </Tip>
Parameters: Parameters:
......
...@@ -550,23 +550,28 @@ GPTJ_START_DOCSTRING = r""" ...@@ -550,23 +550,28 @@ GPTJ_START_DOCSTRING = r"""
<Tip> <Tip>
TF 2.0 models accepts two formats as inputs: TensorFlow models and layers in `transformers` accept two formats as input:
- having all inputs as keyword arguments (like PyTorch models), or - having all inputs as keyword arguments (like PyTorch models), or
- having all inputs as a list, tuple or dict in the first positional arguments. - having all inputs as a list, tuple or dict in the first positional argument.
This second option is useful when using [`tf.keras.Model.fit`] method which currently requires having all the The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
tensors in the first argument of the model call function: `model(inputs)`. and layers. Because of this support, when using methods like `model.fit()` things should "just work" for you - just
pass your inputs and labels in any format that `model.fit()` supports! If, however, you want to use the second
format outside of Keras methods like `fit()` and `predict()`, such as when creating your own layers or models with
the Keras `Functional` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:
If you choose this second option, there are three possibilities you can use to gather all the input Tensors in the - a single Tensor with `input_ids` only and nothing else: `model(input_ids)`
first positional argument :
- a single Tensor with `input_ids` only and nothing else: `model(inputs_ids)`
- a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: - a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])` `model([input_ids, attention_mask])` or `model([input_ids, attention_mask, token_type_ids])`
- a dictionary with one or several input Tensors associated to the input names given in the docstring: - a dictionary with one or several input Tensors associated to the input names given in the docstring:
`model({"input_ids": input_ids, "token_type_ids": token_type_ids})` `model({"input_ids": input_ids, "token_type_ids": token_type_ids})`
Note that when creating models and layers with
[subclassing](https://keras.io/guides/making_new_layers_and_models_via_subclassing/) then you don't need to worry
about any of this, as you can just pass inputs like you would to any other Python function!
</Tip> </Tip>
Parameters: Parameters:
......
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