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/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#glmconfig
|
.md
|
The maximum sequence length that this model might ever be used with.
initializer_range (`float`, *optional*, defaults to 0.02):
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
rms_norm_eps (`float`, *optional*, defaults to 1.5625e-07):
The epsilon used by the rms normalization layers.
use_cache (`bool`, *optional*, defaults to `True`):
Whether or not the model should return the last key/values attentions (not used by all models). Only
|
335_3_6
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#glmconfig
|
.md
|
Whether or not the model should return the last key/values attentions (not used by all models). Only
relevant if `config.is_decoder=True`.
tie_word_embeddings (`bool`, *optional*, defaults to `False`):
Whether to tie weight embeddings
rope_theta (`float`, *optional*, defaults to 10000.0):
The base period of the RoPE embeddings.
pad_token_id (`int`, *optional*, defaults to 151329):
Padding token id.
eos_token_id (`int` | `list`, *optional*, defaults to `[151329, 151336, 151338]`):
End of stream token id.
|
335_3_7
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#glmconfig
|
.md
|
Padding token id.
eos_token_id (`int` | `list`, *optional*, defaults to `[151329, 151336, 151338]`):
End of stream token id.
bos_token_id (`int`, *optional*):
Beginning of stream token id.
attention_bias (`bool`, defaults to `False`, *optional*, defaults to `True`):
Whether to use a bias in the query, key, value and output projection layers during self-attention.
```python
>>> from transformers import GlmModel, GlmConfig
>>> # Initializing a Glm glm-4-9b-chat style configuration
|
335_3_8
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#glmconfig
|
.md
|
```python
>>> from transformers import GlmModel, GlmConfig
>>> # Initializing a Glm glm-4-9b-chat style configuration
>>> configuration = GlmConfig()
>>> # Initializing a model from the glm-4-9b-chat style configuration
>>> model = GlmModel(configuration)
>>> # Accessing the model configuration
>>> configuration = model.config
```
|
335_3_9
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#glmmodel
|
.md
|
The bare Glm 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 model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
|
335_4_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#glmmodel
|
.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 ([`GlmConfig`]):
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
|
335_4_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#glmmodel
|
.md
|
load the weights associated with the model, only the configuration. Check out the
[`~PreTrainedModel.from_pretrained`] method to load the model weights.
Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`GlmDecoderLayer`]
Args:
config: GlmConfig
Methods: forward
|
335_4_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#glmforcausallm
|
.md
|
No docstring available for GlmForCausalLM
Methods: forward
|
335_5_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#glmforsequenceclassification
|
.md
|
The Glm Model transformer with a sequence classification head on top (linear layer).
[`GlmForSequenceClassification`] uses the last token in order to do the classification, as other causal models
(e.g. GPT-2) do.
Since it does classification on the last token, it requires to know the position of the last token. If a
`pad_token_id` is defined in the configuration, it finds the last token that is not a padding token in each row. If
|
335_6_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#glmforsequenceclassification
|
.md
|
`pad_token_id` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `pad_token_id` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `inputs_embeds` are passed instead of `input_ids`, it does the same (take the last value in
each row of the batch).
This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
|
335_6_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#glmforsequenceclassification
|
.md
|
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.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.
Parameters:
config ([`GlmConfig`]):
|
335_6_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#glmforsequenceclassification
|
.md
|
and behavior.
Parameters:
config ([`GlmConfig`]):
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
|
335_6_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#glmfortokenclassification
|
.md
|
The Glm Model transformer 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.
|
335_7_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#glmfortokenclassification
|
.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 ([`GlmConfig`]):
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
|
335_7_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/glm.md
|
https://huggingface.co/docs/transformers/en/model_doc/glm/#glmfortokenclassification
|
.md
|
load the weights associated with the model, only the configuration. Check out the
[`~PreTrainedModel.from_pretrained`] method to load the model weights.
Methods: forward
|
335_7_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/
|
.md
|
<!--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 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
|
336_0_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/
|
.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.
-->
|
336_0_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#overview
|
.md
|
This page provides code and pre-trained weights for Transformer protein language models from Meta AI's Fundamental
AI Research Team, providing the state-of-the-art ESMFold and ESM-2, and the previously released ESM-1b and ESM-1v.
Transformer protein language models were introduced in the paper [Biological structure and function emerge from scaling
unsupervised learning to 250 million protein sequences](https://www.pnas.org/content/118/15/e2016239118) by
|
336_1_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#overview
|
.md
|
unsupervised learning to 250 million protein sequences](https://www.pnas.org/content/118/15/e2016239118) by
Alexander Rives, Joshua Meier, Tom Sercu, Siddharth Goyal, Zeming Lin, Jason Liu, Demi Guo, Myle Ott,
C. Lawrence Zitnick, Jerry Ma, and Rob Fergus.
The first version of this paper was [preprinted in 2019](https://www.biorxiv.org/content/10.1101/622803v1?versioned=true).
ESM-2 outperforms all tested single-sequence protein language models across a range of structure prediction tasks,
|
336_1_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#overview
|
.md
|
ESM-2 outperforms all tested single-sequence protein language models across a range of structure prediction tasks,
and enables atomic resolution structure prediction.
It was released with the paper [Language models of protein sequences at the scale of evolution enable accurate
structure prediction](https://doi.org/10.1101/2022.07.20.500902) by Zeming Lin, Halil Akin, Roshan Rao, Brian Hie,
Zhongkai Zhu, Wenting Lu, Allan dos Santos Costa, Maryam Fazel-Zarandi, Tom Sercu, Sal Candido and Alexander Rives.
|
336_1_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#overview
|
.md
|
Zhongkai Zhu, Wenting Lu, Allan dos Santos Costa, Maryam Fazel-Zarandi, Tom Sercu, Sal Candido and Alexander Rives.
Also introduced in this paper was ESMFold. It uses an ESM-2 stem with a head that can predict folded protein
structures with state-of-the-art accuracy. Unlike [AlphaFold2](https://www.nature.com/articles/s41586-021-03819-2),
it relies on the token embeddings from the large pre-trained protein language model stem and does not perform a multiple
|
336_1_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#overview
|
.md
|
it relies on the token embeddings from the large pre-trained protein language model stem and does not perform a multiple
sequence alignment (MSA) step at inference time, which means that ESMFold checkpoints are fully "standalone" -
they do not require a database of known protein sequences and structures with associated external query tools
to make predictions, and are much faster as a result.
The abstract from
"Biological structure and function emerge from scaling unsupervised learning to 250
|
336_1_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#overview
|
.md
|
The abstract from
"Biological structure and function emerge from scaling unsupervised learning to 250
million protein sequences" is
*In the field of artificial intelligence, a combination of scale in data and model capacity enabled by unsupervised
learning has led to major advances in representation learning and statistical generation. In the life sciences, the
anticipated growth of sequencing promises unprecedented data on natural sequence diversity. Protein language modeling
|
336_1_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#overview
|
.md
|
anticipated growth of sequencing promises unprecedented data on natural sequence diversity. Protein language modeling
at the scale of evolution is a logical step toward predictive and generative artificial intelligence for biology. To
this end, we use unsupervised learning to train a deep contextual language model on 86 billion amino acids across 250
million protein sequences spanning evolutionary diversity. The resulting model contains information about biological
|
336_1_6
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#overview
|
.md
|
million protein sequences spanning evolutionary diversity. The resulting model contains information about biological
properties in its representations. The representations are learned from sequence data alone. The learned representation
space has a multiscale organization reflecting structure from the level of biochemical properties of amino acids to
remote homology of proteins. Information about secondary and tertiary structure is encoded in the representations and
|
336_1_7
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#overview
|
.md
|
remote homology of proteins. Information about secondary and tertiary structure is encoded in the representations and
can be identified by linear projections. Representation learning produces features that generalize across a range of
applications, enabling state-of-the-art supervised prediction of mutational effect and secondary structure and
improving state-of-the-art features for long-range contact prediction.*
The abstract from
|
336_1_8
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#overview
|
.md
|
improving state-of-the-art features for long-range contact prediction.*
The abstract from
"Language models of protein sequences at the scale of evolution enable accurate structure prediction" is
*Large language models have recently been shown to develop emergent capabilities with scale, going beyond
simple pattern matching to perform higher level reasoning and generate lifelike images and text. While
|
336_1_9
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#overview
|
.md
|
simple pattern matching to perform higher level reasoning and generate lifelike images and text. While
language models trained on protein sequences have been studied at a smaller scale, little is known about
what they learn about biology as they are scaled up. In this work we train models up to 15 billion parameters,
the largest language models of proteins to be evaluated to date. We find that as models are scaled they learn
|
336_1_10
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#overview
|
.md
|
the largest language models of proteins to be evaluated to date. We find that as models are scaled they learn
information enabling the prediction of the three-dimensional structure of a protein at the resolution of
individual atoms. We present ESMFold for high accuracy end-to-end atomic level structure prediction directly
from the individual sequence of a protein. ESMFold has similar accuracy to AlphaFold2 and RoseTTAFold for
|
336_1_11
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#overview
|
.md
|
from the individual sequence of a protein. ESMFold has similar accuracy to AlphaFold2 and RoseTTAFold for
sequences with low perplexity that are well understood by the language model. ESMFold inference is an
order of magnitude faster than AlphaFold2, enabling exploration of the structural space of metagenomic
proteins in practical timescales.*
The original code can be found [here](https://github.com/facebookresearch/esm) and was
was developed by the Fundamental AI Research team at Meta AI.
|
336_1_12
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#overview
|
.md
|
was developed by the Fundamental AI Research team at Meta AI.
ESM-1b, ESM-1v and ESM-2 were contributed to huggingface by [jasonliu](https://huggingface.co/jasonliu)
and [Matt](https://huggingface.co/Rocketknight1).
ESMFold was contributed to huggingface by [Matt](https://huggingface.co/Rocketknight1) and
[Sylvain](https://huggingface.co/sgugger), with a big thank you to Nikita Smetanin, Roshan Rao and Tom Sercu for their
help throughout the process!
|
336_1_13
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#usage-tips
|
.md
|
- ESM models are trained with a masked language modeling (MLM) objective.
- The HuggingFace port of ESMFold uses portions of the [openfold](https://github.com/aqlaboratory/openfold) library. The `openfold` library is licensed under the Apache License 2.0.
|
336_2_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#resources
|
.md
|
- [Text classification task guide](../tasks/sequence_classification)
- [Token classification task guide](../tasks/token_classification)
- [Masked language modeling task guide](../tasks/masked_language_modeling)
|
336_3_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmconfig
|
.md
|
This is the configuration class to store the configuration of a [`ESMModel`]. It is used to instantiate a ESM 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 ESM
[facebook/esm-1b](https://huggingface.co/facebook/esm-1b) architecture.
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
336_4_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmconfig
|
.md
|
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*):
Vocabulary size of the ESM model. Defines the number of different tokens that can be represented by the
`inputs_ids` passed when calling [`ESMModel`].
mask_token_id (`int`, *optional*):
The index of the mask token in the vocabulary. This must be included in the config because of the
|
336_4_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmconfig
|
.md
|
The index of the mask token in the vocabulary. This must be included in the config because of the
"mask-dropout" scaling trick, which will scale the inputs depending on the number of masked tokens.
pad_token_id (`int`, *optional*):
The index of the padding token in the vocabulary. This must be included in the config because certain parts
of the ESM code use this instead of the attention mask.
hidden_size (`int`, *optional*, defaults to 768):
Dimensionality of the encoder layers and the pooler layer.
|
336_4_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmconfig
|
.md
|
hidden_size (`int`, *optional*, defaults to 768):
Dimensionality of the encoder layers and the pooler layer.
num_hidden_layers (`int`, *optional*, defaults to 12):
Number of hidden layers in the Transformer encoder.
num_attention_heads (`int`, *optional*, defaults to 12):
Number of attention heads for each attention layer in the Transformer encoder.
intermediate_size (`int`, *optional*, defaults to 3072):
Dimensionality of the "intermediate" (often named feed-forward) layer in the Transformer encoder.
|
336_4_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmconfig
|
.md
|
Dimensionality of the "intermediate" (often named feed-forward) layer in the Transformer encoder.
hidden_dropout_prob (`float`, *optional*, defaults to 0.1):
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
attention_probs_dropout_prob (`float`, *optional*, defaults to 0.1):
The dropout ratio for the attention probabilities.
max_position_embeddings (`int`, *optional*, defaults to 1026):
|
336_4_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmconfig
|
.md
|
The dropout ratio for the attention probabilities.
max_position_embeddings (`int`, *optional*, defaults to 1026):
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).
initializer_range (`float`, *optional*, defaults to 0.02):
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
layer_norm_eps (`float`, *optional*, defaults to 1e-12):
|
336_4_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmconfig
|
.md
|
layer_norm_eps (`float`, *optional*, defaults to 1e-12):
The epsilon used by the layer normalization layers.
position_embedding_type (`str`, *optional*, defaults to `"absolute"`):
Type of position embedding. Choose one of `"absolute"`, `"relative_key"`, `"relative_key_query", "rotary"`.
For positional embeddings use `"absolute"`. For more information on `"relative_key"`, please refer to
[Self-Attention with Relative Position Representations (Shaw et al.)](https://arxiv.org/abs/1803.02155).
|
336_4_6
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmconfig
|
.md
|
[Self-Attention with Relative Position Representations (Shaw et al.)](https://arxiv.org/abs/1803.02155).
For more information on `"relative_key_query"`, please refer to *Method 4* in [Improve Transformer Models
with Better Relative Position Embeddings (Huang et al.)](https://arxiv.org/abs/2009.13658).
is_decoder (`bool`, *optional*, defaults to `False`):
Whether the model is used as a decoder or not. If `False`, the model is used as an encoder.
use_cache (`bool`, *optional*, defaults to `True`):
|
336_4_7
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmconfig
|
.md
|
use_cache (`bool`, *optional*, defaults to `True`):
Whether or not the model should return the last key/values attentions (not used by all models). Only
relevant if `config.is_decoder=True`.
emb_layer_norm_before (`bool`, *optional*):
Whether to apply layer normalization after embeddings but before the main stem of the network.
token_dropout (`bool`, defaults to `False`):
When this is enabled, masked tokens are treated as if they had been dropped out by input dropout.
Examples:
```python
|
336_4_8
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmconfig
|
.md
|
When this is enabled, masked tokens are treated as if they had been dropped out by input dropout.
Examples:
```python
>>> from transformers import EsmModel, EsmConfig
|
336_4_9
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmconfig
|
.md
|
>>> # Initializing a ESM facebook/esm-1b style configuration
>>> configuration = EsmConfig(vocab_size=33)
>>> # Initializing a model from the configuration
>>> model = EsmModel(configuration)
>>> # Accessing the model configuration
>>> configuration = model.config
```
Methods: all
|
336_4_10
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmtokenizer
|
.md
|
Constructs an ESM tokenizer.
Methods: build_inputs_with_special_tokens
- get_special_tokens_mask
- create_token_type_ids_from_sequences
- save_vocabulary
<frameworkcontent>
<pt>
|
336_5_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmmodel
|
.md
|
The bare ESM 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
etc.)
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
|
336_6_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmmodel
|
.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 ([`EsmConfig`]): 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
|
336_6_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmmodel
|
.md
|
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.
The model can behave as an encoder (with only self-attention) as well as a decoder, in which case a layer of
cross-attention is added between the self-attention layers, following the architecture described in [Attention is
|
336_6_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmmodel
|
.md
|
cross-attention is added between the self-attention layers, following the architecture described in [Attention is
all you need](https://arxiv.org/abs/1706.03762) by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin.
To behave as an decoder the model needs to be initialized with the `is_decoder` argument of the configuration set
|
336_6_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmmodel
|
.md
|
To behave as an decoder the model needs to be initialized with the `is_decoder` argument of the configuration set
to `True`. To be used in a Seq2Seq model, the model needs to initialized with both `is_decoder` argument and
`add_cross_attention` set to `True`; an `encoder_hidden_states` is then expected as an input to the forward pass.
Methods: forward
|
336_6_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmformaskedlm
|
.md
|
ESM Model with a `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.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
|
336_7_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmformaskedlm
|
.md
|
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.
Parameters:
config ([`EsmConfig`]): 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
|
336_7_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmforsequenceclassification
|
.md
|
ESM 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.
|
336_8_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmforsequenceclassification
|
.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 ([`EsmConfig`]): 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
|
336_8_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmforsequenceclassification
|
.md
|
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
|
336_8_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmfortokenclassification
|
.md
|
ESM 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.
|
336_9_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmfortokenclassification
|
.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 ([`EsmConfig`]): 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
|
336_9_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmfortokenclassification
|
.md
|
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
|
336_9_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmforproteinfolding
|
.md
|
ESMForProteinFolding is the HuggingFace port of the original ESMFold model. It consists of an ESM-2 "stem" followed
by a protein folding "head", although unlike most other output heads, this "head" is similar in size and runtime to
the rest of the model combined! It outputs a dictionary containing predicted structural information about the input
protein(s).
This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
|
336_10_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmforproteinfolding
|
.md
|
protein(s).
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.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.
Parameters:
|
336_10_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#esmforproteinfolding
|
.md
|
and behavior.
Parameters:
config ([`EsmConfig`]): 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>
|
336_10_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#tfesmmodel
|
.md
|
No docstring available for TFEsmModel
Methods: call
|
336_11_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#tfesmformaskedlm
|
.md
|
No docstring available for TFEsmForMaskedLM
Methods: call
|
336_12_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#tfesmforsequenceclassification
|
.md
|
No docstring available for TFEsmForSequenceClassification
Methods: call
|
336_13_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/esm.md
|
https://huggingface.co/docs/transformers/en/model_doc/esm/#tfesmfortokenclassification
|
.md
|
No docstring available for TFEsmForTokenClassification
Methods: call
</tf>
</frameworkcontent>
|
336_14_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/
|
.md
|
<!--Copyright 2023 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
|
337_0_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/
|
.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.
-->
|
337_0_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#overview
|
.md
|
The PVT model was proposed in
[Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions](https://arxiv.org/abs/2102.12122)
by Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, Ling Shao. The PVT is a type of
vision transformer that utilizes a pyramid structure to make it an effective backbone for dense prediction tasks. Specifically
|
337_1_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#overview
|
.md
|
vision transformer that utilizes a pyramid structure to make it an effective backbone for dense prediction tasks. Specifically
it allows for more fine-grained inputs (4 x 4 pixels per patch) to be used, while simultaneously shrinking the sequence length
of the Transformer as it deepens - reducing the computational cost. Additionally, a spatial-reduction attention (SRA) layer
is used to further reduce the resource consumption when learning high-resolution features.
|
337_1_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#overview
|
.md
|
is used to further reduce the resource consumption when learning high-resolution features.
The abstract from the paper is the following:
*Although convolutional neural networks (CNNs) have achieved great success in computer vision, this work investigates a
simpler, convolution-free backbone network useful for many dense prediction tasks. Unlike the recently proposed Vision
Transformer (ViT) that was designed for image classification specifically, we introduce the Pyramid Vision Transformer
|
337_1_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#overview
|
.md
|
Transformer (ViT) that was designed for image classification specifically, we introduce the Pyramid Vision Transformer
(PVT), which overcomes the difficulties of porting Transformer to various dense prediction tasks. PVT has several
merits compared to current state of the arts. Different from ViT that typically yields low resolution outputs and
incurs high computational and memory costs, PVT not only can be trained on dense partitions of an image to achieve high
|
337_1_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#overview
|
.md
|
incurs high computational and memory costs, PVT not only can be trained on dense partitions of an image to achieve high
output resolution, which is important for dense prediction, but also uses a progressive shrinking pyramid to reduce the
computations of large feature maps. PVT inherits the advantages of both CNN and Transformer, making it a unified
backbone for various vision tasks without convolutions, where it can be used as a direct replacement for CNN backbones.
|
337_1_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#overview
|
.md
|
backbone for various vision tasks without convolutions, where it can be used as a direct replacement for CNN backbones.
We validate PVT through extensive experiments, showing that it boosts the performance of many downstream tasks, including
object detection, instance and semantic segmentation. For example, with a comparable number of parameters, PVT+RetinaNet
achieves 40.4 AP on the COCO dataset, surpassing ResNet50+RetinNet (36.3 AP) by 4.1 absolute AP (see Figure 2). We hope
|
337_1_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#overview
|
.md
|
achieves 40.4 AP on the COCO dataset, surpassing ResNet50+RetinNet (36.3 AP) by 4.1 absolute AP (see Figure 2). We hope
that PVT could serve as an alternative and useful backbone for pixel-level predictions and facilitate future research.*
This model was contributed by [Xrenya](https://huggingface.co/Xrenya). The original code can be found [here](https://github.com/whai362/PVT).
- PVTv1 on ImageNet-1K
| **Model variant** |**Size** |**Acc@1**|**Params (M)**|
|
337_1_6
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#overview
|
.md
|
- PVTv1 on ImageNet-1K
| **Model variant** |**Size** |**Acc@1**|**Params (M)**|
|--------------------|:-------:|:-------:|:------------:|
| PVT-Tiny | 224 | 75.1 | 13.2 |
| PVT-Small | 224 | 79.8 | 24.5 |
| PVT-Medium | 224 | 81.2 | 44.2 |
| PVT-Large | 224 | 81.7 | 61.4 |
|
337_1_7
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#pvtconfig
|
.md
|
This is the configuration class to store the configuration of a [`PvtModel`]. It is used to instantiate an Pvt
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 Pvt
[Xrenya/pvt-tiny-224](https://huggingface.co/Xrenya/pvt-tiny-224) architecture.
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
337_2_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#pvtconfig
|
.md
|
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
documentation from [`PretrainedConfig`] for more information.
Args:
image_size (`int`, *optional*, defaults to 224):
The input image size
num_channels (`int`, *optional*, defaults to 3):
The number of input channels.
num_encoder_blocks (`int`, *optional*, defaults to 4):
The number of encoder blocks (i.e. stages in the Mix Transformer encoder).
|
337_2_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#pvtconfig
|
.md
|
The number of encoder blocks (i.e. stages in the Mix Transformer encoder).
depths (`List[int]`, *optional*, defaults to `[2, 2, 2, 2]`):
The number of layers in each encoder block.
sequence_reduction_ratios (`List[int]`, *optional*, defaults to `[8, 4, 2, 1]`):
Sequence reduction ratios in each encoder block.
hidden_sizes (`List[int]`, *optional*, defaults to `[64, 128, 320, 512]`):
Dimension of each of the encoder blocks.
patch_sizes (`List[int]`, *optional*, defaults to `[4, 2, 2, 2]`):
|
337_2_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#pvtconfig
|
.md
|
Dimension of each of the encoder blocks.
patch_sizes (`List[int]`, *optional*, defaults to `[4, 2, 2, 2]`):
Patch size before each encoder block.
strides (`List[int]`, *optional*, defaults to `[4, 2, 2, 2]`):
Stride before each encoder block.
num_attention_heads (`List[int]`, *optional*, defaults to `[1, 2, 5, 8]`):
Number of attention heads for each attention layer in each block of the Transformer encoder.
mlp_ratios (`List[int]`, *optional*, defaults to `[8, 8, 4, 4]`):
|
337_2_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#pvtconfig
|
.md
|
mlp_ratios (`List[int]`, *optional*, defaults to `[8, 8, 4, 4]`):
Ratio of the size of the hidden layer compared to the size of the input layer of the Mix FFNs in the
encoder blocks.
hidden_act (`str` or `function`, *optional*, defaults to `"gelu"`):
The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
`"relu"`, `"selu"` and `"gelu_new"` are supported.
hidden_dropout_prob (`float`, *optional*, defaults to 0.0):
|
337_2_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#pvtconfig
|
.md
|
`"relu"`, `"selu"` and `"gelu_new"` are supported.
hidden_dropout_prob (`float`, *optional*, defaults to 0.0):
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
attention_probs_dropout_prob (`float`, *optional*, defaults to 0.0):
The dropout ratio for the attention probabilities.
initializer_range (`float`, *optional*, defaults to 0.02):
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
337_2_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#pvtconfig
|
.md
|
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
drop_path_rate (`float`, *optional*, defaults to 0.0):
The dropout probability for stochastic depth, used in the blocks of the Transformer encoder.
layer_norm_eps (`float`, *optional*, defaults to 1e-06):
The epsilon used by the layer normalization layers.
qkv_bias (`bool`, *optional*, defaults to `True`):
Whether or not a learnable bias should be added to the queries, keys and values.
|
337_2_6
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#pvtconfig
|
.md
|
Whether or not a learnable bias should be added to the queries, keys and values.
num_labels ('int', *optional*, defaults to 1000):
The number of classes.
Example:
```python
>>> from transformers import PvtModel, PvtConfig
|
337_2_7
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#pvtconfig
|
.md
|
>>> # Initializing a PVT Xrenya/pvt-tiny-224 style configuration
>>> configuration = PvtConfig()
>>> # Initializing a model from the Xrenya/pvt-tiny-224 style configuration
>>> model = PvtModel(configuration)
>>> # Accessing the model configuration
>>> configuration = model.config
```
|
337_2_8
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#pvtimageprocessor
|
.md
|
Constructs a PVT image processor.
Args:
do_resize (`bool`, *optional*, defaults to `True`):
Whether to resize the image's (height, width) dimensions to the specified `(size["height"],
size["width"])`. Can be overridden by the `do_resize` parameter in the `preprocess` method.
size (`dict`, *optional*, defaults to `{"height": 224, "width": 224}`):
Size of the output image after resizing. Can be overridden by the `size` parameter in the `preprocess`
method.
|
337_3_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#pvtimageprocessor
|
.md
|
Size of the output image after resizing. Can be overridden by the `size` parameter in the `preprocess`
method.
resample (`PILImageResampling`, *optional*, defaults to `Resampling.BILINEAR`):
Resampling filter to use if resizing the image. Can be overridden by the `resample` parameter in the
`preprocess` method.
do_rescale (`bool`, *optional*, defaults to `True`):
Whether to rescale the image by the specified scale `rescale_factor`. Can be overridden by the `do_rescale`
parameter in the `preprocess` method.
|
337_3_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#pvtimageprocessor
|
.md
|
parameter in the `preprocess` method.
rescale_factor (`int` or `float`, *optional*, defaults to `1/255`):
Scale factor to use if rescaling the image. Can be overridden by the `rescale_factor` parameter in the
`preprocess` method.
do_normalize (`bool`, *optional*, defaults to `True`):
Whether to normalize the image. Can be overridden by the `do_normalize` parameter in the `preprocess`
method.
image_mean (`float` or `List[float]`, *optional*, defaults to `IMAGENET_DEFAULT_MEAN`):
|
337_3_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#pvtimageprocessor
|
.md
|
method.
image_mean (`float` or `List[float]`, *optional*, defaults to `IMAGENET_DEFAULT_MEAN`):
Mean to use if normalizing the image. This is a float or list of floats the length of the number of
channels in the image. Can be overridden by the `image_mean` parameter in the `preprocess` method.
image_std (`float` or `List[float]`, *optional*, defaults to `IMAGENET_DEFAULT_STD`):
Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
|
337_3_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#pvtimageprocessor
|
.md
|
Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
number of channels in the image. Can be overridden by the `image_std` parameter in the `preprocess` method.
Methods: preprocess
|
337_3_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#pvtforimageclassification
|
.md
|
Pvt Model transformer with an image classification head on top (a linear layer on top of the final hidden state of
the [CLS] token) e.g. for ImageNet.
This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.
Parameters:
config ([`~PvtConfig`]): Model configuration class with all the parameters of the model.
|
337_4_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#pvtforimageclassification
|
.md
|
behavior.
Parameters:
config ([`~PvtConfig`]): 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
|
337_4_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#pvtmodel
|
.md
|
The bare Pvt encoder outputting raw hidden-states without any specific head on top.
This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.
Parameters:
config ([`~PvtConfig`]): Model configuration class with all the parameters of the model.
|
337_5_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/pvt.md
|
https://huggingface.co/docs/transformers/en/model_doc/pvt/#pvtmodel
|
.md
|
behavior.
Parameters:
config ([`~PvtConfig`]): 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
|
337_5_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/reformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/reformer/
|
.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
|
338_0_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/reformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/reformer/
|
.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.
-->
|
338_0_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/reformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/reformer/#reformer
|
.md
|
<div class="flex flex-wrap space-x-1">
<a href="https://huggingface.co/models?filter=reformer">
<img alt="Models" src="https://img.shields.io/badge/All_model_pages-reformer-blueviolet">
</a>
<a href="https://huggingface.co/spaces/docs-demos/reformer-crime-and-punishment">
<img alt="Spaces" src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue">
</a>
</div>
|
338_1_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/reformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/reformer/#overview
|
.md
|
The Reformer model was proposed in the paper [Reformer: The Efficient Transformer](https://arxiv.org/abs/2001.04451.pdf) by Nikita Kitaev, Łukasz Kaiser, Anselm Levskaya.
The abstract from the paper is the following:
*Large Transformer models routinely achieve state-of-the-art results on a number of tasks but training these models can
be prohibitively costly, especially on long sequences. We introduce two techniques to improve the efficiency of
|
338_2_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/reformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/reformer/#overview
|
.md
|
be prohibitively costly, especially on long sequences. We introduce two techniques to improve the efficiency of
Transformers. For one, we replace dot-product attention by one that uses locality-sensitive hashing, changing its
complexity from O(L^2) to O(Llog(L)), where L is the length of the sequence. Furthermore, we use reversible residual
layers instead of the standard residuals, which allows storing activations only once in the training process instead of
|
338_2_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/reformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/reformer/#overview
|
.md
|
layers instead of the standard residuals, which allows storing activations only once in the training process instead of
N times, where N is the number of layers. The resulting model, the Reformer, performs on par with Transformer models
while being much more memory-efficient and much faster on long sequences.*
This model was contributed by [patrickvonplaten](https://huggingface.co/patrickvonplaten). The Authors' code can be
found [here](https://github.com/google/trax/tree/master/trax/models/reformer).
|
338_2_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/reformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/reformer/#usage-tips
|
.md
|
- Reformer does **not** work with *torch.nn.DataParallel* due to a bug in PyTorch, see [issue #36035](https://github.com/pytorch/pytorch/issues/36035).
- Use Axial position encoding (see below for more details). It’s a mechanism to avoid having a huge positional encoding matrix (when the sequence length is very big) by factorizing it into smaller matrices.
|
338_3_0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.