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
There are 2 main ways to use SigLIP: either using the pipeline API, which abstracts away all the complexity for you, or by using the `SiglipModel` class yourself.
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/siglip.md
https://huggingface.co/docs/transformers/en/model_doc/siglip/#usage-example
#usage-example
.md
292_3
The pipeline allows to use the model in a few lines of code: ```python >>> from transformers import pipeline >>> from PIL import Image >>> import requests >>> # load pipe >>> image_classifier = pipeline(task="zero-shot-image-classification", model="google/siglip-base-patch16-224") >>> # load image >>> url = 'http:/...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/siglip.md
https://huggingface.co/docs/transformers/en/model_doc/siglip/#pipeline-api
#pipeline-api
.md
292_4
If you want to do the pre- and postprocessing yourself, here's how to do that: ```python >>> from PIL import Image >>> import requests >>> from transformers import AutoProcessor, AutoModel >>> import torch >>> model = AutoModel.from_pretrained("google/siglip-base-patch16-224") >>> processor = AutoProcessor.from_pret...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/siglip.md
https://huggingface.co/docs/transformers/en/model_doc/siglip/#using-the-model-yourself
#using-the-model-yourself
.md
292_5
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with SigLIP. - [Zero-shot image classification task guide](../tasks/zero_shot_image_classification) - Demo notebooks for SigLIP can be found [here](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/SigLIP)...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/siglip.md
https://huggingface.co/docs/transformers/en/model_doc/siglip/#resources
#resources
.md
292_6
First, make sure to install the latest version of Flash Attention 2. ```bash pip install -U flash-attn --no-build-isolation ``` Make also sure that you have a hardware that is compatible with Flash-Attention 2. Read more about it in the official documentation of flash-attn repository. Make also sure to load your mo...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/siglip.md
https://huggingface.co/docs/transformers/en/model_doc/siglip/#combining-siglip-and-flash-attention-2
#combining-siglip-and-flash-attention-2
.md
292_7
PyTorch includes a native scaled dot-product attention (SDPA) operator as part of `torch.nn.functional`. This function encompasses several implementations that can be applied depending on the inputs and the hardware in use. See the [official documentation](https://pytorch.org/docs/stable/generated/torch.nn.functional.s...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/siglip.md
https://huggingface.co/docs/transformers/en/model_doc/siglip/#using-scaled-dot-product-attention-sdpa
#using-scaled-dot-product-attention-sdpa
.md
292_8
Below is an expected speedup diagram that compares inference time between the native implementation in transformers using `google/siglip-so400m-patch14-384` checkpoint in `float16` precision and the Flash Attention 2 / SDPA version of the model using different batch sizes. <div style="text-align: center"> <img src="h...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/siglip.md
https://huggingface.co/docs/transformers/en/model_doc/siglip/#expected-speedups
#expected-speedups
.md
292_9
[`SiglipConfig`] is the configuration class to store the configuration of a [`SiglipModel`]. It is used to instantiate a Siglip model according to the specified arguments, defining the text model and vision model configs. Instantiating a configuration with the defaults will yield a similar configuration to that of the ...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/siglip.md
https://huggingface.co/docs/transformers/en/model_doc/siglip/#siglipconfig
#siglipconfig
.md
292_10
This is the configuration class to store the configuration of a [`SiglipTextModel`]. It is used to instantiate a Siglip text encoder according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the text encoder of th...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/siglip.md
https://huggingface.co/docs/transformers/en/model_doc/siglip/#sigliptextconfig
#sigliptextconfig
.md
292_11
This is the configuration class to store the configuration of a [`SiglipVisionModel`]. It is used to instantiate a Siglip vision encoder according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the vision encoder...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/siglip.md
https://huggingface.co/docs/transformers/en/model_doc/siglip/#siglipvisionconfig
#siglipvisionconfig
.md
292_12
Construct a Siglip tokenizer. Based on [SentencePiece](https://github.com/google/sentencepiece). This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to this superclass for more information regarding those methods. Args: vocab_file (`str`): [SentencePiece]...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/siglip.md
https://huggingface.co/docs/transformers/en/model_doc/siglip/#sigliptokenizer
#sigliptokenizer
.md
292_13
Constructs a SigLIP image processor. Args: do_resize (`bool`, *optional*, defaults to `True`): Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by `do_resize` in the `preprocess` method. size (`Dict[str, int]` *optional*, defaults to `{"height": 224, "width": 224}`):...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/siglip.md
https://huggingface.co/docs/transformers/en/model_doc/siglip/#siglipimageprocessor
#siglipimageprocessor
.md
292_14
Constructs a Siglip processor which wraps a Siglip image processor and a Siglip tokenizer into a single processor. [`SiglipProcessor`] offers all the functionalities of [`SiglipImageProcessor`] and [`SiglipTokenizer`]. See the [`~SiglipProcessor.__call__`] and [`~SiglipProcessor.decode`] for more information. Args:...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/siglip.md
https://huggingface.co/docs/transformers/en/model_doc/siglip/#siglipprocessor
#siglipprocessor
.md
292_15
This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads etc.) This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#to...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/siglip.md
https://huggingface.co/docs/transformers/en/model_doc/siglip/#siglipmodel
#siglipmodel
.md
292_16
The text model from SigLIP without any head or projection on top. This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads etc.) This model is also a Py...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/siglip.md
https://huggingface.co/docs/transformers/en/model_doc/siglip/#sigliptextmodel
#sigliptextmodel
.md
292_17
The vision model from SigLIP without any head or projection on top. This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads etc.) This model is also a ...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/siglip.md
https://huggingface.co/docs/transformers/en/model_doc/siglip/#siglipvisionmodel
#siglipvisionmodel
.md
292_18
SigLIP vision encoder with an image classification head on top (a linear layer on top of the pooled final hidden states of the patch tokens) e.g. for ImageNet. This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the library implements for all its model (such as dow...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/siglip.md
https://huggingface.co/docs/transformers/en/model_doc/siglip/#siglipforimageclassification
#siglipforimageclassification
.md
292_19
<!--Copyright 2022 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/model_doc/plbart.md
https://huggingface.co/docs/transformers/en/model_doc/plbart/
.md
293_0
The PLBART model was proposed in [Unified Pre-training for Program Understanding and Generation](https://arxiv.org/abs/2103.06333) by Wasi Uddin Ahmad, Saikat Chakraborty, Baishakhi Ray, Kai-Wei Chang. This is a BART-like model which can be used to perform code-summarization, code-generation, and code-translation tasks...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/plbart.md
https://huggingface.co/docs/transformers/en/model_doc/plbart/#overview
#overview
.md
293_1
PLBart is a multilingual encoder-decoder (sequence-to-sequence) model primarily intended for code-to-text, text-to-code, code-to-code tasks. As the model is multilingual it expects the sequences in a different format. A special language id token is added in both the source and target text. The source text format is `X ...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/plbart.md
https://huggingface.co/docs/transformers/en/model_doc/plbart/#usage-examples
#usage-examples
.md
293_2
```python >>> from transformers import PLBartForConditionalGeneration, PLBartTokenizer >>> tokenizer = PLBartTokenizer.from_pretrained("uclanlp/plbart-base", src_lang="en_XX", tgt_lang="python") >>> example_python_phrase = "def maximum(a,b,c):NEW_LINE_INDENTreturn max([a,b,c])" >>> expected_translation_english = "Retu...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/plbart.md
https://huggingface.co/docs/transformers/en/model_doc/plbart/#supervised-training
#supervised-training
.md
293_3
While generating the target text set the `decoder_start_token_id` to the target language id. The following example shows how to translate Python to English using the `uclanlp/plbart-python-en_XX` model. ```python >>> from transformers import PLBartForConditionalGeneration, PLBartTokenizer >>> tokenizer = PLBartToken...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/plbart.md
https://huggingface.co/docs/transformers/en/model_doc/plbart/#generation
#generation
.md
293_4
- [Text classification task guide](../tasks/sequence_classification) - [Causal language modeling task guide](../tasks/language_modeling) - [Translation task guide](../tasks/translation) - [Summarization task guide](../tasks/summarization)
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/plbart.md
https://huggingface.co/docs/transformers/en/model_doc/plbart/#resources
#resources
.md
293_5
This is the configuration class to store the configuration of a [`PLBartModel`]. It is used to instantiate an PLBART model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the PLBART [uclanlp/plbart-base]...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/plbart.md
https://huggingface.co/docs/transformers/en/model_doc/plbart/#plbartconfig
#plbartconfig
.md
293_6
Construct an PLBART tokenizer. Adapted from [`RobertaTokenizer`] and [`XLNetTokenizer`]. Based on [SentencePiece](https://github.com/google/sentencepiece). The tokenization method is `<tokens> <eos> <language code>` for source language documents, and `<language code> <tokens> <eos>` for target language documents. ...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/plbart.md
https://huggingface.co/docs/transformers/en/model_doc/plbart/#plbarttokenizer
#plbarttokenizer
.md
293_7
The bare PLBART Model outputting raw hidden-states without any specific head on top. This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads etc.) This...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/plbart.md
https://huggingface.co/docs/transformers/en/model_doc/plbart/#plbartmodel
#plbartmodel
.md
293_8
The PLBART Model with a language modeling head. Can be used for code-to-text, text-to-code and code-to-code. This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the library implements for all its model (such as downloading or saving, resizing the input embeddings, pr...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/plbart.md
https://huggingface.co/docs/transformers/en/model_doc/plbart/#plbartforconditionalgeneration
#plbartforconditionalgeneration
.md
293_9
PLBart model with a sequence classification/head on top (a linear layer on top of the pooled output) e.g. for code classification. This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the library implements for all its model (such as downloading or saving, resizing ...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/plbart.md
https://huggingface.co/docs/transformers/en/model_doc/plbart/#plbartforsequenceclassification
#plbartforsequenceclassification
.md
293_10
No docstring available for PLBartForCausalLM Methods: forward
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/plbart.md
https://huggingface.co/docs/transformers/en/model_doc/plbart/#plbartforcausallm
#plbartforcausallm
.md
293_11
<!--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/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/
.md
294_0
<div class="flex flex-wrap space-x-1"> <a href="https://huggingface.co/models?filter=t5"> <img alt="Models" src="https://img.shields.io/badge/All_model_pages-t5-blueviolet"> </a> <a href="https://huggingface.co/spaces/docs-demos/t5-base"> <img alt="Spaces" src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/#t5
#t5
.md
294_1
The T5 model was presented in [Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer](https://arxiv.org/pdf/1910.10683.pdf) by [Colin Raffel](https://huggingface.co/craffel), Noam Shazeer, [Adam Roberts](https://huggingface.co/adarob), Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/#overview
#overview
.md
294_2
- T5 is an encoder-decoder model pre-trained on a multi-task mixture of unsupervised and supervised tasks and for which each task is converted into a text-to-text format. T5 works well on a variety of tasks out-of-the-box by prepending a different prefix to the input corresponding to each task, e.g., for translation: *...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/#usage-tips
#usage-tips
.md
294_3
T5 is an encoder-decoder model and converts all NLP problems into a text-to-text format. It is trained using teacher forcing. This means that for training, we always need an input sequence and a corresponding target sequence. The input sequence is fed to the model using `input_ids`. The target sequence is shifted to th...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/#training
#training
.md
294_4
At inference time, it is recommended to use [`~generation.GenerationMixin.generate`]. This method takes care of encoding the input and feeding the encoded hidden states via cross-attention layers to the decoder and auto-regressively generates the decoder output. Check out [this blog post](https://huggingface.co/blog/ho...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/#inference
#inference
.md
294_5
If you'd like a faster training and inference performance, install [NVIDIA APEX](https://github.com/NVIDIA/apex#quick-start) for NVIDIA GPUs, or [ROCm APEX](https://github.com/ROCmSoftwarePlatform/apex) for AMD GPUs and then the model will automatically use `apex.normalization.FusedRMSNorm` instead of `T5LayerNorm`. Th...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/#performance
#performance
.md
294_6
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with T5. If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review it! The resource should ideally demonstrate something new instead of duplicating an exist...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/#resources
#resources
.md
294_7
This is the configuration class to store the configuration of a [`T5Model`] or a [`TFT5Model`]. It is used to instantiate a T5 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the T5 [google-t5/t5-s...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/#t5config
#t5config
.md
294_8
Construct a T5 tokenizer. Based on [SentencePiece](https://github.com/google/sentencepiece). This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to this superclass for more information regarding those methods. Args: vocab_file (`str`): [SentencePiece](htt...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/#t5tokenizer
#t5tokenizer
.md
294_9
Construct a "fast" T5 tokenizer (backed by HuggingFace's *tokenizers* library). Based on [Unigram](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=unigram#models). This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should refer to thi...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/#t5tokenizerfast
#t5tokenizerfast
.md
294_10
The bare T5 Model transformer outputting raw hidden-states without any specific head on top. The T5 model was proposed in [Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer](https://arxiv.org/abs/1910.10683) by Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Mic...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/#t5model
#t5model
.md
294_11
T5 Model with a `language modeling` head on top. The T5 model was proposed in [Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer](https://arxiv.org/abs/1910.10683) by Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, Peter J. Li...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/#t5forconditionalgeneration
#t5forconditionalgeneration
.md
294_12
The bare T5 Model transformer outputting encoder's raw hidden-states without any specific head on top. The T5 model was proposed in [Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer](https://arxiv.org/abs/1910.10683) by Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan N...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/#t5encodermodel
#t5encodermodel
.md
294_13
T5 model with a sequence classification/head on top (a linear layer on top of the pooled output) e.g. for GLUE tasks. The T5 model was proposed in [Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer](https://arxiv.org/abs/1910.10683) by Colin Raffel, Noam Shazeer, Adam Roberts, Katherin...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/#t5forsequenceclassification
#t5forsequenceclassification
.md
294_14
T5 Encoder Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g. for Named-Entity-Recognition (NER) tasks. The T5 model was proposed in [Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer](https://arxiv.org/abs/1910.10683) by Colin Raffel...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/#t5fortokenclassification
#t5fortokenclassification
.md
294_15
T5 Model with a span classification head on top for extractive question-answering tasks like SQuAD (linear layers on top of the hidden-states output to compute `span start logits` and `span end logits`). The T5 model was proposed in [Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer](h...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/#t5forquestionanswering
#t5forquestionanswering
.md
294_16
No docstring available for TFT5Model Methods: call
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/#tft5model
#tft5model
.md
294_17
No docstring available for TFT5ForConditionalGeneration Methods: call
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/#tft5forconditionalgeneration
#tft5forconditionalgeneration
.md
294_18
No docstring available for TFT5EncoderModel Methods: call </tf> <jax>
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/#tft5encodermodel
#tft5encodermodel
.md
294_19
No docstring available for FlaxT5Model Methods: __call__ - encode - decode
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/#flaxt5model
#flaxt5model
.md
294_20
No docstring available for FlaxT5ForConditionalGeneration Methods: __call__ - encode - decode
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/#flaxt5forconditionalgeneration
#flaxt5forconditionalgeneration
.md
294_21
No docstring available for FlaxT5EncoderModel Methods: __call__ </jax> </frameworkcontent>
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/t5.md
https://huggingface.co/docs/transformers/en/model_doc/t5/#flaxt5encodermodel
#flaxt5encodermodel
.md
294_22
<!--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/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/
.md
295_0
<div class="flex flex-wrap space-x-1"> <a href="https://huggingface.co/models?filter=gpt2"> <img alt="Models" src="https://img.shields.io/badge/All_model_pages-gpt2-blueviolet"> </a> <a href="https://huggingface.co/spaces/docs-demos/gpt2"> <img alt="Spaces" src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Fac...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#openai-gpt2
#openai-gpt2
.md
295_1
OpenAI GPT-2 model was proposed in [Language Models are Unsupervised Multitask Learners](https://cdn.openai.com/better-language-models/language_models_are_unsupervised_multitask_learners.pdf) by Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei and Ilya Sutskever from [OpenAI](https://huggingface.co/opena...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#overview
#overview
.md
295_2
- GPT-2 is a model with absolute position embeddings so it's usually advised to pad the inputs on the right rather than the left. - GPT-2 was trained with a causal language modeling (CLM) objective and is therefore powerful at predicting the next token in a sequence. Leveraging this feature allows GPT-2 to generate syn...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#usage-tips
#usage-tips
.md
295_3
The `generate()` method can be used to generate text using GPT2 model. ```python >>> from transformers import AutoModelForCausalLM, AutoTokenizer >>> model = AutoModelForCausalLM.from_pretrained("gpt2") >>> tokenizer = AutoTokenizer.from_pretrained("gpt2") >>> prompt = "GPT2 is a model developed by OpenAI." >>> in...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#usage-example
#usage-example
.md
295_4
Flash Attention 2 is a faster, optimized version of the attention scores computation which relies on `cuda` kernels.
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#using-flash-attention-2
#using-flash-attention-2
.md
295_5
First, check whether your hardware is compatible with Flash Attention 2. The latest list of compatible hardware can be found in the [official documentation](https://github.com/Dao-AILab/flash-attention#installation-and-features). If your hardware is not compatible with Flash Attention 2, you can still benefit from atte...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#installation
#installation
.md
295_6
To load a model using Flash Attention 2, we can pass the argument `attn_implementation="flash_attention_2"` to [`.from_pretrained`](https://huggingface.co/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained). We'll also load the model in half-precision (e.g. `torch.float16`), since...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#usage
#usage
.md
295_7
Below is an expected speedup diagram that compares pure inference time between the native implementation in transformers using `gpt2` checkpoint and the Flash Attention 2 version of the model using a sequence length of 512. <div style="text-align: center"> <img src="https://huggingface.co/datasets/EduardoPacheco/docu...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#expected-speedups
#expected-speedups
.md
295_8
PyTorch includes a native scaled dot-product attention (SDPA) operator as part of `torch.nn.functional`. This function encompasses several implementations that can be applied depending on the inputs and the hardware in use. See the [official documentation](https://pytorch.org/docs/stable/generated/torch.nn.functional.s...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#using-scaled-dot-product-attention-sdpa
#using-scaled-dot-product-attention-sdpa
.md
295_9
| Batch size | Seq len | Time per batch (Eager - s) | Time per batch (SDPA - s) | Speedup (%) | Eager peak mem (MB) | SDPA peak mem (MB) | Mem saving (%) | |-----------:|--------:|----------------------------:|--------------------------:|------------:|--------------------:|-------------------:|------------------:| ...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#training
#training
.md
295_10
| Batch size | Seq len | Per token latency Eager (ms) | Per token latency SDPA (ms) | Speedup (%) | Mem Eager (MB) | Mem SDPA (MB) | Mem saved (%) | |-----------:|--------:|-----------------------------:|----------------------------:|------------:|---------------:|--------------:|--------------:| | 1 | 128...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#inference
#inference
.md
295_11
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with GPT2. If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review it! The resource should ideally demonstrate something new instead of duplicating an exi...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#resources
#resources
.md
295_12
This is the configuration class to store the configuration of a [`GPT2Model`] or a [`TFGPT2Model`]. It is used to instantiate a GPT-2 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the GPT-2 [open...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#gpt2config
#gpt2config
.md
295_13
Construct a GPT-2 tokenizer. Based on byte-level Byte-Pair-Encoding. This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will be encoded differently whether it is at the beginning of the sentence (without space) or not: ```python >>> from transformers import...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#gpt2tokenizer
#gpt2tokenizer
.md
295_14
Construct a "fast" GPT-2 tokenizer (backed by HuggingFace's *tokenizers* library). Based on byte-level Byte-Pair-Encoding. This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will be encoded differently whether it is at the beginning of the sentence (without s...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#gpt2tokenizerfast
#gpt2tokenizerfast
.md
295_15
models.gpt2.modeling_gpt2.GPT2DoubleHeadsModelOutput Base class for outputs of models predicting if two sentences are consecutive or not. Args: loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Language modeling loss. mc_loss (`torch.FloatTensor` of shape `(1,)`, *optional*...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#gpt2-specific-outputs
#gpt2-specific-outputs
.md
295_16
The bare GPT2 Model transformer outputting raw hidden-states without any specific head on top. This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads ...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#gpt2model
#gpt2model
.md
295_17
The GPT2 Model transformer with a language modeling head on top (linear layer with weights tied to the input embeddings). This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the library implements for all its model (such as downloading or saving, resizing the input...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#gpt2lmheadmodel
#gpt2lmheadmodel
.md
295_18
The GPT2 Model transformer with a language modeling and a multiple-choice classification head on top e.g. for RocStories/SWAG tasks. The two heads are two linear layers. The language modeling head has its weights tied to the input embeddings, the classification head takes as input the input of a specified classificatio...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#gpt2doubleheadsmodel
#gpt2doubleheadsmodel
.md
295_19
The GPT-2 Model transformer with a span classification head on top for extractive question-answering tasks like SQuAD (a linear layer on top of the hidden-states output to compute `span start logits` and `span end logits`). This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the gener...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#gpt2forquestionanswering
#gpt2forquestionanswering
.md
295_20
The GPT2 Model transformer with a sequence classification head on top (linear layer). [`GPT2ForSequenceClassification`] uses the last token in order to do the classification, as other causal models (e.g. GPT-1) do. Since it does classification on the last token, it requires to know the position of the last token. I...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#gpt2forsequenceclassification
#gpt2forsequenceclassification
.md
295_21
GPT2 Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g. for Named-Entity-Recognition (NER) tasks. This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the library implements for all its model (such as downloading o...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#gpt2fortokenclassification
#gpt2fortokenclassification
.md
295_22
No docstring available for TFGPT2Model Methods: call
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#tfgpt2model
#tfgpt2model
.md
295_23
No docstring available for TFGPT2LMHeadModel Methods: call
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#tfgpt2lmheadmodel
#tfgpt2lmheadmodel
.md
295_24
No docstring available for TFGPT2DoubleHeadsModel Methods: call
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#tfgpt2doubleheadsmodel
#tfgpt2doubleheadsmodel
.md
295_25
No docstring available for TFGPT2ForSequenceClassification Methods: call
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#tfgpt2forsequenceclassification
#tfgpt2forsequenceclassification
.md
295_26
[[autodoc]] modeling_tf_outputs.TFSequenceClassifierOutputWithPast: No module named 'tensorflow'
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#tfsequenceclassifieroutputwithpast
#tfsequenceclassifieroutputwithpast
.md
295_27
No docstring available for TFGPT2Tokenizer </tf> <jax>
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#tfgpt2tokenizer
#tfgpt2tokenizer
.md
295_28
No docstring available for FlaxGPT2Model Methods: __call__
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#flaxgpt2model
#flaxgpt2model
.md
295_29
No docstring available for FlaxGPT2LMHeadModel Methods: __call__ </jax> </frameworkcontent>
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/gpt2.md
https://huggingface.co/docs/transformers/en/model_doc/gpt2/#flaxgpt2lmheadmodel
#flaxgpt2lmheadmodel
.md
295_30
<!--Copyright 2024 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/model_doc/olmo2.md
https://huggingface.co/docs/transformers/en/model_doc/olmo2/
.md
296_0
The OLMo2 model is the successor of the OLMo model, which was proposed in [OLMo: Accelerating the Science of Language Models](https://arxiv.org/abs/2402.00838). The architectural changes from the original OLMo model to this model are: - RMSNorm is used instead of standard layer norm. - Norm is applied to attention ...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/olmo2.md
https://huggingface.co/docs/transformers/en/model_doc/olmo2/#overview
#overview
.md
296_1
This is the configuration class to store the configuration of a [`Olmo2Model`]. It is used to instantiate an OLMo2 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the [allenai/Olmo2-7B-1124-hf](htt...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/olmo2.md
https://huggingface.co/docs/transformers/en/model_doc/olmo2/#olmo2config
#olmo2config
.md
296_2
The bare Olmo2 Model outputting raw hidden-states without any specific head on top. This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads etc.) This ...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/olmo2.md
https://huggingface.co/docs/transformers/en/model_doc/olmo2/#olmo2model
#olmo2model
.md
296_3
No docstring available for Olmo2ForCausalLM Methods: forward
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/olmo2.md
https://huggingface.co/docs/transformers/en/model_doc/olmo2/#olmo2forcausallm
#olmo2forcausallm
.md
296_4
<!--Copyright 2024 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/model_doc/llava_onevision.md
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/
.md
297_0
The LLaVA-OneVision model was proposed in [LLaVA-OneVision: Easy Visual Task Transfer](https://arxiv.org/abs/2408.03326) by <Bo Li, Yuanhan Zhang, Dong Guo, Renrui Zhang, Feng Li, Hao Zhang, Kaichen Zhang, Yanwei Li, Ziwei Liu, Chunyuan Li LLaVA-OneVision is a Vision-Language Model that can generate text conditioned ...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#overview
#overview
.md
297_1
Here's how to load the model and perform inference in half-precision (`torch.float16`): ```python from transformers import AutoProcessor, LlavaOnevisionForConditionalGeneration import torch from PIL import Image import requests processor = AutoProcessor.from_pretrained("llava-hf/llava-onevision-qwen2-7b-ov-hf") mode...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#single-image-inference
#single-image-inference
.md
297_2
LLaVa-OneVision can perform inference with multiple images as input, where images either belong to the same prompt or different prompts (in batched inference). For that you have to use checkpoints with an "ov" suffix. Here is how you can do it: ```python import requests from PIL import Image import torch from transfo...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#multi-image-inference
#multi-image-inference
.md
297_3
LLaVa-OneVision also can perform inference with videos as input, where video frames are treated as multiple images. Here is how you can do it: ```python import av import numpy as np from huggingface_hub import hf_hub_download import torch from transformers import AutoProcessor, LlavaOnevisionForConditionalGeneration...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#video-inference
#video-inference
.md
297_4
The model can be loaded in 8 or 4 bits, greatly reducing the memory requirements while maintaining the performance of the original model. First make sure to install bitsandbytes, `pip install bitsandbytes` and make sure to have access to a GPU/accelerator that is supported by the library. <Tip> bitsandbytes is bein...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#quantization-using-bitsandbytes
#quantization-using-bitsandbytes
.md
297_5
First make sure to install flash-attn. Refer to the [original repository of Flash Attention](https://github.com/Dao-AILab/flash-attention) regarding that package installation. Simply change the snippet above with: ```python from transformers import LlavaOnevisionForConditionalGeneration model = LlavaOnevisionForCond...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#use-flash-attention-2-to-further-speed-up-generation
#use-flash-attention-2-to-further-speed-up-generation
.md
297_6
This is the configuration class to store the configuration of a [`LlavaOnevisionForConditionalGeneration`]. It is used to instantiate an Llava-NeXT model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of t...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionconfig
#llavaonevisionconfig
.md
297_7
Constructs a LLaVa-Onevision processor which wraps a LLaVa-Onevision video processor, LLaVa-NeXT image processor and a LLaMa tokenizer into a single processor. [`LlavaNextProcessor`] offers all the functionalities of [`LlavaOnevisionVideoProcessor`], [`LlavaOnevisionImageProcessor`] and [`LlamaTokenizerFast`]. See th...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionprocessor
#llavaonevisionprocessor
.md
297_8
Constructs a LLaVa-Onevisino-Video video processor. Based on [`SiglipImageProcessor`] with incorporation of processing each video frame. Args: do_resize (`bool`, *optional*, defaults to `True`): Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by `do_resize` in the `...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionimageprocessor
#llavaonevisionimageprocessor
.md
297_9
Constructs a LLaVa-Onevisino-Video video processor. Based on [`SiglipImageProcessor`] with incorporation of processing each video frame. Args: do_resize (`bool`, *optional*, defaults to `True`): Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by `do_resize` in the `...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionvideoprocessor
#llavaonevisionvideoprocessor
.md
297_10
The LLaVA-Onevision model which consists of a vision backbone and a language model. This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads etc.) This ...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionforconditionalgeneration
#llavaonevisionforconditionalgeneration
.md
297_11