mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-16 11:08:23 +06:00
Big file_utils cleanup (#16396)
* Big file_utils cleanup * This one still needs to be treated separately
This commit is contained in:
parent
2b23e0801a
commit
088c1880b7
@ -72,7 +72,7 @@ You are not required to read the following guidelines before opening an issue. H
|
|||||||
from . import dependency_versions_check
|
from . import dependency_versions_check
|
||||||
File "/transformers/src/transformers/dependency_versions_check.py", line 34, in <module>
|
File "/transformers/src/transformers/dependency_versions_check.py", line 34, in <module>
|
||||||
from .utils import is_tokenizers_available
|
from .utils import is_tokenizers_available
|
||||||
File "/transformers/src/transformers/file_utils.py", line 40, in <module>
|
File "/transformers/src/transformers/utils/import_utils.py", line 40, in <module>
|
||||||
from tqdm.auto import tqdm
|
from tqdm.auto import tqdm
|
||||||
ModuleNotFoundError: No module named 'tqdm.auto'
|
ModuleNotFoundError: No module named 'tqdm.auto'
|
||||||
```
|
```
|
||||||
@ -125,7 +125,7 @@ You are not required to read the following guidelines before opening an issue. H
|
|||||||
from . import dependency_versions_check
|
from . import dependency_versions_check
|
||||||
File "/transformers/src/transformers/dependency_versions_check.py", line 34, in <module>
|
File "/transformers/src/transformers/dependency_versions_check.py", line 34, in <module>
|
||||||
from .utils import is_tokenizers_available
|
from .utils import is_tokenizers_available
|
||||||
File "/transformers/src/transformers/file_utils.py", line 40, in <module>
|
File "/transformers/src/transformers/utils/import_utils.py", line 40, in <module>
|
||||||
from tqdm.auto import tqdm
|
from tqdm.auto import tqdm
|
||||||
ModuleNotFoundError: No module named 'tqdm.auto'
|
ModuleNotFoundError: No module named 'tqdm.auto'
|
||||||
```
|
```
|
||||||
|
@ -172,9 +172,9 @@ adds a link to its documentation with this syntax: \[\`XXXClass\`\] or \[\`funct
|
|||||||
function to be in the main package.
|
function to be in the main package.
|
||||||
|
|
||||||
If you want to create a link to some internal class or function, you need to
|
If you want to create a link to some internal class or function, you need to
|
||||||
provide its path. For instance: \[\`file_utils.ModelOutput\`\]. This will be converted into a link with
|
provide its path. For instance: \[\`utils.ModelOutput\`\]. This will be converted into a link with
|
||||||
`file_utils.ModelOutput` in the description. To get rid of the path and only keep the name of the object you are
|
`utils.ModelOutput` in the description. To get rid of the path and only keep the name of the object you are
|
||||||
linking to in the description, add a ~: \[\`~file_utils.ModelOutput\`\] will generate a link with `ModelOutput` in the description.
|
linking to in the description, add a ~: \[\`~utils.ModelOutput\`\] will generate a link with `ModelOutput` in the description.
|
||||||
|
|
||||||
The same works for methods so you can either use \[\`XXXClass.method\`\] or \[~\`XXXClass.method\`\].
|
The same works for methods so you can either use \[\`XXXClass.method\`\] or \[~\`XXXClass.method\`\].
|
||||||
|
|
||||||
|
@ -381,7 +381,7 @@ important. Here is some advice is to make your debugging environment as efficien
|
|||||||
original code so that you can directly input the ids instead of an input string.
|
original code so that you can directly input the ids instead of an input string.
|
||||||
- Make sure that the model in your debugging setup is **not** in training mode, which often causes the model to yield
|
- Make sure that the model in your debugging setup is **not** in training mode, which often causes the model to yield
|
||||||
random outputs due to multiple dropout layers in the model. Make sure that the forward pass in your debugging
|
random outputs due to multiple dropout layers in the model. Make sure that the forward pass in your debugging
|
||||||
environment is **deterministic** so that the dropout layers are not used. Or use *transformers.file_utils.set_seed*
|
environment is **deterministic** so that the dropout layers are not used. Or use *transformers.utils.set_seed*
|
||||||
if the old and new implementations are in the same framework.
|
if the old and new implementations are in the same framework.
|
||||||
|
|
||||||
The following section gives you more specific details/tips on how you can do this for *brand_new_bert*.
|
The following section gives you more specific details/tips on how you can do this for *brand_new_bert*.
|
||||||
|
@ -12,35 +12,35 @@ specific language governing permissions and limitations under the License.
|
|||||||
|
|
||||||
# General Utilities
|
# General Utilities
|
||||||
|
|
||||||
This page lists all of Transformers general utility functions that are found in the file `file_utils.py`.
|
This page lists all of Transformers general utility functions that are found in the file `utils.py`.
|
||||||
|
|
||||||
Most of those are only useful if you are studying the general code in the library.
|
Most of those are only useful if you are studying the general code in the library.
|
||||||
|
|
||||||
|
|
||||||
## Enums and namedtuples
|
## Enums and namedtuples
|
||||||
|
|
||||||
[[autodoc]] file_utils.ExplicitEnum
|
[[autodoc]] utils.ExplicitEnum
|
||||||
|
|
||||||
[[autodoc]] file_utils.PaddingStrategy
|
[[autodoc]] utils.PaddingStrategy
|
||||||
|
|
||||||
[[autodoc]] file_utils.TensorType
|
[[autodoc]] utils.TensorType
|
||||||
|
|
||||||
## Special Decorators
|
## Special Decorators
|
||||||
|
|
||||||
[[autodoc]] file_utils.add_start_docstrings
|
[[autodoc]] utils.add_start_docstrings
|
||||||
|
|
||||||
[[autodoc]] file_utils.add_start_docstrings_to_model_forward
|
[[autodoc]] utils.add_start_docstrings_to_model_forward
|
||||||
|
|
||||||
[[autodoc]] file_utils.add_end_docstrings
|
[[autodoc]] utils.add_end_docstrings
|
||||||
|
|
||||||
[[autodoc]] file_utils.add_code_sample_docstrings
|
[[autodoc]] utils.add_code_sample_docstrings
|
||||||
|
|
||||||
[[autodoc]] file_utils.replace_return_docstrings
|
[[autodoc]] utils.replace_return_docstrings
|
||||||
|
|
||||||
## Special Properties
|
## Special Properties
|
||||||
|
|
||||||
[[autodoc]] file_utils.cached_property
|
[[autodoc]] utils.cached_property
|
||||||
|
|
||||||
## Other Utilities
|
## Other Utilities
|
||||||
|
|
||||||
[[autodoc]] file_utils._LazyModule
|
[[autodoc]] utils._LazyModule
|
||||||
|
@ -25,7 +25,7 @@ Most of those are only useful if you are studying the code of the generate metho
|
|||||||
## Generate Outputs
|
## Generate Outputs
|
||||||
|
|
||||||
The output of [`~generation_utils.GenerationMixin.generate`] is an instance of a subclass of
|
The output of [`~generation_utils.GenerationMixin.generate`] is an instance of a subclass of
|
||||||
[`~file_utils.ModelOutput`]. This output is a data structure containing all the information returned
|
[`~utils.ModelOutput`]. This output is a data structure containing all the information returned
|
||||||
by [`~generation_utils.GenerationMixin.generate`], but that can also be used as tuple or dictionary.
|
by [`~generation_utils.GenerationMixin.generate`], but that can also be used as tuple or dictionary.
|
||||||
|
|
||||||
Here's an example:
|
Here's an example:
|
||||||
|
@ -88,4 +88,4 @@ Due to Pytorch design, this functionality is only available for floating dtypes.
|
|||||||
|
|
||||||
## Pushing to the Hub
|
## Pushing to the Hub
|
||||||
|
|
||||||
[[autodoc]] file_utils.PushToHubMixin
|
[[autodoc]] utils.PushToHubMixin
|
||||||
|
@ -12,7 +12,7 @@ specific language governing permissions and limitations under the License.
|
|||||||
|
|
||||||
# Model outputs
|
# Model outputs
|
||||||
|
|
||||||
All models have outputs that are instances of subclasses of [`~file_utils.ModelOutput`]. Those are
|
All models have outputs that are instances of subclasses of [`~utils.ModelOutput`]. Those are
|
||||||
data structures containing all the information returned by the model, but that can also be used as tuples or
|
data structures containing all the information returned by the model, but that can also be used as tuples or
|
||||||
dictionaries.
|
dictionaries.
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ documented on their corresponding model page.
|
|||||||
|
|
||||||
## ModelOutput
|
## ModelOutput
|
||||||
|
|
||||||
[[autodoc]] file_utils.ModelOutput
|
[[autodoc]] utils.ModelOutput
|
||||||
- to_tuple
|
- to_tuple
|
||||||
|
|
||||||
## BaseModelOutput
|
## BaseModelOutput
|
||||||
|
@ -40,7 +40,7 @@ The [`Trainer`] contains the basic training loop which supports the above featur
|
|||||||
The [`Trainer`] class is optimized for 🤗 Transformers models and can have surprising behaviors
|
The [`Trainer`] class is optimized for 🤗 Transformers models and can have surprising behaviors
|
||||||
when you use it on other models. When using it on your own model, make sure:
|
when you use it on other models. When using it on your own model, make sure:
|
||||||
|
|
||||||
- your model always return tuples or subclasses of [`~file_utils.ModelOutput`].
|
- your model always return tuples or subclasses of [`~utils.ModelOutput`].
|
||||||
- your model can compute the loss if a `labels` argument is provided and that loss is returned as the first
|
- your model can compute the loss if a `labels` argument is provided and that loss is returned as the first
|
||||||
element of the tuple (if your model returns tuples)
|
element of the tuple (if your model returns tuples)
|
||||||
- your model can accept multiple label arguments (use the `label_names` in your [`TrainingArguments`] to indicate their name to the [`Trainer`]) but none of them should be named `"label"`.
|
- your model can accept multiple label arguments (use the `label_names` in your [`TrainingArguments`] to indicate their name to the [`Trainer`]) but none of them should be named `"label"`.
|
||||||
|
@ -855,7 +855,7 @@ If you need to switch a tensor to bf16, it's just: `t.to(dtype=torch.bfloat16)`
|
|||||||
Here is how you can check if your setup supports bf16:
|
Here is how you can check if your setup supports bf16:
|
||||||
|
|
||||||
```
|
```
|
||||||
python -c 'import transformers; print(f"BF16 support is {transformers.file_utils.is_torch_bf16_available()}")'
|
python -c 'import transformers; print(f"BF16 support is {transformers.utils.is_torch_bf16_available()}")'
|
||||||
```
|
```
|
||||||
|
|
||||||
On the other hand bf16 has a much worse precision than fp16, so there are certain situations where you'd still want to use fp16 and not bf16.
|
On the other hand bf16 has a much worse precision than fp16, so there are certain situations where you'd still want to use fp16 and not bf16.
|
||||||
|
@ -153,7 +153,7 @@ class DataCollatorForMultipleChoice:
|
|||||||
Args:
|
Args:
|
||||||
tokenizer ([`PreTrainedTokenizer`] or [`PreTrainedTokenizerFast`]):
|
tokenizer ([`PreTrainedTokenizer`] or [`PreTrainedTokenizerFast`]):
|
||||||
The tokenizer used for encoding the data.
|
The tokenizer used for encoding the data.
|
||||||
padding (`bool`, `str` or [`~file_utils.PaddingStrategy`], *optional*, defaults to `True`):
|
padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*, defaults to `True`):
|
||||||
Select a strategy to pad the returned sequences (according to the model's padding side and padding index)
|
Select a strategy to pad the returned sequences (according to the model's padding side and padding index)
|
||||||
among:
|
among:
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ class DataCollatorForMultipleChoice:
|
|||||||
Args:
|
Args:
|
||||||
tokenizer ([`PreTrainedTokenizer`] or [`PreTrainedTokenizerFast`]):
|
tokenizer ([`PreTrainedTokenizer`] or [`PreTrainedTokenizerFast`]):
|
||||||
The tokenizer used for encoding the data.
|
The tokenizer used for encoding the data.
|
||||||
padding (`bool`, `str` or [`~file_utils.PaddingStrategy`], *optional*, defaults to `True`):
|
padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*, defaults to `True`):
|
||||||
Select a strategy to pad the returned sequences (according to the model's padding side and padding index)
|
Select a strategy to pad the returned sequences (according to the model's padding side and padding index)
|
||||||
among:
|
among:
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ class DataCollatorForMultipleChoice:
|
|||||||
Args:
|
Args:
|
||||||
tokenizer ([`PreTrainedTokenizer`] or [`PreTrainedTokenizerFast`]):
|
tokenizer ([`PreTrainedTokenizer`] or [`PreTrainedTokenizerFast`]):
|
||||||
The tokenizer used for encoding the data.
|
The tokenizer used for encoding the data.
|
||||||
padding (`bool`, `str` or [`~file_utils.PaddingStrategy`], *optional*, defaults to `True`):
|
padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*, defaults to `True`):
|
||||||
Select a strategy to pad the returned sequences (according to the model's padding side and padding index)
|
Select a strategy to pad the returned sequences (according to the model's padding side and padding index)
|
||||||
among:
|
among:
|
||||||
|
|
||||||
|
@ -784,7 +784,7 @@ def clean_frameworks_in_init(
|
|||||||
indent = find_indent(lines[idx])
|
indent = find_indent(lines[idx])
|
||||||
while find_indent(lines[idx]) >= indent or is_empty_line(lines[idx]):
|
while find_indent(lines[idx]) >= indent or is_empty_line(lines[idx]):
|
||||||
idx += 1
|
idx += 1
|
||||||
# Remove the import from file_utils
|
# Remove the import from utils
|
||||||
elif re_is_xxx_available.search(lines[idx]) is not None:
|
elif re_is_xxx_available.search(lines[idx]) is not None:
|
||||||
line = lines[idx]
|
line = lines[idx]
|
||||||
for framework in to_remove:
|
for framework in to_remove:
|
||||||
|
@ -93,7 +93,7 @@ class PretrainedConfig(PushToHubMixin):
|
|||||||
output_attentions (`bool`, *optional*, defaults to `False`):
|
output_attentions (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not the model should returns all attentions.
|
Whether or not the model should returns all attentions.
|
||||||
return_dict (`bool`, *optional*, defaults to `True`):
|
return_dict (`bool`, *optional*, defaults to `True`):
|
||||||
Whether or not the model should return a [`~transformers.file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not the model should return a [`~transformers.utils.ModelOutput`] instead of a plain tuple.
|
||||||
is_encoder_decoder (`bool`, *optional*, defaults to `False`):
|
is_encoder_decoder (`bool`, *optional*, defaults to `False`):
|
||||||
Whether the model is used as an encoder/decoder or not.
|
Whether the model is used as an encoder/decoder or not.
|
||||||
is_decoder (`bool`, *optional*, defaults to `False`):
|
is_decoder (`bool`, *optional*, defaults to `False`):
|
||||||
@ -170,7 +170,7 @@ class PretrainedConfig(PushToHubMixin):
|
|||||||
output_scores (`bool`, *optional*, defaults to `False`):
|
output_scores (`bool`, *optional*, defaults to `False`):
|
||||||
Whether the model should return the logits when used for generation.
|
Whether the model should return the logits when used for generation.
|
||||||
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
||||||
Whether the model should return a [`~transformers.file_utils.ModelOutput`] instead of a `torch.LongTensor`.
|
Whether the model should return a [`~transformers.utils.ModelOutput`] instead of a `torch.LongTensor`.
|
||||||
forced_bos_token_id (`int`, *optional*):
|
forced_bos_token_id (`int`, *optional*):
|
||||||
The id of the token to force as the first generated token after the `decoder_start_token_id`. Useful for
|
The id of the token to force as the first generated token after the `decoder_start_token_id`. Useful for
|
||||||
multilingual models like [mBART](../model_doc/mbart) where the first generated token needs to be the target
|
multilingual models like [mBART](../model_doc/mbart) where the first generated token needs to be the target
|
||||||
@ -379,7 +379,7 @@ class PretrainedConfig(PushToHubMixin):
|
|||||||
@property
|
@property
|
||||||
def use_return_dict(self) -> bool:
|
def use_return_dict(self) -> bool:
|
||||||
"""
|
"""
|
||||||
`bool`: Whether or not return [`~file_utils.ModelOutput`] instead of tuples.
|
`bool`: Whether or not return [`~utils.ModelOutput`] instead of tuples.
|
||||||
"""
|
"""
|
||||||
# If torchscript is set, force `return_dict=False` to avoid jit errors
|
# If torchscript is set, force `return_dict=False` to avoid jit errors
|
||||||
return self.return_dict and not self.torchscript
|
return self.return_dict and not self.torchscript
|
||||||
@ -417,7 +417,7 @@ class PretrainedConfig(PushToHubMixin):
|
|||||||
</Tip>
|
</Tip>
|
||||||
|
|
||||||
kwargs:
|
kwargs:
|
||||||
Additional key word arguments passed along to the [`~file_utils.PushToHubMixin.push_to_hub`] method.
|
Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method.
|
||||||
"""
|
"""
|
||||||
if os.path.isfile(save_directory):
|
if os.path.isfile(save_directory):
|
||||||
raise AssertionError(f"Provided path ({save_directory}) should be a directory, not a file")
|
raise AssertionError(f"Provided path ({save_directory}) should be a directory, not a file")
|
||||||
|
@ -216,7 +216,7 @@ class DataCollatorWithPadding:
|
|||||||
Args:
|
Args:
|
||||||
tokenizer ([`PreTrainedTokenizer`] or [`PreTrainedTokenizerFast`]):
|
tokenizer ([`PreTrainedTokenizer`] or [`PreTrainedTokenizerFast`]):
|
||||||
The tokenizer used for encoding the data.
|
The tokenizer used for encoding the data.
|
||||||
padding (`bool`, `str` or [`~file_utils.PaddingStrategy`], *optional*, defaults to `True`):
|
padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*, defaults to `True`):
|
||||||
Select a strategy to pad the returned sequences (according to the model's padding side and padding index)
|
Select a strategy to pad the returned sequences (according to the model's padding side and padding index)
|
||||||
among:
|
among:
|
||||||
|
|
||||||
@ -268,7 +268,7 @@ class DataCollatorForTokenClassification(DataCollatorMixin):
|
|||||||
Args:
|
Args:
|
||||||
tokenizer ([`PreTrainedTokenizer`] or [`PreTrainedTokenizerFast`]):
|
tokenizer ([`PreTrainedTokenizer`] or [`PreTrainedTokenizerFast`]):
|
||||||
The tokenizer used for encoding the data.
|
The tokenizer used for encoding the data.
|
||||||
padding (`bool`, `str` or [`~file_utils.PaddingStrategy`], *optional*, defaults to `True`):
|
padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*, defaults to `True`):
|
||||||
Select a strategy to pad the returned sequences (according to the model's padding side and padding index)
|
Select a strategy to pad the returned sequences (according to the model's padding side and padding index)
|
||||||
among:
|
among:
|
||||||
|
|
||||||
@ -523,7 +523,7 @@ class DataCollatorForSeq2Seq:
|
|||||||
prepare the *decoder_input_ids*
|
prepare the *decoder_input_ids*
|
||||||
|
|
||||||
This is useful when using *label_smoothing* to avoid calculating loss twice.
|
This is useful when using *label_smoothing* to avoid calculating loss twice.
|
||||||
padding (`bool`, `str` or [`~file_utils.PaddingStrategy`], *optional*, defaults to `True`):
|
padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*, defaults to `True`):
|
||||||
Select a strategy to pad the returned sequences (according to the model's padding side and padding index)
|
Select a strategy to pad the returned sequences (according to the model's padding side and padding index)
|
||||||
among:
|
among:
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ class SequenceFeatureExtractor(FeatureExtractionMixin):
|
|||||||
|
|
||||||
Instead of `List[float]` you can have tensors (numpy arrays, PyTorch tensors or TensorFlow tensors),
|
Instead of `List[float]` you can have tensors (numpy arrays, PyTorch tensors or TensorFlow tensors),
|
||||||
see the note above for the return type.
|
see the note above for the return type.
|
||||||
padding (`bool`, `str` or [`~file_utils.PaddingStrategy`], *optional*, defaults to `True`):
|
padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*, defaults to `True`):
|
||||||
Select a strategy to pad the returned sequences (according to the model's padding side and padding
|
Select a strategy to pad the returned sequences (according to the model's padding side and padding
|
||||||
index) among:
|
index) among:
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ class SequenceFeatureExtractor(FeatureExtractionMixin):
|
|||||||
to the specific feature_extractor's default.
|
to the specific feature_extractor's default.
|
||||||
|
|
||||||
[What are attention masks?](../glossary#attention-mask)
|
[What are attention masks?](../glossary#attention-mask)
|
||||||
return_tensors (`str` or [`~file_utils.TensorType`], *optional*):
|
return_tensors (`str` or [`~utils.TensorType`], *optional*):
|
||||||
If set, will return tensors instead of list of python integers. Acceptable values are:
|
If set, will return tensors instead of list of python integers. Acceptable values are:
|
||||||
|
|
||||||
- `'tf'`: Return TensorFlow `tf.constant` objects.
|
- `'tf'`: Return TensorFlow `tf.constant` objects.
|
||||||
|
@ -117,9 +117,9 @@ class BatchFeature(UserDict):
|
|||||||
Convert the inner content to tensors.
|
Convert the inner content to tensors.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
tensor_type (`str` or [`~file_utils.TensorType`], *optional*):
|
tensor_type (`str` or [`~utils.TensorType`], *optional*):
|
||||||
The type of tensors to use. If `str`, should be one of the values of the enum
|
The type of tensors to use. If `str`, should be one of the values of the enum [`~utils.TensorType`]. If
|
||||||
[`~file_utils.TensorType`]. If `None`, no modification is done.
|
`None`, no modification is done.
|
||||||
"""
|
"""
|
||||||
if tensor_type is None:
|
if tensor_type is None:
|
||||||
return self
|
return self
|
||||||
@ -328,7 +328,7 @@ class FeatureExtractionMixin(PushToHubMixin):
|
|||||||
</Tip>
|
</Tip>
|
||||||
|
|
||||||
kwargs:
|
kwargs:
|
||||||
Additional key word arguments passed along to the [`~file_utils.PushToHubMixin.push_to_hub`] method.
|
Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method.
|
||||||
"""
|
"""
|
||||||
if os.path.isfile(save_directory):
|
if os.path.isfile(save_directory):
|
||||||
raise AssertionError(f"Provided path ({save_directory}) should be a directory, not a file")
|
raise AssertionError(f"Provided path ({save_directory}) should be a directory, not a file")
|
||||||
|
@ -241,7 +241,7 @@ class FlaxGenerationMixin:
|
|||||||
should be prefixed with *decoder_*. Also accepts `encoder_outputs` to skip encoder part.
|
should be prefixed with *decoder_*. Also accepts `encoder_outputs` to skip encoder part.
|
||||||
|
|
||||||
Return:
|
Return:
|
||||||
[`~file_utils.ModelOutput`].
|
[`~utils.ModelOutput`].
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
|
@ -469,7 +469,7 @@ class TFGenerationMixin:
|
|||||||
output_scores (`bool`, *optional*, defaults to `False`):
|
output_scores (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return the prediction scores. See `scores` under returned tensors for more details.
|
Whether or not to return the prediction scores. See `scores` under returned tensors for more details.
|
||||||
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
forced_bos_token_id (`int`, *optional*):
|
forced_bos_token_id (`int`, *optional*):
|
||||||
The id of the token to force as the first generated token after the `decoder_start_token_id`. Useful
|
The id of the token to force as the first generated token after the `decoder_start_token_id`. Useful
|
||||||
for multilingual models like [mBART](../model_doc/mbart) where the first generated token needs to be
|
for multilingual models like [mBART](../model_doc/mbart) where the first generated token needs to be
|
||||||
@ -480,11 +480,11 @@ class TFGenerationMixin:
|
|||||||
Additional model specific kwargs will be forwarded to the `forward` function of the model.
|
Additional model specific kwargs will be forwarded to the `forward` function of the model.
|
||||||
|
|
||||||
Return:
|
Return:
|
||||||
[`~file_utils.ModelOutput`] or `tf.Tensor`: A [`~file_utils.ModelOutput`] (if
|
[`~utils.ModelOutput`] or `tf.Tensor`: A [`~utils.ModelOutput`] (if `return_dict_in_generate=True` or when
|
||||||
`return_dict_in_generate=True` or when `config.return_dict_in_generate=True`) or a `tf.Tensor`.
|
`config.return_dict_in_generate=True`) or a `tf.Tensor`.
|
||||||
|
|
||||||
If the model is *not* an encoder-decoder model (`model.config.is_encoder_decoder=False`), the possible
|
If the model is *not* an encoder-decoder model (`model.config.is_encoder_decoder=False`), the possible
|
||||||
[`~file_utils.ModelOutput`] types are:
|
[`~utils.ModelOutput`] types are:
|
||||||
|
|
||||||
- [`~generation_tf_utils.TFGreedySearchDecoderOnlyOutput`],
|
- [`~generation_tf_utils.TFGreedySearchDecoderOnlyOutput`],
|
||||||
- [`~generation_tf_utils.TFSampleDecoderOnlyOutput`],
|
- [`~generation_tf_utils.TFSampleDecoderOnlyOutput`],
|
||||||
@ -492,7 +492,7 @@ class TFGenerationMixin:
|
|||||||
- [`~generation_tf_utils.TFBeamSampleDecoderOnlyOutput`]
|
- [`~generation_tf_utils.TFBeamSampleDecoderOnlyOutput`]
|
||||||
|
|
||||||
If the model is an encoder-decoder model (`model.config.is_encoder_decoder=True`), the possible
|
If the model is an encoder-decoder model (`model.config.is_encoder_decoder=True`), the possible
|
||||||
[`~file_utils.ModelOutput`] types are:
|
[`~utils.ModelOutput`] types are:
|
||||||
|
|
||||||
- [`~generation_tf_utils.TFGreedySearchEncoderDecoderOutput`],
|
- [`~generation_tf_utils.TFGreedySearchEncoderDecoderOutput`],
|
||||||
- [`~generation_tf_utils.TFSampleEncoderDecoderOutput`],
|
- [`~generation_tf_utils.TFSampleEncoderDecoderOutput`],
|
||||||
@ -1370,7 +1370,7 @@ class TFGenerationMixin:
|
|||||||
output_scores (`bool`, *optional*, defaults to `False`):
|
output_scores (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return the prediction scores. See `scores` under returned tensors for more details.
|
Whether or not to return the prediction scores. See `scores` under returned tensors for more details.
|
||||||
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
forced_bos_token_id (`int`, *optional*):
|
forced_bos_token_id (`int`, *optional*):
|
||||||
The id of the token to force as the first generated token after the `decoder_start_token_id`. Useful
|
The id of the token to force as the first generated token after the `decoder_start_token_id`. Useful
|
||||||
for multilingual models like [mBART](../model_doc/mbart) where the first generated token needs to be
|
for multilingual models like [mBART](../model_doc/mbart) where the first generated token needs to be
|
||||||
@ -1381,11 +1381,11 @@ class TFGenerationMixin:
|
|||||||
Additional model specific kwargs will be forwarded to the `forward` function of the model.
|
Additional model specific kwargs will be forwarded to the `forward` function of the model.
|
||||||
|
|
||||||
Return:
|
Return:
|
||||||
[`~file_utils.ModelOutput`] or `tf.Tensor`: A [`~file_utils.ModelOutput`] (if
|
[`~utils.ModelOutput`] or `tf.Tensor`: A [`~utils.ModelOutput`] (if `return_dict_in_generate=True` or when
|
||||||
`return_dict_in_generate=True` or when `config.return_dict_in_generate=True`) or a `tf.Tensor`.
|
`config.return_dict_in_generate=True`) or a `tf.Tensor`.
|
||||||
|
|
||||||
If the model is *not* an encoder-decoder model (`model.config.is_encoder_decoder=False`), the possible
|
If the model is *not* an encoder-decoder model (`model.config.is_encoder_decoder=False`), the possible
|
||||||
[`~file_utils.ModelOutput`] types are:
|
[`~utils.ModelOutput`] types are:
|
||||||
|
|
||||||
- [`~generation_tf_utils.TFGreedySearchDecoderOnlyOutput`],
|
- [`~generation_tf_utils.TFGreedySearchDecoderOnlyOutput`],
|
||||||
- [`~generation_tf_utils.TFSampleDecoderOnlyOutput`],
|
- [`~generation_tf_utils.TFSampleDecoderOnlyOutput`],
|
||||||
@ -1393,7 +1393,7 @@ class TFGenerationMixin:
|
|||||||
- [`~generation_tf_utils.TFBeamSampleDecoderOnlyOutput`]
|
- [`~generation_tf_utils.TFBeamSampleDecoderOnlyOutput`]
|
||||||
|
|
||||||
If the model is an encoder-decoder model (`model.config.is_encoder_decoder=True`), the possible
|
If the model is an encoder-decoder model (`model.config.is_encoder_decoder=True`), the possible
|
||||||
[`~file_utils.ModelOutput`] types are:
|
[`~utils.ModelOutput`] types are:
|
||||||
|
|
||||||
- [`~generation_tf_utils.TFGreedySearchEncoderDecoderOutput`],
|
- [`~generation_tf_utils.TFGreedySearchEncoderDecoderOutput`],
|
||||||
- [`~generation_tf_utils.TFSampleEncoderDecoderOutput`],
|
- [`~generation_tf_utils.TFSampleEncoderDecoderOutput`],
|
||||||
@ -1822,7 +1822,7 @@ class TFGenerationMixin:
|
|||||||
output_scores (`bool`, *optional*, defaults to `False`):
|
output_scores (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return the prediction scores. See `scores` under returned tensors for more details.
|
Whether or not to return the prediction scores. See `scores` under returned tensors for more details.
|
||||||
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
model_kwargs:
|
model_kwargs:
|
||||||
Additional model specific keyword arguments will be forwarded to the `call` function of the model. If
|
Additional model specific keyword arguments will be forwarded to the `call` function of the model. If
|
||||||
model is an encoder-decoder model the kwargs should include `encoder_outputs`.
|
model is an encoder-decoder model the kwargs should include `encoder_outputs`.
|
||||||
@ -2085,7 +2085,7 @@ class TFGenerationMixin:
|
|||||||
output_scores (`bool`, *optional*, defaults to `False`):
|
output_scores (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return the prediction scores. See `scores` under returned tensors for more details.
|
Whether or not to return the prediction scores. See `scores` under returned tensors for more details.
|
||||||
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
model_kwargs:
|
model_kwargs:
|
||||||
Additional model specific kwargs will be forwarded to the `call` function of the model. If model is an
|
Additional model specific kwargs will be forwarded to the `call` function of the model. If model is an
|
||||||
encoder-decoder model the kwargs should include `encoder_outputs`.
|
encoder-decoder model the kwargs should include `encoder_outputs`.
|
||||||
|
@ -1003,7 +1003,7 @@ class GenerationMixin:
|
|||||||
output_scores (`bool`, *optional*, defaults to `False`):
|
output_scores (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return the prediction scores. See `scores` under returned tensors for more details.
|
Whether or not to return the prediction scores. See `scores` under returned tensors for more details.
|
||||||
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
forced_bos_token_id (`int`, *optional*):
|
forced_bos_token_id (`int`, *optional*):
|
||||||
The id of the token to force as the first generated token after the `decoder_start_token_id`. Useful
|
The id of the token to force as the first generated token after the `decoder_start_token_id`. Useful
|
||||||
for multilingual models like [mBART](../model_doc/mbart) where the first generated token needs to be
|
for multilingual models like [mBART](../model_doc/mbart) where the first generated token needs to be
|
||||||
@ -1026,11 +1026,11 @@ class GenerationMixin:
|
|||||||
should be prefixed with *decoder_*.
|
should be prefixed with *decoder_*.
|
||||||
|
|
||||||
Return:
|
Return:
|
||||||
[`~file_utils.ModelOutput`] or `torch.LongTensor`: A [`~file_utils.ModelOutput`] (if
|
[`~utils.ModelOutput`] or `torch.LongTensor`: A [`~utils.ModelOutput`] (if `return_dict_in_generate=True`
|
||||||
`return_dict_in_generate=True` or when `config.return_dict_in_generate=True`) or a `torch.FloatTensor`.
|
or when `config.return_dict_in_generate=True`) or a `torch.FloatTensor`.
|
||||||
|
|
||||||
If the model is *not* an encoder-decoder model (`model.config.is_encoder_decoder=False`), the possible
|
If the model is *not* an encoder-decoder model (`model.config.is_encoder_decoder=False`), the possible
|
||||||
[`~file_utils.ModelOutput`] types are:
|
[`~utils.ModelOutput`] types are:
|
||||||
|
|
||||||
- [`~generation_utils.GreedySearchDecoderOnlyOutput`],
|
- [`~generation_utils.GreedySearchDecoderOnlyOutput`],
|
||||||
- [`~generation_utils.SampleDecoderOnlyOutput`],
|
- [`~generation_utils.SampleDecoderOnlyOutput`],
|
||||||
@ -1038,7 +1038,7 @@ class GenerationMixin:
|
|||||||
- [`~generation_utils.BeamSampleDecoderOnlyOutput`]
|
- [`~generation_utils.BeamSampleDecoderOnlyOutput`]
|
||||||
|
|
||||||
If the model is an encoder-decoder model (`model.config.is_encoder_decoder=True`), the possible
|
If the model is an encoder-decoder model (`model.config.is_encoder_decoder=True`), the possible
|
||||||
[`~file_utils.ModelOutput`] types are:
|
[`~utils.ModelOutput`] types are:
|
||||||
|
|
||||||
- [`~generation_utils.GreedySearchEncoderDecoderOutput`],
|
- [`~generation_utils.GreedySearchEncoderDecoderOutput`],
|
||||||
- [`~generation_utils.SampleEncoderDecoderOutput`],
|
- [`~generation_utils.SampleEncoderDecoderOutput`],
|
||||||
@ -1531,7 +1531,7 @@ class GenerationMixin:
|
|||||||
output_scores (`bool`, *optional*, defaults to `False`):
|
output_scores (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return the prediction scores. See `scores` under returned tensors for more details.
|
Whether or not to return the prediction scores. See `scores` under returned tensors for more details.
|
||||||
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
synced_gpus (`bool`, *optional*, defaults to `False`):
|
synced_gpus (`bool`, *optional*, defaults to `False`):
|
||||||
Whether to continue running the while loop until max_length (needed for ZeRO stage 3)
|
Whether to continue running the while loop until max_length (needed for ZeRO stage 3)
|
||||||
model_kwargs:
|
model_kwargs:
|
||||||
@ -1767,7 +1767,7 @@ class GenerationMixin:
|
|||||||
output_scores (`bool`, *optional*, defaults to `False`):
|
output_scores (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return the prediction scores. See `scores` under returned tensors for more details.
|
Whether or not to return the prediction scores. See `scores` under returned tensors for more details.
|
||||||
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
synced_gpus (`bool`, *optional*, defaults to `False`):
|
synced_gpus (`bool`, *optional*, defaults to `False`):
|
||||||
Whether to continue running the while loop until max_length (needed for ZeRO stage 3)
|
Whether to continue running the while loop until max_length (needed for ZeRO stage 3)
|
||||||
model_kwargs:
|
model_kwargs:
|
||||||
@ -2022,7 +2022,7 @@ class GenerationMixin:
|
|||||||
output_scores (`bool`, *optional*, defaults to `False`):
|
output_scores (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return the prediction scores. See `scores` under returned tensors for more details.
|
Whether or not to return the prediction scores. See `scores` under returned tensors for more details.
|
||||||
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
synced_gpus (`bool`, *optional*, defaults to `False`):
|
synced_gpus (`bool`, *optional*, defaults to `False`):
|
||||||
Whether to continue running the while loop until max_length (needed for ZeRO stage 3)
|
Whether to continue running the while loop until max_length (needed for ZeRO stage 3)
|
||||||
model_kwargs:
|
model_kwargs:
|
||||||
@ -2339,7 +2339,7 @@ class GenerationMixin:
|
|||||||
output_scores (`bool`, *optional*, defaults to `False`):
|
output_scores (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return the prediction scores. See `scores` under returned tensors for more details.
|
Whether or not to return the prediction scores. See `scores` under returned tensors for more details.
|
||||||
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
synced_gpus (`bool`, *optional*, defaults to `False`):
|
synced_gpus (`bool`, *optional*, defaults to `False`):
|
||||||
Whether to continue running the while loop until max_length (needed for ZeRO stage 3)
|
Whether to continue running the while loop until max_length (needed for ZeRO stage 3)
|
||||||
model_kwargs:
|
model_kwargs:
|
||||||
@ -2656,7 +2656,7 @@ class GenerationMixin:
|
|||||||
output_scores (`bool`, *optional*, defaults to `False`):
|
output_scores (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return the prediction scores. See `scores` under returned tensors for more details.
|
Whether or not to return the prediction scores. See `scores` under returned tensors for more details.
|
||||||
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
synced_gpus (`bool`, *optional*, defaults to `False`):
|
synced_gpus (`bool`, *optional*, defaults to `False`):
|
||||||
Whether to continue running the while loop until max_length (needed for ZeRO stage 3)
|
Whether to continue running the while loop until max_length (needed for ZeRO stage 3)
|
||||||
|
|
||||||
@ -3026,7 +3026,7 @@ class GenerationMixin:
|
|||||||
output_scores (`bool`, *optional*, defaults to `False`):
|
output_scores (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return the prediction scores. See `scores` under returned tensors for more details.
|
Whether or not to return the prediction scores. See `scores` under returned tensors for more details.
|
||||||
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
return_dict_in_generate (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
synced_gpus (`bool`, *optional*, defaults to `False`):
|
synced_gpus (`bool`, *optional*, defaults to `False`):
|
||||||
Whether to continue running the while loop until max_length (needed for ZeRO stage 3)
|
Whether to continue running the while loop until max_length (needed for ZeRO stage 3)
|
||||||
model_kwargs:
|
model_kwargs:
|
||||||
|
@ -681,7 +681,7 @@ class FlaxPreTrainedModel(PushToHubMixin, FlaxGenerationMixin):
|
|||||||
</Tip>
|
</Tip>
|
||||||
|
|
||||||
kwargs:
|
kwargs:
|
||||||
Additional key word arguments passed along to the [`~file_utils.PushToHubMixin.push_to_hub`] method.
|
Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method.
|
||||||
"""
|
"""
|
||||||
if os.path.isfile(save_directory):
|
if os.path.isfile(save_directory):
|
||||||
logger.error(f"Provided path ({save_directory}) should be a directory, not a file")
|
logger.error(f"Provided path ({save_directory}) should be a directory, not a file")
|
||||||
|
@ -1401,7 +1401,7 @@ class TFPreTrainedModel(tf.keras.Model, TFModelUtilsMixin, TFGenerationMixin, Pu
|
|||||||
</Tip>
|
</Tip>
|
||||||
|
|
||||||
kwargs:
|
kwargs:
|
||||||
Additional key word arguments passed along to the [`~file_utils.PushToHubMixin.push_to_hub`] method.
|
Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method.
|
||||||
"""
|
"""
|
||||||
if os.path.isfile(save_directory):
|
if os.path.isfile(save_directory):
|
||||||
logger.error(f"Provided path ({save_directory}) should be a directory, not a file")
|
logger.error(f"Provided path ({save_directory}) should be a directory, not a file")
|
||||||
|
@ -1036,7 +1036,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
|
|||||||
</Tip>
|
</Tip>
|
||||||
|
|
||||||
kwargs:
|
kwargs:
|
||||||
Additional key word arguments passed along to the [`~file_utils.PushToHubMixin.push_to_hub`] method.
|
Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method.
|
||||||
"""
|
"""
|
||||||
if os.path.isfile(save_directory):
|
if os.path.isfile(save_directory):
|
||||||
logger.error(f"Provided path ({save_directory}) should be a directory, not a file")
|
logger.error(f"Provided path ({save_directory}) should be a directory, not a file")
|
||||||
@ -2129,7 +2129,7 @@ class SQuADHead(nn.Module):
|
|||||||
Mask for tokens at invalid position, such as query and special symbols (PAD, SEP, CLS). 1.0 means token
|
Mask for tokens at invalid position, such as query and special symbols (PAD, SEP, CLS). 1.0 means token
|
||||||
should be masked.
|
should be masked.
|
||||||
return_dict (`bool`, *optional*, defaults to `False`):
|
return_dict (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
|
@ -610,7 +610,7 @@ ALBERT_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ ALBERT_INPUTS_DOCSTRING = r"""
|
|||||||
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,
|
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,
|
||||||
config.max_position_embeddings - 1]`.
|
config.max_position_embeddings - 1]`.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -747,8 +747,8 @@ ALBERT_INPUTS_DOCSTRING = r"""
|
|||||||
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
||||||
used instead.
|
used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used in
|
||||||
in eager mode, in graph mode the value will always be set to True.
|
eager mode, in graph mode the value will always be set to True.
|
||||||
training (`bool`, *optional*, defaults to `False`):
|
training (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
|
@ -679,7 +679,7 @@ BART_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -770,7 +770,7 @@ class BartEncoder(BartPretrainedModel):
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
||||||
for more detail.
|
for more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
||||||
output_hidden_states = (
|
output_hidden_states = (
|
||||||
@ -993,7 +993,7 @@ class BartDecoder(BartPretrainedModel):
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
||||||
for more detail.
|
for more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
||||||
output_hidden_states = (
|
output_hidden_states = (
|
||||||
@ -1799,7 +1799,7 @@ class BartForCausalLM(BartPretrainedModel):
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
||||||
for more detail.
|
for more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ BART_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ BART_ENCODE_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
BART_DECODE_INPUTS_DOCSTRING = r"""
|
BART_DECODE_INPUTS_DOCSTRING = r"""
|
||||||
@ -215,7 +215,7 @@ BART_DECODE_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -625,8 +625,8 @@ BART_INPUTS_DOCSTRING = r"""
|
|||||||
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
||||||
used instead.
|
used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used in
|
||||||
in eager mode, in graph mode the value will always be set to True.
|
eager mode, in graph mode the value will always be set to True.
|
||||||
training (`bool`, *optional*, defaults to `False`):
|
training (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
@ -715,7 +715,7 @@ class TFBartEncoder(tf.keras.layers.Layer):
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
||||||
for more detail.
|
for more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if input_ids is not None and inputs_embeds is not None:
|
if input_ids is not None and inputs_embeds is not None:
|
||||||
@ -894,7 +894,7 @@ class TFBartDecoder(tf.keras.layers.Layer):
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
||||||
for more detail.
|
for more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if input_ids is not None and inputs_embeds is not None:
|
if input_ids is not None and inputs_embeds is not None:
|
||||||
|
@ -120,7 +120,7 @@ class BeitFeatureExtractor(FeatureExtractionMixin, ImageFeatureExtractionMixin):
|
|||||||
segmentation_maps (`PIL.Image.Image`, `np.ndarray`, `torch.Tensor`, `List[PIL.Image.Image]`, `List[np.ndarray]`, `List[torch.Tensor]`, *optional*):
|
segmentation_maps (`PIL.Image.Image`, `np.ndarray`, `torch.Tensor`, `List[PIL.Image.Image]`, `List[np.ndarray]`, `List[torch.Tensor]`, *optional*):
|
||||||
Optionally, the corresponding semantic segmentation maps with the pixel-wise annotations.
|
Optionally, the corresponding semantic segmentation maps with the pixel-wise annotations.
|
||||||
|
|
||||||
return_tensors (`str` or [`~file_utils.TensorType`], *optional*, defaults to `'np'`):
|
return_tensors (`str` or [`~utils.TensorType`], *optional*, defaults to `'np'`):
|
||||||
If set, will return tensors of a particular framework. Acceptable values are:
|
If set, will return tensors of a particular framework. Acceptable values are:
|
||||||
|
|
||||||
- `'tf'`: Return TensorFlow `tf.constant` objects.
|
- `'tf'`: Return TensorFlow `tf.constant` objects.
|
||||||
|
@ -618,7 +618,7 @@ BEIT_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ BEIT_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -837,7 +837,7 @@ BERT_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ BERT_INPUTS_DOCSTRING = r"""
|
|||||||
- 0 indicates the head is **masked**.
|
- 0 indicates the head is **masked**.
|
||||||
|
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -1025,8 +1025,8 @@ BERT_INPUTS_DOCSTRING = r"""
|
|||||||
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
||||||
used instead.
|
used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used in
|
||||||
in eager mode, in graph mode the value will always be set to True.
|
eager mode, in graph mode the value will always be set to True.
|
||||||
training (`bool`, *optional*, defaults to `False``):
|
training (`bool`, *optional*, defaults to `False``):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
|
@ -242,7 +242,7 @@ BERT_GENERATION_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -1844,7 +1844,7 @@ BIG_BIRD_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ BIG_BIRD_INPUTS_DOCSTRING = r"""
|
|||||||
- 0 indicates the head is **masked**.
|
- 0 indicates the head is **masked**.
|
||||||
|
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -1724,7 +1724,7 @@ BIGBIRD_PEGASUS_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
BIGBIRD_PEGASUS_STANDALONE_INPUTS_DOCSTRING = r"""
|
BIGBIRD_PEGASUS_STANDALONE_INPUTS_DOCSTRING = r"""
|
||||||
@ -1751,7 +1751,7 @@ BIGBIRD_PEGASUS_STANDALONE_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -1834,7 +1834,7 @@ class BigBirdPegasusEncoder(BigBirdPegasusPreTrainedModel):
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
||||||
for more detail.
|
for more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
||||||
output_hidden_states = (
|
output_hidden_states = (
|
||||||
@ -2188,7 +2188,7 @@ class BigBirdPegasusDecoder(BigBirdPegasusPreTrainedModel):
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
||||||
for more detail.
|
for more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
||||||
output_hidden_states = (
|
output_hidden_states = (
|
||||||
@ -2999,7 +2999,7 @@ class BigBirdPegasusForCausalLM(BigBirdPegasusPreTrainedModel):
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
||||||
for more detail.
|
for more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
|
@ -625,7 +625,7 @@ BLENDERBOT_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -710,7 +710,7 @@ class BlenderbotEncoder(BlenderbotPreTrainedModel):
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
||||||
for more detail.
|
for more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
||||||
output_hidden_states = (
|
output_hidden_states = (
|
||||||
@ -935,7 +935,7 @@ class BlenderbotDecoder(BlenderbotPreTrainedModel):
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
||||||
for more detail.
|
for more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
||||||
output_hidden_states = (
|
output_hidden_states = (
|
||||||
@ -1518,7 +1518,7 @@ class BlenderbotForCausalLM(BlenderbotPreTrainedModel):
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
||||||
for more detail.
|
for more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ BLENDERBOT_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ BLENDERBOT_ENCODE_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
BLENDERBOT_DECODE_INPUTS_DOCSTRING = r"""
|
BLENDERBOT_DECODE_INPUTS_DOCSTRING = r"""
|
||||||
@ -201,7 +201,7 @@ BLENDERBOT_DECODE_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -608,8 +608,8 @@ BLENDERBOT_INPUTS_DOCSTRING = r"""
|
|||||||
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
||||||
used instead.
|
used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used in
|
||||||
in eager mode, in graph mode the value will always be set to True.
|
eager mode, in graph mode the value will always be set to True.
|
||||||
training (`bool`, *optional*, defaults to `False`):
|
training (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
@ -700,8 +700,8 @@ class TFBlenderbotEncoder(tf.keras.layers.Layer):
|
|||||||
for more detail. This argument can be used only in eager mode, in graph mode the value in the config
|
for more detail. This argument can be used only in eager mode, in graph mode the value in the config
|
||||||
will be used instead.
|
will be used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
||||||
used in eager mode, in graph mode the value will always be set to True.
|
in eager mode, in graph mode the value will always be set to True.
|
||||||
training (`bool`, *optional*, defaults to `False`):
|
training (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
@ -885,8 +885,8 @@ class TFBlenderbotDecoder(tf.keras.layers.Layer):
|
|||||||
for more detail. This argument can be used only in eager mode, in graph mode the value in the config
|
for more detail. This argument can be used only in eager mode, in graph mode the value in the config
|
||||||
will be used instead.
|
will be used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
||||||
used in eager mode, in graph mode the value will always be set to True.
|
in eager mode, in graph mode the value will always be set to True.
|
||||||
training (`bool`, *optional*, defaults to `False`):
|
training (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
|
@ -623,7 +623,7 @@ BLENDERBOT_SMALL_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -708,7 +708,7 @@ class BlenderbotSmallEncoder(BlenderbotSmallPreTrainedModel):
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
||||||
for more detail.
|
for more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
||||||
output_hidden_states = (
|
output_hidden_states = (
|
||||||
@ -930,7 +930,7 @@ class BlenderbotSmallDecoder(BlenderbotSmallPreTrainedModel):
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
||||||
for more detail.
|
for more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
||||||
output_hidden_states = (
|
output_hidden_states = (
|
||||||
@ -1489,7 +1489,7 @@ class BlenderbotSmallForCausalLM(BlenderbotSmallPreTrainedModel):
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
||||||
for more detail.
|
for more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ BLENDERBOT_SMALL_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ BLENDERBOT_SMALL_ENCODE_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
BLENDERBOT_SMALL_DECODE_INPUTS_DOCSTRING = r"""
|
BLENDERBOT_SMALL_DECODE_INPUTS_DOCSTRING = r"""
|
||||||
@ -213,7 +213,7 @@ BLENDERBOT_SMALL_DECODE_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -613,8 +613,8 @@ BLENDERBOT_SMALL_INPUTS_DOCSTRING = r"""
|
|||||||
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
||||||
used instead.
|
used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used in
|
||||||
in eager mode, in graph mode the value will always be set to True.
|
eager mode, in graph mode the value will always be set to True.
|
||||||
training (`bool`, *optional*, defaults to `False`):
|
training (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
@ -705,8 +705,8 @@ class TFBlenderbotSmallEncoder(tf.keras.layers.Layer):
|
|||||||
for more detail. This argument can be used only in eager mode, in graph mode the value in the config
|
for more detail. This argument can be used only in eager mode, in graph mode the value in the config
|
||||||
will be used instead.
|
will be used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
||||||
used in eager mode, in graph mode the value will always be set to True.
|
in eager mode, in graph mode the value will always be set to True.
|
||||||
training (`bool`, *optional*, defaults to `False`):
|
training (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
@ -889,8 +889,8 @@ class TFBlenderbotSmallDecoder(tf.keras.layers.Layer):
|
|||||||
for more detail. This argument can be used only in eager mode, in graph mode the value in the config
|
for more detail. This argument can be used only in eager mode, in graph mode the value in the config
|
||||||
will be used instead.
|
will be used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
||||||
used in eager mode, in graph mode the value will always be set to True.
|
in eager mode, in graph mode the value will always be set to True.
|
||||||
training (`bool`, *optional*, defaults to `False`):
|
training (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
|
@ -975,7 +975,7 @@ CANINE_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ class CLIPFeatureExtractor(FeatureExtractionMixin, ImageFeatureExtractionMixin):
|
|||||||
tensor. In case of a NumPy array/PyTorch tensor, each image should be of shape (C, H, W), where C is a
|
tensor. In case of a NumPy array/PyTorch tensor, each image should be of shape (C, H, W), where C is a
|
||||||
number of channels, H and W are image height and width.
|
number of channels, H and W are image height and width.
|
||||||
|
|
||||||
return_tensors (`str` or [`~file_utils.TensorType`], *optional*, defaults to `'np'`):
|
return_tensors (`str` or [`~utils.TensorType`], *optional*, defaults to `'np'`):
|
||||||
If set, will return tensors of a particular framework. Acceptable values are:
|
If set, will return tensors of a particular framework. Acceptable values are:
|
||||||
|
|
||||||
- `'tf'`: Return TensorFlow `tf.constant` objects.
|
- `'tf'`: Return TensorFlow `tf.constant` objects.
|
||||||
|
@ -433,7 +433,7 @@ CLIP_TEXT_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
CLIP_VISION_INPUTS_DOCSTRING = r"""
|
CLIP_VISION_INPUTS_DOCSTRING = r"""
|
||||||
@ -448,7 +448,7 @@ CLIP_VISION_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
CLIP_INPUTS_DOCSTRING = r"""
|
CLIP_INPUTS_DOCSTRING = r"""
|
||||||
@ -485,7 +485,7 @@ CLIP_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -540,7 +540,7 @@ class CLIPEncoder(nn.Module):
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
||||||
for more detail.
|
for more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
||||||
output_hidden_states = (
|
output_hidden_states = (
|
||||||
|
@ -100,7 +100,7 @@ CLIP_TEXT_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
CLIP_VISION_INPUTS_DOCSTRING = r"""
|
CLIP_VISION_INPUTS_DOCSTRING = r"""
|
||||||
@ -115,7 +115,7 @@ CLIP_VISION_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
CLIP_INPUTS_DOCSTRING = r"""
|
CLIP_INPUTS_DOCSTRING = r"""
|
||||||
@ -150,7 +150,7 @@ CLIP_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -968,8 +968,8 @@ CLIP_TEXT_INPUTS_DOCSTRING = r"""
|
|||||||
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
||||||
used instead.
|
used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used in
|
||||||
in eager mode, in graph mode the value will always be set to True.
|
eager mode, in graph mode the value will always be set to True.
|
||||||
training (`bool`, *optional*, defaults to `False``):
|
training (`bool`, *optional*, defaults to `False``):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
@ -988,8 +988,8 @@ CLIP_VISION_INPUTS_DOCSTRING = r"""
|
|||||||
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
||||||
used instead.
|
used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used in
|
||||||
in eager mode, in graph mode the value will always be set to True.
|
eager mode, in graph mode the value will always be set to True.
|
||||||
training (`bool`, *optional*, defaults to `False``):
|
training (`bool`, *optional*, defaults to `False``):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
@ -1030,8 +1030,8 @@ CLIP_INPUTS_DOCSTRING = r"""
|
|||||||
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
||||||
used instead.
|
used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used in
|
||||||
in eager mode, in graph mode the value will always be set to True.
|
eager mode, in graph mode the value will always be set to True.
|
||||||
training (`bool`, *optional*, defaults to `False``):
|
training (`bool`, *optional*, defaults to `False``):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
|
@ -57,7 +57,7 @@ class CLIPProcessor(ProcessorMixin):
|
|||||||
tensor. In case of a NumPy array/PyTorch tensor, each image should be of shape (C, H, W), where C is a
|
tensor. In case of a NumPy array/PyTorch tensor, each image should be of shape (C, H, W), where C is a
|
||||||
number of channels, H and W are image height and width.
|
number of channels, H and W are image height and width.
|
||||||
|
|
||||||
return_tensors (`str` or [`~file_utils.TensorType`], *optional*):
|
return_tensors (`str` or [`~utils.TensorType`], *optional*):
|
||||||
If set, will return tensors of a particular framework. Acceptable values are:
|
If set, will return tensors of a particular framework. Acceptable values are:
|
||||||
|
|
||||||
- `'tf'`: Return TensorFlow `tf.constant` objects.
|
- `'tf'`: Return TensorFlow `tf.constant` objects.
|
||||||
|
@ -755,7 +755,7 @@ CONVBERT_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -736,8 +736,8 @@ CONVBERT_INPUTS_DOCSTRING = r"""
|
|||||||
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
||||||
used instead.
|
used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used in
|
||||||
in eager mode, in graph mode the value will always be set to True.
|
eager mode, in graph mode the value will always be set to True.
|
||||||
training (`bool`, *optional*, defaults to `False`):
|
training (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
|
@ -103,7 +103,7 @@ class ConvNextFeatureExtractor(FeatureExtractionMixin, ImageFeatureExtractionMix
|
|||||||
tensor. In case of a NumPy array/PyTorch tensor, each image should be of shape (C, H, W), where C is a
|
tensor. In case of a NumPy array/PyTorch tensor, each image should be of shape (C, H, W), where C is a
|
||||||
number of channels, H and W are image height and width.
|
number of channels, H and W are image height and width.
|
||||||
|
|
||||||
return_tensors (`str` or [`~file_utils.TensorType`], *optional*, defaults to `'np'`):
|
return_tensors (`str` or [`~utils.TensorType`], *optional*, defaults to `'np'`):
|
||||||
If set, will return tensors of a particular framework. Acceptable values are:
|
If set, will return tensors of a particular framework. Acceptable values are:
|
||||||
|
|
||||||
- `'tf'`: Return TensorFlow `tf.constant` objects.
|
- `'tf'`: Return TensorFlow `tf.constant` objects.
|
||||||
|
@ -357,7 +357,7 @@ CONVNEXT_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -416,8 +416,8 @@ CONVNEXT_INPUTS_DOCSTRING = r"""
|
|||||||
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
||||||
used instead.
|
used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used in
|
||||||
in eager mode, in graph mode the value will always be set to True.
|
eager mode, in graph mode the value will always be set to True.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ CTRL_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -502,8 +502,8 @@ CTRL_INPUTS_DOCSTRING = r"""
|
|||||||
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
||||||
used instead.
|
used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used in
|
||||||
in eager mode, in graph mode the value will always be set to True.
|
eager mode, in graph mode the value will always be set to True.
|
||||||
training (`bool`, *optional*, defaults to `False`):
|
training (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
|
@ -887,7 +887,7 @@ DATA2VEC_AUDIO_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -689,7 +689,7 @@ DATA2VECTEXT_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -871,7 +871,7 @@ DEBERTA_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -1063,7 +1063,7 @@ DEBERTA_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~transformers.file_utils.ModelOutput``] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput``] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -965,7 +965,7 @@ DEBERTA_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -1164,7 +1164,7 @@ DEBERTA_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~transformers.file_utils.ModelOutput``] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput``] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
# rely on isort to merge the imports
|
# rely on isort to merge the imports
|
||||||
from ...file_utils import _LazyModule, is_torch_available
|
from ...utils import _LazyModule, is_torch_available
|
||||||
|
|
||||||
|
|
||||||
_import_structure = {
|
_import_structure = {
|
||||||
|
@ -25,14 +25,14 @@ from packaging import version
|
|||||||
from torch import nn
|
from torch import nn
|
||||||
|
|
||||||
from ...activations import ACT2FN
|
from ...activations import ACT2FN
|
||||||
from ...file_utils import (
|
from ...modeling_utils import Conv1D, PreTrainedModel, find_pruneable_heads_and_indices, prune_conv1d_layer
|
||||||
|
from ...utils import (
|
||||||
ModelOutput,
|
ModelOutput,
|
||||||
add_start_docstrings,
|
add_start_docstrings,
|
||||||
add_start_docstrings_to_model_forward,
|
add_start_docstrings_to_model_forward,
|
||||||
|
logging,
|
||||||
replace_return_docstrings,
|
replace_return_docstrings,
|
||||||
)
|
)
|
||||||
from ...modeling_utils import Conv1D, PreTrainedModel, find_pruneable_heads_and_indices, prune_conv1d_layer
|
|
||||||
from ...utils import logging
|
|
||||||
|
|
||||||
|
|
||||||
if version.parse(torch.__version__) >= version.parse("1.6"):
|
if version.parse(torch.__version__) >= version.parse("1.6"):
|
||||||
|
@ -107,7 +107,7 @@ class DeiTFeatureExtractor(FeatureExtractionMixin, ImageFeatureExtractionMixin):
|
|||||||
tensor. In case of a NumPy array/PyTorch tensor, each image should be of shape (C, H, W), where C is a
|
tensor. In case of a NumPy array/PyTorch tensor, each image should be of shape (C, H, W), where C is a
|
||||||
number of channels, H and W are image height and width.
|
number of channels, H and W are image height and width.
|
||||||
|
|
||||||
return_tensors (`str` or [`~file_utils.TensorType`], *optional*, defaults to `'np'`):
|
return_tensors (`str` or [`~utils.TensorType`], *optional*, defaults to `'np'`):
|
||||||
If set, will return tensors of a particular framework. Acceptable values are:
|
If set, will return tensors of a particular framework. Acceptable values are:
|
||||||
|
|
||||||
- `'tf'`: Return TensorFlow `tf.constant` objects.
|
- `'tf'`: Return TensorFlow `tf.constant` objects.
|
||||||
|
@ -460,7 +460,7 @@ DEIT_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -455,7 +455,7 @@ class DetrFeatureExtractor(FeatureExtractionMixin, ImageFeatureExtractionMixin):
|
|||||||
- 1 for pixels that are real (i.e. **not masked**),
|
- 1 for pixels that are real (i.e. **not masked**),
|
||||||
- 0 for pixels that are padding (i.e. **masked**).
|
- 0 for pixels that are padding (i.e. **masked**).
|
||||||
|
|
||||||
return_tensors (`str` or [`~file_utils.TensorType`], *optional*):
|
return_tensors (`str` or [`~utils.TensorType`], *optional*):
|
||||||
If set, will return tensors instead of NumPy arrays. If set to `'pt'`, return PyTorch `torch.Tensor`
|
If set, will return tensors instead of NumPy arrays. If set to `'pt'`, return PyTorch `torch.Tensor`
|
||||||
objects.
|
objects.
|
||||||
|
|
||||||
@ -638,7 +638,7 @@ class DetrFeatureExtractor(FeatureExtractionMixin, ImageFeatureExtractionMixin):
|
|||||||
Args:
|
Args:
|
||||||
pixel_values_list (`List[torch.Tensor]`):
|
pixel_values_list (`List[torch.Tensor]`):
|
||||||
List of images (pixel values) to be padded. Each image should be a tensor of shape (C, H, W).
|
List of images (pixel values) to be padded. Each image should be a tensor of shape (C, H, W).
|
||||||
return_tensors (`str` or [`~file_utils.TensorType`], *optional*):
|
return_tensors (`str` or [`~utils.TensorType`], *optional*):
|
||||||
If set, will return tensors instead of NumPy arrays. If set to `'pt'`, return PyTorch `torch.Tensor`
|
If set, will return tensors instead of NumPy arrays. If set to `'pt'`, return PyTorch `torch.Tensor`
|
||||||
objects.
|
objects.
|
||||||
|
|
||||||
|
@ -868,7 +868,7 @@ DETR_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -932,7 +932,7 @@ class DetrEncoder(DetrPreTrainedModel):
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
||||||
for more detail.
|
for more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
||||||
output_hidden_states = (
|
output_hidden_states = (
|
||||||
@ -1054,7 +1054,7 @@ class DetrDecoder(DetrPreTrainedModel):
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
||||||
for more detail.
|
for more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
||||||
output_hidden_states = (
|
output_hidden_states = (
|
||||||
|
@ -446,7 +446,7 @@ DISTILBERT_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ DISTILBERT_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -508,8 +508,8 @@ DISTILBERT_INPUTS_DOCSTRING = r"""
|
|||||||
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
||||||
used instead.
|
used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used in
|
||||||
in eager mode, in graph mode the value will always be set to True.
|
eager mode, in graph mode the value will always be set to True.
|
||||||
training (`bool`, *optional*, defaults to `False`):
|
training (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
|
@ -398,7 +398,7 @@ DPR_ENCODERS_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
DPR_READER_INPUTS_DOCSTRING = r"""
|
DPR_READER_INPUTS_DOCSTRING = r"""
|
||||||
@ -434,7 +434,7 @@ DPR_READER_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -487,8 +487,8 @@ TF_DPR_ENCODERS_INPUTS_DOCSTRING = r"""
|
|||||||
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
||||||
used instead.
|
used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used in
|
||||||
in eager mode, in graph mode the value will always be set to True.
|
eager mode, in graph mode the value will always be set to True.
|
||||||
training (`bool`, *optional*, defaults to `False`):
|
training (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
@ -523,8 +523,8 @@ TF_DPR_READER_INPUTS_DOCSTRING = r"""
|
|||||||
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
||||||
used instead.
|
used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used in
|
||||||
in eager mode, in graph mode the value will always be set to True.
|
eager mode, in graph mode the value will always be set to True.
|
||||||
training (`bool`, *optional*, defaults to `False`):
|
training (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
|
@ -144,7 +144,7 @@ CUSTOM_DPR_READER_DOCSTRING = r"""
|
|||||||
The passages titles to be encoded. This can be a string or a list of strings if there are several passages.
|
The passages titles to be encoded. This can be a string or a list of strings if there are several passages.
|
||||||
texts (`str` or `List[str]`):
|
texts (`str` or `List[str]`):
|
||||||
The passages texts to be encoded. This can be a string or a list of strings if there are several passages.
|
The passages texts to be encoded. This can be a string or a list of strings if there are several passages.
|
||||||
padding (`bool`, `str` or [`~file_utils.PaddingStrategy`], *optional*, defaults to `False`):
|
padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*, defaults to `False`):
|
||||||
Activates and controls padding. Accepts the following values:
|
Activates and controls padding. Accepts the following values:
|
||||||
|
|
||||||
- `True` or `'longest'`: Pad to the longest sequence in the batch (or no padding if only a single sequence
|
- `True` or `'longest'`: Pad to the longest sequence in the batch (or no padding if only a single sequence
|
||||||
@ -174,7 +174,7 @@ CUSTOM_DPR_READER_DOCSTRING = r"""
|
|||||||
If left unset or set to `None`, this will use the predefined model maximum length if a maximum length
|
If left unset or set to `None`, this will use the predefined model maximum length if a maximum length
|
||||||
is required by one of the truncation/padding parameters. If the model has no specific maximum input
|
is required by one of the truncation/padding parameters. If the model has no specific maximum input
|
||||||
length (like XLNet) truncation/padding to a maximum length will be deactivated.
|
length (like XLNet) truncation/padding to a maximum length will be deactivated.
|
||||||
return_tensors (`str` or [`~file_utils.TensorType`], *optional*):
|
return_tensors (`str` or [`~utils.TensorType`], *optional*):
|
||||||
If set, will return tensors instead of list of python integers. Acceptable values are:
|
If set, will return tensors instead of list of python integers. Acceptable values are:
|
||||||
|
|
||||||
- `'tf'`: Return TensorFlow `tf.constant` objects.
|
- `'tf'`: Return TensorFlow `tf.constant` objects.
|
||||||
|
@ -145,7 +145,7 @@ CUSTOM_DPR_READER_DOCSTRING = r"""
|
|||||||
The passages titles to be encoded. This can be a string or a list of strings if there are several passages.
|
The passages titles to be encoded. This can be a string or a list of strings if there are several passages.
|
||||||
texts (`str` or `List[str]`):
|
texts (`str` or `List[str]`):
|
||||||
The passages texts to be encoded. This can be a string or a list of strings if there are several passages.
|
The passages texts to be encoded. This can be a string or a list of strings if there are several passages.
|
||||||
padding (`bool`, `str` or [`~file_utils.PaddingStrategy`], *optional*, defaults to `False`):
|
padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*, defaults to `False`):
|
||||||
Activates and controls padding. Accepts the following values:
|
Activates and controls padding. Accepts the following values:
|
||||||
|
|
||||||
- `True` or `'longest'`: Pad to the longest sequence in the batch (or no padding if only a single sequence
|
- `True` or `'longest'`: Pad to the longest sequence in the batch (or no padding if only a single sequence
|
||||||
@ -175,7 +175,7 @@ CUSTOM_DPR_READER_DOCSTRING = r"""
|
|||||||
If left unset or set to `None`, this will use the predefined model maximum length if a maximum length
|
If left unset or set to `None`, this will use the predefined model maximum length if a maximum length
|
||||||
is required by one of the truncation/padding parameters. If the model has no specific maximum input
|
is required by one of the truncation/padding parameters. If the model has no specific maximum input
|
||||||
length (like XLNet) truncation/padding to a maximum length will be deactivated.
|
length (like XLNet) truncation/padding to a maximum length will be deactivated.
|
||||||
return_tensors (`str` or [`~file_utils.TensorType`], *optional*):
|
return_tensors (`str` or [`~utils.TensorType`], *optional*):
|
||||||
If set, will return tensors instead of list of python integers. Acceptable values are:
|
If set, will return tensors instead of list of python integers. Acceptable values are:
|
||||||
|
|
||||||
- `'tf'`: Return TensorFlow `tf.constant` objects.
|
- `'tf'`: Return TensorFlow `tf.constant` objects.
|
||||||
|
@ -794,7 +794,7 @@ ELECTRA_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ ELECTRA_INPUTS_DOCSTRING = r"""
|
|||||||
- 0 indicates the head is **masked**.
|
- 0 indicates the head is **masked**.
|
||||||
|
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -907,8 +907,8 @@ ELECTRA_INPUTS_DOCSTRING = r"""
|
|||||||
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
||||||
used instead.
|
used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used in
|
||||||
in eager mode, in graph mode the value will always be set to True.
|
eager mode, in graph mode the value will always be set to True.
|
||||||
training (`bool`, *optional*, defaults to `False`):
|
training (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
|
@ -135,7 +135,7 @@ ENCODER_DECODER_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
If set to `True`, the model will return a [`~file_utils.Seq2SeqLMOutput`] instead of a plain tuple.
|
If set to `True`, the model will return a [`~utils.Seq2SeqLMOutput`] instead of a plain tuple.
|
||||||
kwargs: (*optional*) Remaining dictionary of keyword arguments. Keyword arguments come in two flavors:
|
kwargs: (*optional*) Remaining dictionary of keyword arguments. Keyword arguments come in two flavors:
|
||||||
|
|
||||||
- Without a prefix which will be input as `**encoder_kwargs` for the encoder forward function.
|
- Without a prefix which will be input as `**encoder_kwargs` for the encoder forward function.
|
||||||
|
@ -122,7 +122,7 @@ ENCODER_DECODER_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
If set to `True`, the model will return a [`~file_utils.FlaxSeq2SeqLMOutput`] instead of a plain tuple.
|
If set to `True`, the model will return a [`~utils.FlaxSeq2SeqLMOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
ENCODER_DECODER_ENCODE_INPUTS_DOCSTRING = r"""
|
ENCODER_DECODER_ENCODE_INPUTS_DOCSTRING = r"""
|
||||||
@ -152,7 +152,7 @@ ENCODER_DECODER_ENCODE_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
If set to `True`, the model will return a [`~file_utils.FlaxBaseModelOutput`] instead of a plain tuple.
|
If set to `True`, the model will return a [`~utils.FlaxBaseModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
ENCODER_DECODER_DECODE_INPUTS_DOCSTRING = r"""
|
ENCODER_DECODER_DECODE_INPUTS_DOCSTRING = r"""
|
||||||
@ -198,8 +198,8 @@ ENCODER_DECODER_DECODE_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
If set to `True`, the model will return a [`~file_utils.FlaxCausalLMOutputWithCrossAttentions`] instead of
|
If set to `True`, the model will return a [`~utils.FlaxCausalLMOutputWithCrossAttentions`] instead of a
|
||||||
a plain tuple.
|
plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ ENCODER_DECODER_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
If set to `True`, the model will return a [`~file_utils.Seq2SeqLMOutput`] instead of a plain tuple.
|
If set to `True`, the model will return a [`~utils.Seq2SeqLMOutput`] instead of a plain tuple.
|
||||||
training (`bool`, *optional*, defaults to `False`):
|
training (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
|
@ -123,7 +123,7 @@ FLAUBERT_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -165,8 +165,8 @@ FLAUBERT_INPUTS_DOCSTRING = r"""
|
|||||||
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
||||||
used instead.
|
used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used in
|
||||||
in eager mode, in graph mode the value will always be set to True.
|
eager mode, in graph mode the value will always be set to True.
|
||||||
training (`bool`, *optional*, defaults to `False`):
|
training (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
|
@ -507,7 +507,7 @@ FNET_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ FSMT_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -913,7 +913,7 @@ FUNNEL_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -1079,8 +1079,8 @@ FUNNEL_INPUTS_DOCSTRING = r"""
|
|||||||
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
||||||
used instead.
|
used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used in
|
||||||
in eager mode, in graph mode the value will always be set to True.
|
eager mode, in graph mode the value will always be set to True.
|
||||||
training (`bool`, *optional*, defaults to `False`):
|
training (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
|
@ -86,7 +86,7 @@ class GLPNFeatureExtractor(FeatureExtractionMixin, ImageFeatureExtractionMixin):
|
|||||||
tensor. In case of a NumPy array/PyTorch tensor, each image should be of shape (C, H, W), where C is a
|
tensor. In case of a NumPy array/PyTorch tensor, each image should be of shape (C, H, W), where C is a
|
||||||
number of channels, H and W are image height and width.
|
number of channels, H and W are image height and width.
|
||||||
|
|
||||||
return_tensors (`str` or [`~file_utils.TensorType`], *optional*, defaults to `'np'`):
|
return_tensors (`str` or [`~utils.TensorType`], *optional*, defaults to `'np'`):
|
||||||
If set, will return tensors of a particular framework. Acceptable values are:
|
If set, will return tensors of a particular framework. Acceptable values are:
|
||||||
|
|
||||||
- `'tf'`: Return TensorFlow `tf.constant` objects.
|
- `'tf'`: Return TensorFlow `tf.constant` objects.
|
||||||
|
@ -467,7 +467,7 @@ GLPN_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ GPT2_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -607,7 +607,7 @@ GPT2_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
PARALLELIZE_DOCSTRING = r"""
|
PARALLELIZE_DOCSTRING = r"""
|
||||||
This is an experimental feature and is a subject to change at a moment's notice.
|
This is an experimental feature and is a subject to change at a moment's notice.
|
||||||
|
@ -715,8 +715,8 @@ GPT2_INPUTS_DOCSTRING = r"""
|
|||||||
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
||||||
used instead.
|
used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used in
|
||||||
in eager mode, in graph mode the value will always be set to True.
|
eager mode, in graph mode the value will always be set to True.
|
||||||
training (`bool`, *optional*, defaults to `False`):
|
training (`bool`, *optional*, defaults to `False`):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
|
@ -101,7 +101,7 @@ GPT_NEO_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -463,7 +463,7 @@ GPT_NEO_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ GPTJ_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ GPTJ_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
PARALLELIZE_DOCSTRING = r"""
|
PARALLELIZE_DOCSTRING = r"""
|
||||||
|
@ -931,7 +931,7 @@ HUBERT_INPUTS_DOCSTRING = r"""
|
|||||||
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
||||||
more detail.
|
more detail.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -1387,8 +1387,8 @@ HUBERT_INPUTS_DOCSTRING = r"""
|
|||||||
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
|
||||||
used instead.
|
used instead.
|
||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple. This argument can be used
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used in
|
||||||
in eager mode, in graph mode the value will always be set to True.
|
eager mode, in graph mode the value will always be set to True.
|
||||||
training (`bool`, *optional*, defaults to `False``):
|
training (`bool`, *optional*, defaults to `False``):
|
||||||
Whether or not to use the model in training mode (some modules like dropout modules have different
|
Whether or not to use the model in training mode (some modules like dropout modules have different
|
||||||
behaviors between training and evaluation).
|
behaviors between training and evaluation).
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user