source
stringclasses 470
values | url
stringlengths 49
167
| file_type
stringclasses 1
value | chunk
stringlengths 1
512
| chunk_id
stringlengths 5
9
|
---|---|---|---|---|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#resources | .md | - [`DistilBertForSequenceClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification.ipynb). | 409_7_4 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#resources | .md | - [`TFDistilBertForSequenceClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/text-classification) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification-tf.ipynb). | 409_7_5 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#resources | .md | - [`FlaxDistilBertForSequenceClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/flax/text-classification) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification_flax.ipynb).
- [Text classification task guide](../tasks/sequence_classification)
<PipelineTag pipeline="token-classification"/> | 409_7_6 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#resources | .md | - [Text classification task guide](../tasks/sequence_classification)
<PipelineTag pipeline="token-classification"/>
- [`DistilBertForTokenClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/token-classification) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification.ipynb). | 409_7_7 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#resources | .md | - [`TFDistilBertForTokenClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/token-classification) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification-tf.ipynb).
- [`FlaxDistilBertForTokenClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/flax/token-classification). | 409_7_8 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#resources | .md | - [Token classification](https://huggingface.co/course/chapter7/2?fw=pt) chapter of the π€ Hugging Face Course.
- [Token classification task guide](../tasks/token_classification)
<PipelineTag pipeline="fill-mask"/> | 409_7_9 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#resources | .md | - [Token classification task guide](../tasks/token_classification)
<PipelineTag pipeline="fill-mask"/>
- [`DistilBertForMaskedLM`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/language-modeling#robertabertdistilbert-and-masked-language-modeling) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb). | 409_7_10 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#resources | .md | - [`TFDistilBertForMaskedLM`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/language-modeling#run_mlmpy) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb). | 409_7_11 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#resources | .md | - [`FlaxDistilBertForMaskedLM`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/flax/language-modeling#masked-language-modeling) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/masked_language_modeling_flax.ipynb).
- [Masked language modeling](https://huggingface.co/course/chapter7/3?fw=pt) chapter of the π€ Hugging Face Course.
- [Masked language modeling task guide](../tasks/masked_language_modeling) | 409_7_12 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#resources | .md | - [Masked language modeling task guide](../tasks/masked_language_modeling)
<PipelineTag pipeline="question-answering"/>
- [`DistilBertForQuestionAnswering`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering.ipynb). | 409_7_13 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#resources | .md | - [`TFDistilBertForQuestionAnswering`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/question-answering) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering-tf.ipynb).
- [`FlaxDistilBertForQuestionAnswering`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/flax/question-answering). | 409_7_14 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#resources | .md | - [Question answering](https://huggingface.co/course/chapter7/7?fw=pt) chapter of the π€ Hugging Face Course.
- [Question answering task guide](../tasks/question_answering)
**Multiple choice**
- [`DistilBertForMultipleChoice`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/multiple-choice) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multiple_choice.ipynb). | 409_7_15 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#resources | .md | - [`TFDistilBertForMultipleChoice`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/multiple-choice) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multiple_choice-tf.ipynb).
- [Multiple choice task guide](../tasks/multiple_choice)
βοΈ Optimization
- A blog post on how to [quantize DistilBERT with π€ Optimum and Intel](https://huggingface.co/blog/intel). | 409_7_16 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#resources | .md | βοΈ Optimization
- A blog post on how to [quantize DistilBERT with π€ Optimum and Intel](https://huggingface.co/blog/intel).
- A blog post on how [Optimizing Transformers for GPUs with π€ Optimum](https://www.philschmid.de/optimizing-transformers-with-optimum-gpu).
- A blog post on [Optimizing Transformers with Hugging Face Optimum](https://www.philschmid.de/optimizing-transformers-with-optimum).
β‘οΈ Inference | 409_7_17 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#resources | .md | β‘οΈ Inference
- A blog post on how to [Accelerate BERT inference with Hugging Face Transformers and AWS Inferentia](https://huggingface.co/blog/bert-inferentia-sagemaker) with DistilBERT.
- A blog post on [Serverless Inference with Hugging Face's Transformers, DistilBERT and Amazon SageMaker](https://www.philschmid.de/sagemaker-serverless-huggingface-distilbert).
π Deploy
- A blog post on how to [deploy DistilBERT on Google Cloud](https://huggingface.co/blog/how-to-deploy-a-pipeline-to-google-clouds). | 409_7_18 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#resources | .md | - A blog post on how to [deploy DistilBERT with Amazon SageMaker](https://huggingface.co/blog/deploy-hugging-face-models-easily-with-amazon-sagemaker).
- A blog post on how to [Deploy BERT with Hugging Face Transformers, Amazon SageMaker and Terraform module](https://www.philschmid.de/terraform-huggingface-amazon-sagemaker). | 409_7_19 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#combining-distilbert-and-flash-attention-2 | .md | First, make sure to install the latest version of Flash Attention 2 to include the sliding window attention feature.
```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 model in half-precision (e.g. `torch.float16`)
To load and run a model using Flash Attention 2, refer to the snippet below:
```python | 409_8_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#combining-distilbert-and-flash-attention-2 | .md | To load and run a model using Flash Attention 2, refer to the snippet below:
```python
>>> import torch
>>> from transformers import AutoTokenizer, AutoModel | 409_8_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#combining-distilbert-and-flash-attention-2 | .md | >>> device = "cuda" # the device to load the model onto
>>> tokenizer = AutoTokenizer.from_pretrained('distilbert/distilbert-base-uncased')
>>> model = AutoModel.from_pretrained("distilbert/distilbert-base-uncased", torch_dtype=torch.float16, attn_implementation="flash_attention_2")
>>> text = "Replace me by any text you'd like."
>>> encoded_input = tokenizer(text, return_tensors='pt').to(device)
>>> model.to(device)
>>> output = model(**encoded_input)
``` | 409_8_2 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertconfig | .md | This is the configuration class to store the configuration of a [`DistilBertModel`] or a [`TFDistilBertModel`]. It
is used to instantiate a DistilBERT 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 DistilBERT
[distilbert-base-uncased](https://huggingface.co/distilbert-base-uncased) architecture. | 409_9_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertconfig | .md | [distilbert-base-uncased](https://huggingface.co/distilbert-base-uncased) architecture.
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
documentation from [`PretrainedConfig`] for more information.
Args:
vocab_size (`int`, *optional*, defaults to 30522):
Vocabulary size of the DistilBERT model. Defines the number of different tokens that can be represented by
the `inputs_ids` passed when calling [`DistilBertModel`] or [`TFDistilBertModel`]. | 409_9_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertconfig | .md | the `inputs_ids` passed when calling [`DistilBertModel`] or [`TFDistilBertModel`].
max_position_embeddings (`int`, *optional*, defaults to 512):
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).
sinusoidal_pos_embds (`boolean`, *optional*, defaults to `False`):
Whether to use sinusoidal positional embeddings.
n_layers (`int`, *optional*, defaults to 6):
Number of hidden layers in the Transformer encoder. | 409_9_2 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertconfig | .md | n_layers (`int`, *optional*, defaults to 6):
Number of hidden layers in the Transformer encoder.
n_heads (`int`, *optional*, defaults to 12):
Number of attention heads for each attention layer in the Transformer encoder.
dim (`int`, *optional*, defaults to 768):
Dimensionality of the encoder layers and the pooler layer.
hidden_dim (`int`, *optional*, defaults to 3072):
The size of the "intermediate" (often named feed-forward) layer in the Transformer encoder.
dropout (`float`, *optional*, defaults to 0.1): | 409_9_3 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertconfig | .md | dropout (`float`, *optional*, defaults to 0.1):
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
attention_dropout (`float`, *optional*, defaults to 0.1):
The dropout ratio for the attention probabilities.
activation (`str` or `Callable`, *optional*, defaults to `"gelu"`):
The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
`"relu"`, `"silu"` and `"gelu_new"` are supported. | 409_9_4 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertconfig | .md | `"relu"`, `"silu"` and `"gelu_new"` are supported.
initializer_range (`float`, *optional*, defaults to 0.02):
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
qa_dropout (`float`, *optional*, defaults to 0.1):
The dropout probabilities used in the question answering model [`DistilBertForQuestionAnswering`].
seq_classif_dropout (`float`, *optional*, defaults to 0.2):
The dropout probabilities used in the sequence classification and the multiple choice model | 409_9_5 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertconfig | .md | The dropout probabilities used in the sequence classification and the multiple choice model
[`DistilBertForSequenceClassification`].
Examples:
```python
>>> from transformers import DistilBertConfig, DistilBertModel | 409_9_6 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertconfig | .md | >>> # Initializing a DistilBERT configuration
>>> configuration = DistilBertConfig()
>>> # Initializing a model (with random weights) from the configuration
>>> model = DistilBertModel(configuration)
>>> # Accessing the model configuration
>>> configuration = model.config
``` | 409_9_7 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilberttokenizer | .md | Construct a DistilBERT tokenizer. Based on WordPiece.
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`):
File containing the vocabulary.
do_lower_case (`bool`, *optional*, defaults to `True`):
Whether or not to lowercase the input when tokenizing.
do_basic_tokenize (`bool`, *optional*, defaults to `True`): | 409_10_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilberttokenizer | .md | Whether or not to lowercase the input when tokenizing.
do_basic_tokenize (`bool`, *optional*, defaults to `True`):
Whether or not to do basic tokenization before WordPiece.
never_split (`Iterable`, *optional*):
Collection of tokens which will never be split during tokenization. Only has an effect when
`do_basic_tokenize=True`
unk_token (`str`, *optional*, defaults to `"[UNK]"`):
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead. | 409_10_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilberttokenizer | .md | The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.
sep_token (`str`, *optional*, defaults to `"[SEP]"`):
The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for
sequence classification or for a text and a question for question answering. It is also used as the last
token of a sequence built with special tokens.
pad_token (`str`, *optional*, defaults to `"[PAD]"`): | 409_10_2 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilberttokenizer | .md | token of a sequence built with special tokens.
pad_token (`str`, *optional*, defaults to `"[PAD]"`):
The token used for padding, for example when batching sequences of different lengths.
cls_token (`str`, *optional*, defaults to `"[CLS]"`):
The classifier token which is used when doing sequence classification (classification of the whole sequence
instead of per-token classification). It is the first token of the sequence when built with special tokens. | 409_10_3 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilberttokenizer | .md | instead of per-token classification). It is the first token of the sequence when built with special tokens.
mask_token (`str`, *optional*, defaults to `"[MASK]"`):
The token used for masking values. This is the token used when training this model with masked language
modeling. This is the token which the model will try to predict.
tokenize_chinese_chars (`bool`, *optional*, defaults to `True`):
Whether or not to tokenize Chinese characters.
This should likely be deactivated for Japanese (see this | 409_10_4 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilberttokenizer | .md | Whether or not to tokenize Chinese characters.
This should likely be deactivated for Japanese (see this
[issue](https://github.com/huggingface/transformers/issues/328)).
strip_accents (`bool`, *optional*):
Whether or not to strip all accents. If this option is not specified, then it will be determined by the
value for `lowercase` (as in the original BERT).
clean_up_tokenization_spaces (`bool`, *optional*, defaults to `True`): | 409_10_5 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilberttokenizer | .md | value for `lowercase` (as in the original BERT).
clean_up_tokenization_spaces (`bool`, *optional*, defaults to `True`):
Whether or not to cleanup spaces after decoding, cleanup consists in removing potential artifacts like
extra spaces. | 409_10_6 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilberttokenizerfast | .md | Construct a "fast" DistilBERT tokenizer (backed by HuggingFace's *tokenizers* library). Based on WordPiece.
This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.
Args:
vocab_file (`str`):
File containing the vocabulary.
do_lower_case (`bool`, *optional*, defaults to `True`):
Whether or not to lowercase the input when tokenizing. | 409_11_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilberttokenizerfast | .md | do_lower_case (`bool`, *optional*, defaults to `True`):
Whether or not to lowercase the input when tokenizing.
unk_token (`str`, *optional*, defaults to `"[UNK]"`):
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.
sep_token (`str`, *optional*, defaults to `"[SEP]"`):
The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for | 409_11_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilberttokenizerfast | .md | The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for
sequence classification or for a text and a question for question answering. It is also used as the last
token of a sequence built with special tokens.
pad_token (`str`, *optional*, defaults to `"[PAD]"`):
The token used for padding, for example when batching sequences of different lengths.
cls_token (`str`, *optional*, defaults to `"[CLS]"`): | 409_11_2 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilberttokenizerfast | .md | cls_token (`str`, *optional*, defaults to `"[CLS]"`):
The classifier token which is used when doing sequence classification (classification of the whole sequence
instead of per-token classification). It is the first token of the sequence when built with special tokens.
mask_token (`str`, *optional*, defaults to `"[MASK]"`):
The token used for masking values. This is the token used when training this model with masked language
modeling. This is the token which the model will try to predict. | 409_11_3 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilberttokenizerfast | .md | modeling. This is the token which the model will try to predict.
clean_text (`bool`, *optional*, defaults to `True`):
Whether or not to clean the text before tokenization by removing any control characters and replacing all
whitespaces by the classic one.
tokenize_chinese_chars (`bool`, *optional*, defaults to `True`):
Whether or not to tokenize Chinese characters. This should likely be deactivated for Japanese (see [this
issue](https://github.com/huggingface/transformers/issues/328)). | 409_11_4 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilberttokenizerfast | .md | issue](https://github.com/huggingface/transformers/issues/328)).
strip_accents (`bool`, *optional*):
Whether or not to strip all accents. If this option is not specified, then it will be determined by the
value for `lowercase` (as in the original BERT).
wordpieces_prefix (`str`, *optional*, defaults to `"##"`):
The prefix for subwords.
<frameworkcontent>
<pt> | 409_11_5 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertmodel | .md | The bare DistilBERT encoder/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
etc.)
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass. | 409_12_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertmodel | .md | etc.)
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.
Parameters:
config ([`DistilBertConfig`]): Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the | 409_12_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertmodel | .md | Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
Methods: forward | 409_12_2 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertformaskedlm | .md | DistilBert Model with a `masked language modeling` 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 model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass. | 409_13_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertformaskedlm | .md | etc.)
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.
Parameters:
config ([`DistilBertConfig`]): Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the | 409_13_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertformaskedlm | .md | Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
Methods: forward | 409_13_2 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertforsequenceclassification | .md | DistilBert Model transformer with a sequence classification/regression head on top (a linear layer on top of the
pooled output) e.g. for GLUE tasks.
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#torch.nn.Module) subclass. | 409_14_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertforsequenceclassification | .md | etc.)
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.
Parameters:
config ([`DistilBertConfig`]): Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the | 409_14_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertforsequenceclassification | .md | Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
Methods: forward | 409_14_2 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertformultiplechoice | .md | DistilBert Model with a multiple choice classification head on top (a linear layer on top of the pooled output and
a softmax) e.g. for RocStories/SWAG tasks.
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#torch.nn.Module) subclass. | 409_15_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertformultiplechoice | .md | etc.)
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.
Parameters:
config ([`DistilBertConfig`]): Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the | 409_15_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertformultiplechoice | .md | Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
Methods: forward | 409_15_2 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertfortokenclassification | .md | DistilBert 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 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#torch.nn.Module) subclass. | 409_16_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertfortokenclassification | .md | etc.)
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.
Parameters:
config ([`DistilBertConfig`]): Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the | 409_16_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertfortokenclassification | .md | Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
Methods: forward | 409_16_2 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertforquestionanswering | .md | DistilBert Model with a span classification head on top for extractive question-answering tasks like SQuAD (a
linear layers 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 generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.) | 409_17_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertforquestionanswering | .md | 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#torch.nn.Module) subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.
Parameters:
config ([`DistilBertConfig`]): Model configuration class with all the parameters of the model. | 409_17_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#distilbertforquestionanswering | .md | and behavior.
Parameters:
config ([`DistilBertConfig`]): Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
Methods: forward
</pt>
<tf> | 409_17_2 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#tfdistilbertmodel | .md | No docstring available for TFDistilBertModel
Methods: call | 409_18_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#tfdistilbertformaskedlm | .md | No docstring available for TFDistilBertForMaskedLM
Methods: call | 409_19_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#tfdistilbertforsequenceclassification | .md | No docstring available for TFDistilBertForSequenceClassification
Methods: call | 409_20_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#tfdistilbertformultiplechoice | .md | No docstring available for TFDistilBertForMultipleChoice
Methods: call | 409_21_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#tfdistilbertfortokenclassification | .md | No docstring available for TFDistilBertForTokenClassification
Methods: call | 409_22_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#tfdistilbertforquestionanswering | .md | No docstring available for TFDistilBertForQuestionAnswering
Methods: call
</tf>
<jax> | 409_23_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#flaxdistilbertmodel | .md | No docstring available for FlaxDistilBertModel
Methods: __call__ | 409_24_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#flaxdistilbertformaskedlm | .md | No docstring available for FlaxDistilBertForMaskedLM
Methods: __call__ | 409_25_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#flaxdistilbertforsequenceclassification | .md | No docstring available for FlaxDistilBertForSequenceClassification
Methods: __call__ | 409_26_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#flaxdistilbertformultiplechoice | .md | No docstring available for FlaxDistilBertForMultipleChoice
Methods: __call__ | 409_27_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#flaxdistilbertfortokenclassification | .md | No docstring available for FlaxDistilBertForTokenClassification
Methods: __call__ | 409_28_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/distilbert.md | https://huggingface.co/docs/transformers/en/model_doc/distilbert/#flaxdistilbertforquestionanswering | .md | No docstring available for FlaxDistilBertForQuestionAnswering
Methods: __call__
</jax>
</frameworkcontent> | 409_29_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/ | .md | <!--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 agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | 410_0_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/ | .md | an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
β οΈ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be
rendered properly in your Markdown viewer.
--> | 410_0_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#openai-gpt | .md | <div class="flex flex-wrap space-x-1">
<a href="https://huggingface.co/models?filter=openai-gpt">
<img alt="Models" src="https://img.shields.io/badge/All_model_pages-openai--gpt-blueviolet">
</a>
<a href="https://huggingface.co/spaces/docs-demos/openai-gpt">
<img alt="Spaces" src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue">
</a>
</div> | 410_1_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#overview | .md | OpenAI GPT model was proposed in [Improving Language Understanding by Generative Pre-Training](https://s3-us-west-2.amazonaws.com/openai-assets/research-covers/language-unsupervised/language_understanding_paper.pdf)
by Alec Radford, Karthik Narasimhan, Tim Salimans and Ilya Sutskever. It's a causal (unidirectional) transformer
pre-trained using language modeling on a large corpus with long range dependencies, the Toronto Book Corpus.
The abstract from the paper is the following: | 410_2_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#overview | .md | The abstract from the paper is the following:
*Natural language understanding comprises a wide range of diverse tasks such as textual entailment, question answering,
semantic similarity assessment, and document classification. Although large unlabeled text corpora are abundant,
labeled data for learning these specific tasks is scarce, making it challenging for discriminatively trained models to | 410_2_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#overview | .md | labeled data for learning these specific tasks is scarce, making it challenging for discriminatively trained models to
perform adequately. We demonstrate that large gains on these tasks can be realized by generative pretraining of a
language model on a diverse corpus of unlabeled text, followed by discriminative fine-tuning on each specific task. In
contrast to previous approaches, we make use of task-aware input transformations during fine-tuning to achieve | 410_2_2 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#overview | .md | contrast to previous approaches, we make use of task-aware input transformations during fine-tuning to achieve
effective transfer while requiring minimal changes to the model architecture. We demonstrate the effectiveness of our
approach on a wide range of benchmarks for natural language understanding. Our general task-agnostic model outperforms
discriminatively trained models that use architectures specifically crafted for each task, significantly improving upon | 410_2_3 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#overview | .md | discriminatively trained models that use architectures specifically crafted for each task, significantly improving upon
the state of the art in 9 out of the 12 tasks studied.*
[Write With Transformer](https://transformer.huggingface.co/doc/gpt) is a webapp created and hosted by Hugging Face
showcasing the generative capabilities of several models. GPT is one of them. | 410_2_4 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#overview | .md | showcasing the generative capabilities of several models. GPT is one of them.
This model was contributed by [thomwolf](https://huggingface.co/thomwolf). The original code can be found [here](https://github.com/openai/finetune-transformer-lm). | 410_2_5 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#usage-tips | .md | - GPT is a model with absolute position embeddings so it's usually advised to pad the inputs on the right rather than
the left.
- GPT 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 syntactically coherent text as it can be
observed in the *run_generation.py* example script.
Note: | 410_3_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#usage-tips | .md | observed in the *run_generation.py* example script.
Note:
If you want to reproduce the original tokenization process of the *OpenAI GPT* paper, you will need to install `ftfy`
and `SpaCy`:
```bash
pip install spacy ftfy==4.4.3
python -m spacy download en
```
If you don't install `ftfy` and `SpaCy`, the [`OpenAIGPTTokenizer`] will default to tokenize
using BERT's `BasicTokenizer` followed by Byte-Pair Encoding (which should be fine for most usage, don't worry). | 410_3_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#resources | .md | A list of official Hugging Face and community (indicated by π) resources to help you get started with OpenAI GPT. 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 existing resource.
<PipelineTag pipeline="text-classification"/> | 410_4_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#resources | .md | <PipelineTag pipeline="text-classification"/>
- A blog post on [outperforming OpenAI GPT-3 with SetFit for text-classification](https://www.philschmid.de/getting-started-setfit).
- See also: [Text classification task guide](../tasks/sequence_classification)
<PipelineTag pipeline="text-generation"/>
- A blog on how to [Finetune a non-English GPT-2 Model with Hugging Face](https://www.philschmid.de/fine-tune-a-non-english-gpt-2-model-with-huggingface). | 410_4_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#resources | .md | - A blog on [How to generate text: using different decoding methods for language generation with Transformers](https://huggingface.co/blog/how-to-generate) with GPT-2.
- A blog on [Training CodeParrot π¦ from Scratch](https://huggingface.co/blog/codeparrot), a large GPT-2 model.
- A blog on [Faster Text Generation with TensorFlow and XLA](https://huggingface.co/blog/tf-xla-generate) with GPT-2. | 410_4_2 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#resources | .md | - A blog on [Faster Text Generation with TensorFlow and XLA](https://huggingface.co/blog/tf-xla-generate) with GPT-2.
- A blog on [How to train a Language Model with Megatron-LM](https://huggingface.co/blog/megatron-training) with a GPT-2 model.
- A notebook on how to [finetune GPT2 to generate lyrics in the style of your favorite artist](https://colab.research.google.com/github/AlekseyKorshuk/huggingartists/blob/master/huggingartists-demo.ipynb). π | 410_4_3 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#resources | .md | - A notebook on how to [finetune GPT2 to generate tweets in the style of your favorite Twitter user](https://colab.research.google.com/github/borisdayma/huggingtweets/blob/master/huggingtweets-demo.ipynb). π
- [Causal language modeling](https://huggingface.co/course/en/chapter7/6?fw=pt#training-a-causal-language-model-from-scratch) chapter of the π€ Hugging Face Course. | 410_4_4 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#resources | .md | - [`OpenAIGPTLMHeadModel`] is supported by this [causal language modeling example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/language-modeling#gpt-2gpt-and-causal-language-modeling), [text generation example script](https://github.com/huggingface/transformers/blob/main/examples/pytorch/text-generation/run_generation.py) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb). | 410_4_5 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#resources | .md | - [`TFOpenAIGPTLMHeadModel`] is supported by this [causal language modeling example script](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/language-modeling#run_clmpy) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb).
- See also: [Causal language modeling task guide](../tasks/language_modeling)
<PipelineTag pipeline="token-classification"/> | 410_4_6 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#resources | .md | <PipelineTag pipeline="token-classification"/>
- A course material on [Byte-Pair Encoding tokenization](https://huggingface.co/course/en/chapter6/5). | 410_4_7 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#openaigptconfig | .md | This is the configuration class to store the configuration of a [`OpenAIGPTModel`] or a [`TFOpenAIGPTModel`]. It is
used to instantiate a GPT 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
[openai-community/openai-gpt](https://huggingface.co/openai-community/openai-gpt) architecture from OpenAI. | 410_5_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#openaigptconfig | .md | [openai-community/openai-gpt](https://huggingface.co/openai-community/openai-gpt) architecture from OpenAI.
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
documentation from [`PretrainedConfig`] for more information.
Args:
vocab_size (`int`, *optional*, defaults to 40478):
Vocabulary size of the GPT-2 model. Defines the number of different tokens that can be represented by the | 410_5_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#openaigptconfig | .md | Vocabulary size of the GPT-2 model. Defines the number of different tokens that can be represented by the
`inputs_ids` passed when calling [`OpenAIGPTModel`] or [`TFOpenAIGPTModel`].
n_positions (`int`, *optional*, defaults to 512):
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).
n_embd (`int`, *optional*, defaults to 768):
Dimensionality of the embeddings and hidden states. | 410_5_2 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#openaigptconfig | .md | n_embd (`int`, *optional*, defaults to 768):
Dimensionality of the embeddings and hidden states.
n_layer (`int`, *optional*, defaults to 12):
Number of hidden layers in the Transformer encoder.
n_head (`int`, *optional*, defaults to 12):
Number of attention heads for each attention layer in the Transformer encoder.
afn (`str` or `Callable`, *optional*, defaults to `"gelu"`):
The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`, | 410_5_3 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#openaigptconfig | .md | The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
`"relu"`, `"silu"` and `"gelu_new"` are supported.
resid_pdrop (`float`, *optional*, defaults to 0.1):
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
embd_pdrop (`int`, *optional*, defaults to 0.1):
The dropout ratio for the embeddings.
attn_pdrop (`float`, *optional*, defaults to 0.1):
The dropout ratio for the attention. | 410_5_4 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#openaigptconfig | .md | The dropout ratio for the embeddings.
attn_pdrop (`float`, *optional*, defaults to 0.1):
The dropout ratio for the attention.
layer_norm_epsilon (`float`, *optional*, defaults to 1e-05):
The epsilon to use in the layer normalization layers
initializer_range (`float`, *optional*, defaults to 0.02):
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
summary_type (`str`, *optional*, defaults to `"cls_index"`): | 410_5_5 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#openaigptconfig | .md | summary_type (`str`, *optional*, defaults to `"cls_index"`):
Argument used when doing sequence summary, used in the models [`OpenAIGPTDoubleHeadsModel`] and
[`OpenAIGPTDoubleHeadsModel`].
Has to be one of the following options:
- `"last"`: Take the last token hidden state (like XLNet).
- `"first"`: Take the first token hidden state (like BERT).
- `"mean"`: Take the mean of all tokens hidden states.
- `"cls_index"`: Supply a Tensor of classification token position (like GPT/GPT-2). | 410_5_6 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#openaigptconfig | .md | - `"cls_index"`: Supply a Tensor of classification token position (like GPT/GPT-2).
- `"attn"`: Not implemented now, use multi-head attention.
summary_use_proj (`bool`, *optional*, defaults to `True`):
Argument used when doing sequence summary, used in the models [`OpenAIGPTDoubleHeadsModel`] and
[`OpenAIGPTDoubleHeadsModel`].
Whether or not to add a projection after the vector extraction.
summary_activation (`str`, *optional*): | 410_5_7 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#openaigptconfig | .md | Whether or not to add a projection after the vector extraction.
summary_activation (`str`, *optional*):
Argument used when doing sequence summary, used in the models [`OpenAIGPTDoubleHeadsModel`] and
[`OpenAIGPTDoubleHeadsModel`].
Pass `"tanh"` for a tanh activation to the output, any other value will result in no activation.
summary_proj_to_labels (`bool`, *optional*, defaults to `True`):
Argument used when doing sequence summary, used in the models [`OpenAIGPTDoubleHeadsModel`] and | 410_5_8 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#openaigptconfig | .md | Argument used when doing sequence summary, used in the models [`OpenAIGPTDoubleHeadsModel`] and
[`OpenAIGPTDoubleHeadsModel`].
Whether the projection outputs should have `config.num_labels` or `config.hidden_size` classes.
summary_first_dropout (`float`, *optional*, defaults to 0.1):
Argument used when doing sequence summary, used in the models [`OpenAIGPTDoubleHeadsModel`] and
[`OpenAIGPTDoubleHeadsModel`].
The dropout ratio to be used after the projection and activation.
Examples:
```python | 410_5_9 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/openai-gpt.md | https://huggingface.co/docs/transformers/en/model_doc/openai-gpt/#openaigptconfig | .md | [`OpenAIGPTDoubleHeadsModel`].
The dropout ratio to be used after the projection and activation.
Examples:
```python
>>> from transformers import OpenAIGPTConfig, OpenAIGPTModel | 410_5_10 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.