text stringlengths 5 58.6k | source stringclasses 470
values | url stringlengths 49 167 | source_section stringlengths 0 90 | file_type stringclasses 1
value | id stringlengths 3 6 |
|---|---|---|---|---|---|
All pipelines can use batching. This will work
whenever the pipeline uses its streaming ability (so when passing lists or `Dataset` or `generator`).
```python
from transformers import pipeline
from transformers.pipelines.pt_utils import KeyDataset
import datasets
dataset = datasets.load_dataset("imdb", name="plain_t... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#pipeline-batching | #pipeline-batching | .md | 456_3 |
`zero-shot-classification` and `question-answering` are slightly specific in the sense, that a single input might yield
multiple forward pass of a model. Under normal circumstances, this would yield issues with `batch_size` argument.
In order to circumvent this issue, both of these pipelines are a bit specific, they ... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#pipeline-chunk-batching | #pipeline-chunk-batching | .md | 456_4 |
Models can be run in FP16 which can be significantly faster on GPU while saving memory. Most models will not suffer noticeable performance loss from this. The larger the model, the less likely that it will.
To enable FP16 inference, you can simply pass `torch_dtype=torch.float16` or `torch_dtype='float16'` to the pip... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#pipeline-fp16-inference | #pipeline-fp16-inference | .md | 456_5 |
If you want to override a specific pipeline.
Don't hesitate to create an issue for your task at hand, the goal of the pipeline is to be easy to use and support most
cases, so `transformers` could maybe support your use case.
If you want to try simply you can:
- Subclass your pipeline of choice
```python
class M... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#pipeline-custom-code | #pipeline-custom-code | .md | 456_6 |
[Implementing a new pipeline](../add_new_pipeline) | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#implementing-a-pipeline | #implementing-a-pipeline | .md | 456_7 |
Pipelines available for audio tasks include the following. | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#audio | #audio | .md | 456_8 |
Audio classification pipeline using any `AutoModelForAudioClassification`. This pipeline predicts the class of a
raw waveform or an audio file. In case of an audio file, ffmpeg should be installed to support multiple audio
formats.
Example:
```python
>>> from transformers import pipeline
>>> classifier = pipeline(... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#audioclassificationpipeline | #audioclassificationpipeline | .md | 456_9 |
Pipeline that aims at extracting spoken text contained within some audio.
The input can be either a raw waveform or a audio file. In case of the audio file, ffmpeg should be installed for
to support multiple audio formats
Example:
```python
>>> from transformers import pipeline
>>> transcriber = pipeline(model="... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#automaticspeechrecognitionpipeline | #automaticspeechrecognitionpipeline | .md | 456_10 |
Text-to-audio generation pipeline using any `AutoModelForTextToWaveform` or `AutoModelForTextToSpectrogram`. This
pipeline generates an audio file from an input text and optional other conditional inputs.
Example:
```python
>>> from transformers import pipeline
>>> pipe = pipeline(model="suno/bark-small")
>>> outp... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#texttoaudiopipeline | #texttoaudiopipeline | .md | 456_11 |
Zero shot audio classification pipeline using `ClapModel`. This pipeline predicts the class of an audio when you
provide an audio and a set of `candidate_labels`.
<Tip warning={true}>
The default `hypothesis_template` is : `"This is a sound of {}."`. Make sure you update it for your usage.
</Tip>
Example:
```py... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#zeroshotaudioclassificationpipeline | #zeroshotaudioclassificationpipeline | .md | 456_12 |
Pipelines available for computer vision tasks include the following. | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#computer-vision | #computer-vision | .md | 456_13 |
Depth estimation pipeline using any `AutoModelForDepthEstimation`. This pipeline predicts the depth of an image.
Example:
```python
>>> from transformers import pipeline
>>> depth_estimator = pipeline(task="depth-estimation", model="LiheYoung/depth-anything-base-hf")
>>> output = depth_estimator("http://images.coc... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#depthestimationpipeline | #depthestimationpipeline | .md | 456_14 |
Image classification pipeline using any `AutoModelForImageClassification`. This pipeline predicts the class of an
image.
Example:
```python
>>> from transformers import pipeline
>>> classifier = pipeline(model="microsoft/beit-base-patch16-224-pt22k-ft22k")
>>> classifier("https://huggingface.co/datasets/Narsil/ima... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#imageclassificationpipeline | #imageclassificationpipeline | .md | 456_15 |
Image segmentation pipeline using any `AutoModelForXXXSegmentation`. This pipeline predicts masks of objects and
their classes.
Example:
```python
>>> from transformers import pipeline
>>> segmenter = pipeline(model="facebook/detr-resnet-50-panoptic")
>>> segments = segmenter("https://huggingface.co/datasets/Narsi... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#imagesegmentationpipeline | #imagesegmentationpipeline | .md | 456_16 |
Image to Image pipeline using any `AutoModelForImageToImage`. This pipeline generates an image based on a previous
image input.
Example:
```python
>>> from PIL import Image
>>> import requests
>>> from transformers import pipeline
>>> upscaler = pipeline("image-to-image", model="caidas/swin2SR-classical-sr-x2-64"... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#imagetoimagepipeline | #imagetoimagepipeline | .md | 456_17 |
Object detection pipeline using any `AutoModelForObjectDetection`. This pipeline predicts bounding boxes of objects
and their classes.
Example:
```python
>>> from transformers import pipeline
>>> detector = pipeline(model="facebook/detr-resnet-50")
>>> detector("https://huggingface.co/datasets/Narsil/image_dummy/r... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#objectdetectionpipeline | #objectdetectionpipeline | .md | 456_18 |
Video classification pipeline using any `AutoModelForVideoClassification`. This pipeline predicts the class of a
video.
This video classification pipeline can currently be loaded from [`pipeline`] using the following task identifier:
`"video-classification"`.
See the list of available models on
[huggingface.co/mode... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#videoclassificationpipeline | #videoclassificationpipeline | .md | 456_19 |
Zero shot image classification pipeline using `CLIPModel`. This pipeline predicts the class of an image when you
provide an image and a set of `candidate_labels`.
Example:
```python
>>> from transformers import pipeline
>>> classifier = pipeline(model="google/siglip-so400m-patch14-384")
>>> classifier(
... "ht... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#zeroshotimageclassificationpipeline | #zeroshotimageclassificationpipeline | .md | 456_20 |
Zero shot object detection pipeline using `OwlViTForObjectDetection`. This pipeline predicts bounding boxes of
objects when you provide an image and a set of `candidate_labels`.
Example:
```python
>>> from transformers import pipeline
>>> detector = pipeline(model="google/owlvit-base-patch32", task="zero-shot-obje... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#zeroshotobjectdetectionpipeline | #zeroshotobjectdetectionpipeline | .md | 456_21 |
Pipelines available for natural language processing tasks include the following. | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#natural-language-processing | #natural-language-processing | .md | 456_22 |
Masked language modeling prediction pipeline using any `ModelWithLMHead`. See the [masked language modeling
examples](../task_summary#masked-language-modeling) for more information.
Example:
```python
>>> from transformers import pipeline
>>> fill_masker = pipeline(model="google-bert/bert-base-uncased")
>>> fill_m... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#fillmaskpipeline | #fillmaskpipeline | .md | 456_23 |
Question Answering pipeline using any `ModelForQuestionAnswering`. See the [question answering
examples](../task_summary#question-answering) for more information.
Example:
```python
>>> from transformers import pipeline
>>> oracle = pipeline(model="deepset/roberta-base-squad2")
>>> oracle(question="Where do I live... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#questionansweringpipeline | #questionansweringpipeline | .md | 456_24 |
Summarize news articles and other documents.
This summarizing pipeline can currently be loaded from [`pipeline`] using the following task identifier:
`"summarization"`.
The models that this pipeline can use are models that have been fine-tuned on a summarization task, which is
currently, '*bart-large-cnn*', '*googl... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#summarizationpipeline | #summarizationpipeline | .md | 456_25 |
Table Question Answering pipeline using a `ModelForTableQuestionAnswering`. This pipeline is only available in
PyTorch.
Example:
```python
>>> from transformers import pipeline
>>> oracle = pipeline(model="google/tapas-base-finetuned-wtq")
>>> table = {
... "Repository": ["Transformers", "Datasets", "Tokenizer... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#tablequestionansweringpipeline | #tablequestionansweringpipeline | .md | 456_26 |
Text classification pipeline using any `ModelForSequenceClassification`. See the [sequence classification
examples](../task_summary#sequence-classification) for more information.
Example:
```python
>>> from transformers import pipeline
>>> classifier = pipeline(model="distilbert/distilbert-base-uncased-finetuned-s... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#textclassificationpipeline | #textclassificationpipeline | .md | 456_27 |
Language generation pipeline using any `ModelWithLMHead`. This pipeline predicts the words that will follow a
specified text prompt. When the underlying model is a conversational model, it can also accept one or more chats,
in which case the pipeline will operate in chat mode and will continue the chat(s) by adding its... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#textgenerationpipeline | #textgenerationpipeline | .md | 456_28 |
Pipeline for text to text generation using seq2seq models.
Example:
```python
>>> from transformers import pipeline
>>> generator = pipeline(model="mrm8488/t5-base-finetuned-question-generation-ap")
>>> generator(
... "answer: Manuel context: Manuel has created RuPERTa-base with the support of HF-Transformers ... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#text2textgenerationpipeline | #text2textgenerationpipeline | .md | 456_29 |
Named Entity Recognition pipeline using any `ModelForTokenClassification`. See the [named entity recognition
examples](../task_summary#named-entity-recognition) for more information.
Example:
```python
>>> from transformers import pipeline
>>> token_classifier = pipeline(model="Jean-Baptiste/camembert-ner", aggreg... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#tokenclassificationpipeline | #tokenclassificationpipeline | .md | 456_30 |
Translates from one language to another.
This translation pipeline can currently be loaded from [`pipeline`] using the following task identifier:
`"translation_xx_to_yy"`.
The models that this pipeline can use are models that have been fine-tuned on a translation task. See the
up-to-date list of available models on... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#translationpipeline | #translationpipeline | .md | 456_31 |
NLI-based zero-shot classification pipeline using a `ModelForSequenceClassification` trained on NLI (natural
language inference) tasks. Equivalent of `text-classification` pipelines, but these models don't require a
hardcoded number of potential classes, they can be chosen at runtime. It usually means it's slower but i... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#zeroshotclassificationpipeline | #zeroshotclassificationpipeline | .md | 456_32 |
Pipelines available for multimodal tasks include the following. | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#multimodal | #multimodal | .md | 456_33 |
Document Question Answering pipeline using any `AutoModelForDocumentQuestionAnswering`. The inputs/outputs are
similar to the (extractive) question answering pipeline; however, the pipeline takes an image (and optional OCR'd
words/boxes) as input instead of text context.
Example:
```python
>>> from transformers imp... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#documentquestionansweringpipeline | #documentquestionansweringpipeline | .md | 456_34 |
Feature extraction pipeline uses no model head. This pipeline extracts the hidden states from the base
transformer, which can be used as features in downstream tasks.
Example:
```python
>>> from transformers import pipeline
>>> extractor = pipeline(model="google-bert/bert-base-uncased", task="feature-extraction")
... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#featureextractionpipeline | #featureextractionpipeline | .md | 456_35 |
Image feature extraction pipeline uses no model head. This pipeline extracts the hidden states from the base
transformer, which can be used as features in downstream tasks.
Example:
```python
>>> from transformers import pipeline
>>> extractor = pipeline(model="google/vit-base-patch16-224", task="image-feature-ext... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#imagefeatureextractionpipeline | #imagefeatureextractionpipeline | .md | 456_36 |
Image To Text pipeline using a `AutoModelForVision2Seq`. This pipeline predicts a caption for a given image.
Example:
```python
>>> from transformers import pipeline
>>> captioner = pipeline(model="ydshieh/vit-gpt2-coco-en")
>>> captioner("https://huggingface.co/datasets/Narsil/image_dummy/raw/main/parrots.png")
[... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#imagetotextpipeline | #imagetotextpipeline | .md | 456_37 |
Image-text-to-text pipeline using an `AutoModelForImageTextToText`. This pipeline generates text given an image and text.
When the underlying model is a conversational model, it can also accept one or more chats,
in which case the pipeline will operate in chat mode and will continue the chat(s) by adding its response(s... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#imagetexttotextpipeline | #imagetexttotextpipeline | .md | 456_38 |
Automatic mask generation for images using `SamForMaskGeneration`. This pipeline predicts binary masks for an
image, given an image. It is a `ChunkPipeline` because you can seperate the points in a mini-batch in order to
avoid OOM issues. Use the `points_per_batch` argument to control the number of points that will be ... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#maskgenerationpipeline | #maskgenerationpipeline | .md | 456_39 |
Visual Question Answering pipeline using a `AutoModelForVisualQuestionAnswering`. This pipeline is currently only
available in PyTorch.
Example:
```python
>>> from transformers import pipeline
>>> oracle = pipeline(model="dandelin/vilt-b32-finetuned-vqa")
>>> image_url = "https://huggingface.co/datasets/Narsil/ima... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#visualquestionansweringpipeline | #visualquestionansweringpipeline | .md | 456_40 |
The Pipeline class is the class from which all pipelines inherit. Refer to this class for methods shared across
different pipelines.
Base class implementing pipelined operations. Pipeline workflow is defined as a sequence of the following
operations:
Input -> Tokenization -> Model Inference -> Post-Processing (task... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/pipelines.md | https://huggingface.co/docs/transformers/en/main_classes/pipelines/#parent-class-pipeline | #parent-class-pipeline | .md | 456_41 |
<!--Copyright 2021 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/keras_callbacks.md | https://huggingface.co/docs/transformers/en/main_classes/keras_callbacks/ | .md | 457_0 | |
When training a Transformers model with Keras, there are some library-specific callbacks available to automate common
tasks: | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/keras_callbacks.md | https://huggingface.co/docs/transformers/en/main_classes/keras_callbacks/#keras-callbacks | #keras-callbacks | .md | 457_1 |
KerasMetricCallback | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/keras_callbacks.md | https://huggingface.co/docs/transformers/en/main_classes/keras_callbacks/#kerasmetriccallback | #kerasmetriccallback | .md | 457_2 |
PushToHubCallback | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/keras_callbacks.md | https://huggingface.co/docs/transformers/en/main_classes/keras_callbacks/#pushtohubcallback | #pushtohubcallback | .md | 457_3 |
<!--Copyright 2020 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/ | .md | 458_0 | |
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
dictionaries.
Let's see how this looks in an example:
```python
from transformers import BertTokenizer, BertForSe... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#model-outputs | #model-outputs | .md | 458_1 |
utils.ModelOutput
Base class for all model outputs as dataclass. Has a `__getitem__` that allows indexing by integer or slice (like a
tuple) or strings (like a dictionary) that will ignore the `None` attributes. Otherwise behaves like a regular
python dictionary.
<Tip warning={true}>
You can't unpack a `ModelOutp... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#modeloutput | #modeloutput | .md | 458_2 |
modeling_outputs.BaseModelOutput
Base class for model's outputs, with potential hidden states and attentions.
Args:
last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`):
Sequence of hidden-states at the output of the last layer of the model.
hidden_states (`tuple(torch.Float... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#basemodeloutput | #basemodeloutput | .md | 458_3 |
modeling_outputs.BaseModelOutput
Base class for model's outputs, with potential hidden states and attentions.
Args:
last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`):
Sequence of hidden-states at the output of the last layer of the model.
hidden_states (`tuple(torch.Float... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#basemodeloutputwithpooling | #basemodeloutputwithpooling | .md | 458_4 |
modeling_outputs.BaseModelOutput
Base class for model's outputs, with potential hidden states and attentions.
Args:
last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`):
Sequence of hidden-states at the output of the last layer of the model.
hidden_states (`tuple(torch.Float... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#basemodeloutputwithcrossattentions | #basemodeloutputwithcrossattentions | .md | 458_5 |
modeling_outputs.BaseModelOutput
Base class for model's outputs, with potential hidden states and attentions.
Args:
last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`):
Sequence of hidden-states at the output of the last layer of the model.
hidden_states (`tuple(torch.Float... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#basemodeloutputwithpoolingandcrossattentions | #basemodeloutputwithpoolingandcrossattentions | .md | 458_6 |
modeling_outputs.BaseModelOutput
Base class for model's outputs, with potential hidden states and attentions.
Args:
last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`):
Sequence of hidden-states at the output of the last layer of the model.
hidden_states (`tuple(torch.Float... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#basemodeloutputwithpast | #basemodeloutputwithpast | .md | 458_7 |
modeling_outputs.BaseModelOutput
Base class for model's outputs, with potential hidden states and attentions.
Args:
last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`):
Sequence of hidden-states at the output of the last layer of the model.
hidden_states (`tuple(torch.Float... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#basemodeloutputwithpastandcrossattentions | #basemodeloutputwithpastandcrossattentions | .md | 458_8 |
modeling_outputs.Seq2SeqModelOutput
Base class for model encoder's outputs that also contains : pre-computed hidden states that can speed up sequential
decoding.
Args:
last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`):
Sequence of hidden-states at the output of the last l... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#seq2seqmodeloutput | #seq2seqmodeloutput | .md | 458_9 |
modeling_outputs.CausalLMOutput
Base class for causal language model (or autoregressive) outputs.
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Language modeling loss (for next-token prediction).
logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, ... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#causallmoutput | #causallmoutput | .md | 458_10 |
modeling_outputs.CausalLMOutput
Base class for causal language model (or autoregressive) outputs.
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Language modeling loss (for next-token prediction).
logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, ... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#causallmoutputwithcrossattentions | #causallmoutputwithcrossattentions | .md | 458_11 |
modeling_outputs.CausalLMOutput
Base class for causal language model (or autoregressive) outputs.
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Language modeling loss (for next-token prediction).
logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, ... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#causallmoutputwithpast | #causallmoutputwithpast | .md | 458_12 |
modeling_outputs.MaskedLMOutput
Base class for masked language models outputs.
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Masked language modeling (MLM) loss.
logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`):
Prediction s... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#maskedlmoutput | #maskedlmoutput | .md | 458_13 |
modeling_outputs.Seq2SeqLMOutput
Base class for sequence-to-sequence language models outputs.
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Language modeling loss.
logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`):
Prediction... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#seq2seqlmoutput | #seq2seqlmoutput | .md | 458_14 |
modeling_outputs.NextSentencePredictorOutput
Base class for outputs of models predicting if two sentences are consecutive or not.
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `next_sentence_label` is provided):
Next sequence prediction (classification) loss.
logits (`torch.FloatTensor`... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#nextsentencepredictoroutput | #nextsentencepredictoroutput | .md | 458_15 |
modeling_outputs.SequenceClassifierOutput
Base class for outputs of sentence classification models.
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Classification (or regression if config.num_labels==1) loss.
logits (`torch.FloatTensor` of shape `(batch_size, config... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#sequenceclassifieroutput | #sequenceclassifieroutput | .md | 458_16 |
modeling_outputs.Seq2SeqSequenceClassifierOutput
Base class for outputs of sequence-to-sequence sentence classification models.
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `label` is provided):
Classification (or regression if config.num_labels==1) loss.
logits (`torch.FloatTensor` of... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#seq2seqsequenceclassifieroutput | #seq2seqsequenceclassifieroutput | .md | 458_17 |
modeling_outputs.MultipleChoiceModelOutput
Base class for outputs of multiple choice models.
Args:
loss (`torch.FloatTensor` of shape *(1,)*, *optional*, returned when `labels` is provided):
Classification loss.
logits (`torch.FloatTensor` of shape `(batch_size, num_choices)`):
*num_choices* is the second dimension... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#multiplechoicemodeloutput | #multiplechoicemodeloutput | .md | 458_18 |
modeling_outputs.TokenClassifierOutput
Base class for outputs of token classification models.
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided) :
Classification loss.
logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.num_labels)`):
Classificati... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#tokenclassifieroutput | #tokenclassifieroutput | .md | 458_19 |
modeling_outputs.QuestionAnsweringModelOutput
Base class for outputs of question answering models.
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.
start_logits (`torch.FloatTen... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#questionansweringmodeloutput | #questionansweringmodeloutput | .md | 458_20 |
modeling_outputs.Seq2SeqQuestionAnsweringModelOutput
Base class for outputs of sequence-to-sequence question answering models.
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.
s... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#seq2seqquestionansweringmodeloutput | #seq2seqquestionansweringmodeloutput | .md | 458_21 |
modeling_outputs.Seq2SeqSpectrogramOutput
Base class for sequence-to-sequence spectrogram outputs.
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Spectrogram generation loss.
spectrogram (`torch.FloatTensor` of shape `(batch_size, sequence_length, num_bins)`):
The ... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#seq2seqspectrogramoutput | #seq2seqspectrogramoutput | .md | 458_22 |
modeling_outputs.SemanticSegmenterOutput
Base class for outputs of semantic segmentation models.
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Classification (or regression if config.num_labels==1) loss.
logits (`torch.FloatTensor` of shape `(batch_size, config.nu... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#semanticsegmenteroutput | #semanticsegmenteroutput | .md | 458_23 |
modeling_outputs.ImageClassifierOutput
Base class for outputs of image classification models.
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Classification (or regression if config.num_labels==1) loss.
logits (`torch.FloatTensor` of shape `(batch_size, config.num_l... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#imageclassifieroutput | #imageclassifieroutput | .md | 458_24 |
modeling_outputs.ImageClassifierOutput
Base class for outputs of image classification models.
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Classification (or regression if config.num_labels==1) loss.
logits (`torch.FloatTensor` of shape `(batch_size, config.num_l... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#imageclassifieroutputwithnoattention | #imageclassifieroutputwithnoattention | .md | 458_25 |
modeling_outputs.DepthEstimatorOutput
Base class for outputs of depth estimation models.
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Classification (or regression if config.num_labels==1) loss.
predicted_depth (`torch.FloatTensor` of shape `(batch_size, height, ... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#depthestimatoroutput | #depthestimatoroutput | .md | 458_26 |
modeling_outputs.Wav2Vec2BaseModelOutput
Base class for models that have been trained with the Wav2Vec2 loss objective.
Args:
last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`):
Sequence of hidden-states at the output of the last layer of the model.
extract_features (`torc... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#wav2vec2basemodeloutput | #wav2vec2basemodeloutput | .md | 458_27 |
modeling_outputs.XVectorOutput
Output type of [`Wav2Vec2ForXVector`].
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Classification loss.
logits (`torch.FloatTensor` of shape `(batch_size, config.xvector_output_dim)`):
Classification hidden states before AMSoftmax.... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#xvectoroutput | #xvectoroutput | .md | 458_28 |
modeling_outputs.Seq2SeqTSModelOutput
Base class for time series model's encoder outputs that also contains pre-computed hidden states that can speed up
sequential decoding.
Args:
last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`):
Sequence of hidden-states at the output o... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#seq2seqtsmodeloutput | #seq2seqtsmodeloutput | .md | 458_29 |
modeling_outputs.Seq2SeqTSPredictionOutput
Base class for time series model's decoder outputs that also contain the loss as well as the parameters of the
chosen distribution.
Args:
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when a `future_values` is provided):
Distributional loss.
params (`torc... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#seq2seqtspredictionoutput | #seq2seqtspredictionoutput | .md | 458_30 |
modeling_outputs.SampleTSPredictionOutput
Base class for time series model's predictions outputs that contains the sampled values from the chosen
distribution.
Args:
sequences (`torch.FloatTensor` of shape `(batch_size, num_samples, prediction_length)` or `(batch_size, num_samples, prediction_length, input_size)`):... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#sampletspredictionoutput | #sampletspredictionoutput | .md | 458_31 |
[[autodoc]] modeling_tf_outputs.TFBaseModelOutput: No module named 'tensorflow' | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#tfbasemodeloutput | #tfbasemodeloutput | .md | 458_32 |
[[autodoc]] modeling_tf_outputs.TFBaseModelOutput: No module named 'tensorflow'WithPooling | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#tfbasemodeloutputwithpooling | #tfbasemodeloutputwithpooling | .md | 458_33 |
[[autodoc]] modeling_tf_outputs.TFBaseModelOutput: No module named 'tensorflow'WithPoolingAndCrossAttentions | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#tfbasemodeloutputwithpoolingandcrossattentions | #tfbasemodeloutputwithpoolingandcrossattentions | .md | 458_34 |
[[autodoc]] modeling_tf_outputs.TFBaseModelOutput: No module named 'tensorflow'WithPast | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#tfbasemodeloutputwithpast | #tfbasemodeloutputwithpast | .md | 458_35 |
[[autodoc]] modeling_tf_outputs.TFBaseModelOutput: No module named 'tensorflow'WithPastAndCrossAttentions | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#tfbasemodeloutputwithpastandcrossattentions | #tfbasemodeloutputwithpastandcrossattentions | .md | 458_36 |
[[autodoc]] modeling_tf_outputs.TFSeq2SeqModelOutput: No module named 'tensorflow' | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#tfseq2seqmodeloutput | #tfseq2seqmodeloutput | .md | 458_37 |
[[autodoc]] modeling_tf_outputs.TFCausalLMOutput: No module named 'tensorflow' | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#tfcausallmoutput | #tfcausallmoutput | .md | 458_38 |
[[autodoc]] modeling_tf_outputs.TFCausalLMOutput: No module named 'tensorflow'WithCrossAttentions | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#tfcausallmoutputwithcrossattentions | #tfcausallmoutputwithcrossattentions | .md | 458_39 |
[[autodoc]] modeling_tf_outputs.TFCausalLMOutput: No module named 'tensorflow'WithPast | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#tfcausallmoutputwithpast | #tfcausallmoutputwithpast | .md | 458_40 |
[[autodoc]] modeling_tf_outputs.TFMaskedLMOutput: No module named 'tensorflow' | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#tfmaskedlmoutput | #tfmaskedlmoutput | .md | 458_41 |
[[autodoc]] modeling_tf_outputs.TFSeq2SeqLMOutput: No module named 'tensorflow' | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#tfseq2seqlmoutput | #tfseq2seqlmoutput | .md | 458_42 |
[[autodoc]] modeling_tf_outputs.TFNextSentencePredictorOutput: No module named 'tensorflow' | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#tfnextsentencepredictoroutput | #tfnextsentencepredictoroutput | .md | 458_43 |
[[autodoc]] modeling_tf_outputs.TFSequenceClassifierOutput: No module named 'tensorflow' | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#tfsequenceclassifieroutput | #tfsequenceclassifieroutput | .md | 458_44 |
[[autodoc]] modeling_tf_outputs.TFSeq2SeqSequenceClassifierOutput: No module named 'tensorflow' | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#tfseq2seqsequenceclassifieroutput | #tfseq2seqsequenceclassifieroutput | .md | 458_45 |
[[autodoc]] modeling_tf_outputs.TFMultipleChoiceModelOutput: No module named 'tensorflow' | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#tfmultiplechoicemodeloutput | #tfmultiplechoicemodeloutput | .md | 458_46 |
[[autodoc]] modeling_tf_outputs.TFTokenClassifierOutput: No module named 'tensorflow' | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#tftokenclassifieroutput | #tftokenclassifieroutput | .md | 458_47 |
[[autodoc]] modeling_tf_outputs.TFQuestionAnsweringModelOutput: No module named 'tensorflow' | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#tfquestionansweringmodeloutput | #tfquestionansweringmodeloutput | .md | 458_48 |
[[autodoc]] modeling_tf_outputs.TFSeq2SeqQuestionAnsweringModelOutput: No module named 'tensorflow' | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#tfseq2seqquestionansweringmodeloutput | #tfseq2seqquestionansweringmodeloutput | .md | 458_49 |
[[autodoc]] modeling_flax_outputs.FlaxBaseModelOutput: No module named 'flax' | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#flaxbasemodeloutput | #flaxbasemodeloutput | .md | 458_50 |
[[autodoc]] modeling_flax_outputs.FlaxBaseModelOutput: No module named 'flax'WithPast | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#flaxbasemodeloutputwithpast | #flaxbasemodeloutputwithpast | .md | 458_51 |
[[autodoc]] modeling_flax_outputs.FlaxBaseModelOutput: No module named 'flax'WithPooling | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#flaxbasemodeloutputwithpooling | #flaxbasemodeloutputwithpooling | .md | 458_52 |
[[autodoc]] modeling_flax_outputs.FlaxBaseModelOutput: No module named 'flax'WithPastAndCrossAttentions | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#flaxbasemodeloutputwithpastandcrossattentions | #flaxbasemodeloutputwithpastandcrossattentions | .md | 458_53 |
[[autodoc]] modeling_flax_outputs.FlaxSeq2SeqModelOutput: No module named 'flax' | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#flaxseq2seqmodeloutput | #flaxseq2seqmodeloutput | .md | 458_54 |
[[autodoc]] modeling_flax_outputs.FlaxCausalLMOutputWithCrossAttentions: No module named 'flax' | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#flaxcausallmoutputwithcrossattentions | #flaxcausallmoutputwithcrossattentions | .md | 458_55 |
[[autodoc]] modeling_flax_outputs.FlaxMaskedLMOutput: No module named 'flax' | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/main_classes/output.md | https://huggingface.co/docs/transformers/en/main_classes/output/#flaxmaskedlmoutput | #flaxmaskedlmoutput | .md | 458_56 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.