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/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmtokenizer
.md
Args: vocab_file (`str`): Path to the vocabulary file. merges_file (`str`): Path to the merges file. errors (`str`, *optional*, defaults to `"replace"`): Paradigm to follow when decoding bytes to UTF-8. See [bytes.decode](https://docs.python.org/3/library/stdtypes.html#bytes.decode) for more information. bos_token (`st...
279_7_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmtokenizer
.md
The beginning of sequence token that was used during pretraining. Can be used a sequence classifier token. <Tip> When building a sequence using special tokens, this is not the token that is used for the beginning of sequence. The token used is the `cls_token`. </Tip> eos_token (`str`, *optional*, defaults to `"...
279_7_2
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmtokenizer
.md
The token used is the `sep_token`. </Tip> sep_token (`str`, *optional*, defaults to `"</s>"`): 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...
279_7_3
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmtokenizer
.md
token of a sequence built with special tokens. cls_token (`str`, *optional*, defaults to `"<s>"`): 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. unk_t...
279_7_4
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmtokenizer
.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. pad_token (`str`, *optional*, defaults to `"<pad>"`): The token used for padding, for example when batching sequences of different lengths. mask_token (`str`, *optional*, defaults to `"<mask>"`): T...
279_7_5
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmtokenizer
.md
modeling. This is the token which the model will try to predict. add_prefix_space (`bool`, *optional*, defaults to `False`): Whether or not to add an initial space to the input. This allows to treat the leading word just as any other word. (RoBERTa tokenizer detect beginning of words by the preceding space). Methods:...
279_7_6
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmtokenizerfast
.md
Construct a MarkupLM tokenizer. Based on byte-level Byte-Pair-Encoding (BPE). [`MarkupLMTokenizerFast`] can be used to turn HTML strings into to token-level `input_ids`, `attention_mask`, `token_type_ids`, `xpath_tags_seq` and `xpath_tags_seq`. This tokenizer inherits from [`PreTrainedTokenizer`] which contains most ...
279_8_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmtokenizerfast
.md
Args: vocab_file (`str`): Path to the vocabulary file. merges_file (`str`): Path to the merges file. errors (`str`, *optional*, defaults to `"replace"`): Paradigm to follow when decoding bytes to UTF-8. See [bytes.decode](https://docs.python.org/3/library/stdtypes.html#bytes.decode) for more information. bos_token (`st...
279_8_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmtokenizerfast
.md
The beginning of sequence token that was used during pretraining. Can be used a sequence classifier token. <Tip> When building a sequence using special tokens, this is not the token that is used for the beginning of sequence. The token used is the `cls_token`. </Tip> eos_token (`str`, *optional*, defaults to `"...
279_8_2
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmtokenizerfast
.md
The token used is the `sep_token`. </Tip> sep_token (`str`, *optional*, defaults to `"</s>"`): 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...
279_8_3
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmtokenizerfast
.md
token of a sequence built with special tokens. cls_token (`str`, *optional*, defaults to `"<s>"`): 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. unk_t...
279_8_4
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmtokenizerfast
.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. pad_token (`str`, *optional*, defaults to `"<pad>"`): The token used for padding, for example when batching sequences of different lengths. mask_token (`str`, *optional*, defaults to `"<mask>"`): T...
279_8_5
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmtokenizerfast
.md
modeling. This is the token which the model will try to predict. add_prefix_space (`bool`, *optional*, defaults to `False`): Whether or not to add an initial space to the input. This allows to treat the leading word just as any other word. (RoBERTa tokenizer detect beginning of words by the preceding space). Methods:...
279_8_6
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmprocessor
.md
Constructs a MarkupLM processor which combines a MarkupLM feature extractor and a MarkupLM tokenizer into a single processor. [`MarkupLMProcessor`] offers all the functionalities you need to prepare data for the model. It first uses [`MarkupLMFeatureExtractor`] to extract nodes and corresponding xpaths from one or ...
279_9_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmprocessor
.md
Next, these are provided to [`MarkupLMTokenizer`] or [`MarkupLMTokenizerFast`], which turns them into token-level `input_ids`, `attention_mask`, `token_type_ids`, `xpath_tags_seq` and `xpath_subs_seq`. Args: feature_extractor (`MarkupLMFeatureExtractor`): An instance of [`MarkupLMFeatureExtractor`]. The feature extra...
279_9_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmprocessor
.md
An instance of [`MarkupLMTokenizer`] or [`MarkupLMTokenizerFast`]. The tokenizer is a required input. parse_html (`bool`, *optional*, defaults to `True`): Whether or not to use `MarkupLMFeatureExtractor` to parse HTML strings into nodes and corresponding xpaths. Methods: __call__
279_9_2
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmmodel
.md
The bare MarkupLM Model transformer 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 usa...
279_10_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmmodel
.md
behavior. Parameters: config ([`MarkupLMConfig`]): 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...
279_10_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmforsequenceclassification
.md
MarkupLM 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 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 d...
279_11_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmforsequenceclassification
.md
behavior. Parameters: config ([`MarkupLMConfig`]): 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...
279_11_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmfortokenclassification
.md
MarkupLM Model with a `token_classification` 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 ([`...
279_12_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmfortokenclassification
.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
279_12_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmforquestionanswering
.md
MarkupLM 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 is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) sub-cla...
279_13_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/markuplm.md
https://huggingface.co/docs/transformers/en/model_doc/markuplm/#markuplmforquestionanswering
.md
behavior. Parameters: config ([`MarkupLMConfig`]): 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...
279_13_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/
.md
<!--Copyright 2021 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
280_0_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/
.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 ...
280_0_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#overview
.md
The BEiT model was proposed in [BEiT: BERT Pre-Training of Image Transformers](https://arxiv.org/abs/2106.08254) by Hangbo Bao, Li Dong and Furu Wei. Inspired by BERT, BEiT is the first paper that makes self-supervised pre-training of Vision Transformers (ViTs) outperform supervised pre-training. Rather than pre-traini...
280_1_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#overview
.md
of an image (as done in the [original ViT paper](https://arxiv.org/abs/2010.11929)), BEiT models are pre-trained to predict visual tokens from the codebook of OpenAI's [DALL-E model](https://arxiv.org/abs/2102.12092) given masked patches. The abstract from the paper is the following: *We introduce a self-supervised...
280_1_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#overview
.md
*We introduce a self-supervised vision representation model BEiT, which stands for Bidirectional Encoder representation from Image Transformers. Following BERT developed in the natural language processing area, we propose a masked image modeling task to pretrain vision Transformers. Specifically, each image has two vie...
280_1_2
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#overview
.md
patches (such as 16x16 pixels), and visual tokens (i.e., discrete tokens). We first "tokenize" the original image into visual tokens. Then we randomly mask some image patches and fed them into the backbone Transformer. The pre-training objective is to recover the original visual tokens based on the corrupted image patc...
280_1_3
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#overview
.md
directly fine-tune the model parameters on downstream tasks by appending task layers upon the pretrained encoder. Experimental results on image classification and semantic segmentation show that our model achieves competitive results with previous pre-training methods. For example, base-size BEiT achieves 83.2% top-1 a...
280_1_4
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#overview
.md
significantly outperforming from-scratch DeiT training (81.8%) with the same setup. Moreover, large-size BEiT obtains 86.3% only using ImageNet-1K, even outperforming ViT-L with supervised pre-training on ImageNet-22K (85.2%).* This model was contributed by [nielsr](https://huggingface.co/nielsr). The JAX/FLAX versio...
280_1_5
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#usage-tips
.md
- BEiT models are regular Vision Transformers, but pre-trained in a self-supervised way rather than supervised. They outperform both the [original model (ViT)](vit) as well as [Data-efficient Image Transformers (DeiT)](deit) when fine-tuned on ImageNet-1K and CIFAR-100. You can check out demo notebooks regarding infere...
280_2_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#usage-tips
.md
[`ViTFeatureExtractor`] by [`BeitImageProcessor`] and [`ViTForImageClassification`] by [`BeitForImageClassification`]). - There's also a demo notebook available which showcases how to combine DALL-E's image tokenizer with BEiT for performing masked image modeling. You can find it [here](https://github.com/NielsRogge/Tr...
280_2_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#usage-tips
.md
- As the BEiT models expect each image to be of the same size (resolution), one can use [`BeitImageProcessor`] to resize (or rescale) and normalize images for the model. - Both the patch resolution and image resolution used during pre-training or fine-tuning are reflected in the name of each checkpoint. For example, `m...
280_2_2
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#usage-tips
.md
each checkpoint. For example, `microsoft/beit-base-patch16-224` refers to a base-sized architecture with patch resolution of 16x16 and fine-tuning resolution of 224x224. All checkpoints can be found on the [hub](https://huggingface.co/models?search=microsoft/beit). - The available checkpoints are either (1) pre-trained...
280_2_3
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#usage-tips
.md
- The available checkpoints are either (1) pre-trained on [ImageNet-22k](http://www.image-net.org/) (a collection of 14 million images and 22k classes) only, (2) also fine-tuned on ImageNet-22k or (3) also fine-tuned on [ImageNet-1k](http://www.image-net.org/challenges/LSVRC/2012/) (also referred to as ILSVRC 2012, a c...
280_2_4
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#usage-tips
.md
- BEiT uses relative position embeddings, inspired by the T5 model. During pre-training, the authors shared the relative position bias among the several self-attention layers. During fine-tuning, each layer's relative position bias is initialized with the shared relative position bias obtained after pre-training. Note ...
280_2_5
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#usage-tips
.md
pre-train a model from scratch, one needs to either set the `use_relative_position_bias` or the `use_relative_position_bias` attribute of [`BeitConfig`] to `True` in order to add position embeddings. <img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/beit_ar...
280_2_6
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#using-scaled-dot-product-attention-sdpa
.md
PyTorch includes a native scaled dot-product attention (SDPA) operator as part of `torch.nn.functional`. This function encompasses several implementations that can be applied depending on the inputs and the hardware in use. See the [official documentation](https://pytorch.org/docs/stable/generated/torch.nn.functional.s...
280_3_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#using-scaled-dot-product-attention-sdpa
.md
page for more information. SDPA is used by default for `torch>=2.1.1` when an implementation is available, but you may also set `attn_implementation="sdpa"` in `from_pretrained()` to explicitly request SDPA to be used. ``` from transformers import BeitForImageClassification model = BeitForImageClassification.from_p...
280_3_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#using-scaled-dot-product-attention-sdpa
.md
... ``` For the best speedups, we recommend loading the model in half-precision (e.g. `torch.float16` or `torch.bfloat16`). On a local benchmark (NVIDIA GeForce RTX 2060-8GB, PyTorch 2.5.1, OS Ubuntu 20.04) with `float16` and `microsoft/beit-base-patch16-224` model, we saw the following improvements during training...
280_3_2
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#training
.md
| num_training_steps | batch_size | image_size | is_cuda | Time per batch (eager - s) | Time per batch (sdpa - s) | Speedup (%) | Eager peak mem (MB) | SDPA peak mem (MB) | Mem saving (%) | |--------------------|------------|--------------|---------|----------------------------|---------------------------|-----------...
280_4_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#training
.md
| 50 | 2 | (1048, 640) | True | 0.984 | 0.746 | 31.975 | 6738.915 | 4319.886 | 55.998 |
280_4_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#inference
.md
| Image batch size | Eager (s/iter) | Eager CI, % | Eager memory (MB) | SDPA (s/iter) | SDPA CI, % | SDPA memory (MB) | SDPA speedup | SDPA memory saved (%) | |-------------------:|-----------------:|:--------------|--------------------:|----------------:|:-------------|-------------------:|------------...
280_5_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#inference
.md
| 1 | 0.012 | ±0.3% | 3.76657e+08 | 0.011 | ±0.5% | 3.75739e+08 | 1.05 | 0.244 | | 4 | 0.013 | ±0.1% | 4.03147e+08 | 0.011 | ±0.2% | 3.90554e+08 | 1....
280_5_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#inference
.md
| 16 | 0.045 | ±0.1% | 4.96697e+08 | 0.035 | ±0.1% | 4.51232e+08 | 1.304 | 10.076 | | 32 | 0.088 | ±0.1% | 6.24417e+08 | 0.066 | ±0.1% | 5.33488e+08 | 1....
280_5_2
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#resources
.md
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with BEiT. <PipelineTag pipeline="image-classification"/> - [`BeitForImageClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classificati...
280_6_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#resources
.md
- See also: [Image classification task guide](../tasks/image_classification) **Semantic segmentation** - [Semantic segmentation task guide](../tasks/semantic_segmentation) 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 sho...
280_6_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beit-specific-outputs
.md
models.beit.modeling_beit.BeitModelOutputWithPooling Class for outputs of [`BeitModel`]. Args: last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`): Sequence of hidden-states at the output of the last layer of the model. pooler_output (`torch.FloatTensor` of shape `(batch_si...
280_7_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beit-specific-outputs
.md
Average of the last layer hidden states of the patch tokens (excluding the *[CLS]* token) if *config.use_mean_pooling* is set to True. If set to False, then the final hidden state of the *[CLS]* token will be returned. hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is p...
280_7_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beit-specific-outputs
.md
Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. Hidden-states of the model at the output of each layer plus the initial embedding outputs. attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `ou...
280_7_2
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beit-specific-outputs
.md
Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, sequence_length)`. Attentions weights after the attention softmax, used to compute the weighted average in the self-attention heads. [[autodoc]] models.beit.modeling_flax_beit.FlaxBeitModelOutputWithPooling: modelin...
280_7_3
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beit-specific-outputs
.md
modeling_flax_beit requires the FLAX library but it was not found in your environment. Checkout the instructions on the installation page: https://github.com/google/flax and follow the ones that match your environment. Please note that you may need to restart your runtime after installation.
280_7_4
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitconfig
.md
This is the configuration class to store the configuration of a [`BeitModel`]. It is used to instantiate an BEiT 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 BEiT [microsoft/beit-base-patch1...
280_8_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitconfig
.md
Args: vocab_size (`int`, *optional*, defaults to 8192): Vocabulary size of the BEiT model. Defines the number of different image tokens that can be used during pre-training. hidden_size (`int`, *optional*, defaults to 768): Dimensionality of the encoder layers and the pooler layer. num_hidden_layers (`int`, *optional*,...
280_8_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitconfig
.md
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" (i.e., feed-forward) layer in the Tran...
280_8_2
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitconfig
.md
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): The dropout probability for all fully connected layers in the embeddings, encoder, and pooler. attention_...
280_8_3
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitconfig
.md
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. layer_norm_eps (`float`, *optional*, defaults to 1e-12): The epsilon used by the layer normalization layers. imag...
280_8_4
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitconfig
.md
The size (resolution) of each image. patch_size (`int`, *optional*, defaults to 16): The size (resolution) of each patch. num_channels (`int`, *optional*, defaults to 3): The number of input channels. use_mask_token (`bool`, *optional*, defaults to `False`): Whether to use a mask token for masked image modeling. use_ab...
280_8_5
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitconfig
.md
Whether to use BERT-style absolute position embeddings. use_relative_position_bias (`bool`, *optional*, defaults to `False`): Whether to use T5-style relative position embeddings in the self-attention layers. use_shared_relative_position_bias (`bool`, *optional*, defaults to `False`): Whether to use the same relative p...
280_8_6
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitconfig
.md
layer_scale_init_value (`float`, *optional*, defaults to 0.1): Scale to use in the self-attention layers. 0.1 for base, 1e-5 for large. Set 0 to disable layer scale. drop_path_rate (`float`, *optional*, defaults to 0.1): Stochastic depth rate per sample (when applied in the main path of residual layers). use_mean_pooli...
280_8_7
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitconfig
.md
Whether to mean pool the final hidden states of the patches instead of using the final hidden state of the CLS token, before applying the classification head. pool_scales (`Tuple[int]`, *optional*, defaults to `[1, 2, 3, 6]`): Pooling scales used in Pooling Pyramid Module applied on the last feature map. use_auxiliary_...
280_8_8
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitconfig
.md
Whether to use an auxiliary head during training. auxiliary_loss_weight (`float`, *optional*, defaults to 0.4): Weight of the cross-entropy loss of the auxiliary head. auxiliary_channels (`int`, *optional*, defaults to 256): Number of channels to use in the auxiliary head. auxiliary_num_convs (`int`, *optional*, defaul...
280_8_9
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitconfig
.md
Number of convolutional layers to use in the auxiliary head. auxiliary_concat_input (`bool`, *optional*, defaults to `False`): Whether to concatenate the output of the auxiliary head with the input before the classification layer. semantic_loss_ignore_index (`int`, *optional*, defaults to 255): The index that is ignore...
280_8_10
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitconfig
.md
The index that is ignored by the loss function of the semantic segmentation model. out_features (`List[str]`, *optional*): If used as backbone, list of features to output. Can be any of `"stem"`, `"stage1"`, `"stage2"`, etc. (depending on how many stages the model has). If unset and `out_indices` is set, will default t...
280_8_11
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitconfig
.md
same order as defined in the `stage_names` attribute. out_indices (`List[int]`, *optional*): If used as backbone, list of indices of features to output. Can be any of 0, 1, 2, etc. (depending on how many stages the model has). If unset and `out_features` is set, will default to the corresponding stages. If unset and `o...
280_8_12
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitconfig
.md
same order as defined in the `stage_names` attribute. add_fpn (`bool`, *optional*, defaults to `False`): Whether to add a FPN as part of the backbone. Only relevant for [`BeitBackbone`]. reshape_hidden_states (`bool`, *optional*, defaults to `True`): Whether to reshape the feature maps to 4D tensors of shape `(batch_si...
280_8_13
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitconfig
.md
case the model is used as backbone. If `False`, the feature maps will be 3D tensors of shape `(batch_size, seq_len, hidden_size)`. Only relevant for [`BeitBackbone`]. Example: ```python >>> from transformers import BeitConfig, BeitModel
280_8_14
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitconfig
.md
>>> # Initializing a BEiT beit-base-patch16-224-pt22k style configuration >>> configuration = BeitConfig() >>> # Initializing a model (with random weights) from the beit-base-patch16-224-pt22k style configuration >>> model = BeitModel(configuration) >>> # Accessing the model configuration >>> configuration = model.co...
280_8_15
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitfeatureextractor
.md
No docstring available for BeitFeatureExtractor Methods: __call__ - post_process_semantic_segmentation
280_9_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitimageprocessor
.md
Constructs a BEiT image processor. Args: do_resize (`bool`, *optional*, defaults to `True`): Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by the `do_resize` parameter in the `preprocess` method. size (`Dict[str, int]` *optional*, defaults to `{"height": 256, "wid...
280_10_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitimageprocessor
.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.BICUBIC`): Resampling filter to use if resizing the image. Can be overridden by the `resample` parameter in the `preprocess` method. do_cente...
280_10_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitimageprocessor
.md
Whether to center crop the image. If the input size is smaller than `crop_size` along any edge, the image is padded with 0's and then center cropped. Can be overridden by the `do_center_crop` parameter in the `preprocess` method. crop_size (`Dict[str, int]`, *optional*, defaults to `{"height": 224, "width": 224}`): Des...
280_10_2
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitimageprocessor
.md
Can be overridden by the `crop_size` 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_rescale (`bool`, *optional*, defaults to `True`): ...
280_10_3
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitimageprocessor
.md
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_STANDARD_MEAN`): The mean to use if normalizi...
280_10_4
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitimageprocessor
.md
channels of the image. Can be overridden by the `image_mean` parameter in the `preprocess` method. image_std (`float` or `List[float]`, *optional*, defaults to `IMAGENET_STANDARD_STD`): The standard deviation to use if normalizing the image. This is a float or list of floats of length of the number of channels of the i...
280_10_5
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitimageprocessor
.md
do_reduce_labels (`bool`, *optional*, defaults to `False`): Whether or not to reduce all label values of segmentation maps by 1. Usually used for datasets where 0 is used for background, and background itself is not included in all classes of a dataset (e.g. ADE20k). The background label will be replaced by 255. Can be...
280_10_6
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitmodel
.md
The bare Beit Model transformer 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) subclass. Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage an...
280_11_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitmodel
.md
behavior. Parameters: config ([`BeitConfig`]): 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: fo...
280_11_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitformaskedimagemodeling
.md
Beit Model transformer with a 'language' modeling head on top. BEiT does masked image modeling by predicting visual tokens of a Vector-Quantize Variational Autoencoder (VQ-VAE), whereas other vision models like ViT and DeiT predict RGB pixel values. As a result, this class is incompatible with [`AutoModelForMaskedImage...
280_12_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitformaskedimagemodeling
.md
will need to use [`BeitForMaskedImageModeling`] directly if you wish to do masked image modeling with BEiT. This model is 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 gen...
280_12_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitformaskedimagemodeling
.md
behavior. Parameters: config ([`BeitConfig`]): 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: fo...
280_12_2
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitforimageclassification
.md
Beit Model transformer with an image classification head on top (a linear layer on top of the average of the final hidden states of the patch tokens) e.g. for ImageNet. This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass. Use it as a regular PyTorch Module and r...
280_13_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitforimageclassification
.md
behavior. Parameters: config ([`BeitConfig`]): 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: fo...
280_13_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitforsemanticsegmentation
.md
Beit Model transformer with a semantic segmentation head on top e.g. for ADE20k, CityScapes. This model is 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 an...
280_14_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#beitforsemanticsegmentation
.md
behavior. Parameters: config ([`BeitConfig`]): 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: fo...
280_14_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#flaxbeitmodel
.md
No docstring available for FlaxBeitModel Methods: __call__
280_15_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#flaxbeitformaskedimagemodeling
.md
No docstring available for FlaxBeitForMaskedImageModeling Methods: __call__
280_16_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/beit.md
https://huggingface.co/docs/transformers/en/model_doc/beit/#flaxbeitforimageclassification
.md
No docstring available for FlaxBeitForImageClassification Methods: __call__ </jax> </frameworkcontent>
280_17_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roc_bert.md
https://huggingface.co/docs/transformers/en/model_doc/roc_bert/
.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 agr...
281_0_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roc_bert.md
https://huggingface.co/docs/transformers/en/model_doc/roc_bert/
.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 ...
281_0_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roc_bert.md
https://huggingface.co/docs/transformers/en/model_doc/roc_bert/#overview
.md
The RoCBert model was proposed in [RoCBert: Robust Chinese Bert with Multimodal Contrastive Pretraining](https://aclanthology.org/2022.acl-long.65.pdf) by HuiSu, WeiweiShi, XiaoyuShen, XiaoZhou, TuoJi, JiaruiFang, JieZhou. It's a pretrained Chinese language model that is robust under various forms of adversarial attac...
281_1_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roc_bert.md
https://huggingface.co/docs/transformers/en/model_doc/roc_bert/#overview
.md
*Large-scale pretrained language models have achieved SOTA results on NLP tasks. However, they have been shown vulnerable to adversarial attacks especially for logographic languages like Chinese. In this work, we propose ROCBERT: a pretrained Chinese Bert that is robust to various forms of adversarial attacks like word...
281_1_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roc_bert.md
https://huggingface.co/docs/transformers/en/model_doc/roc_bert/#overview
.md
synonyms, typos, etc. It is pretrained with the contrastive learning objective which maximizes the label consistency under different synthesized adversarial examples. The model takes as input multimodal information including the semantic, phonetic and visual features. We show all these features are important to the mod...
281_1_2
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roc_bert.md
https://huggingface.co/docs/transformers/en/model_doc/roc_bert/#overview
.md
attack can be performed in all the three forms. Across 5 Chinese NLU tasks, ROCBERT outperforms strong baselines under three blackbox adversarial algorithms without sacrificing the performance on clean testset. It also performs the best in the toxic content detection task under human-made attacks.* This model was con...
281_1_3
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roc_bert.md
https://huggingface.co/docs/transformers/en/model_doc/roc_bert/#resources
.md
- [Text classification task guide](../tasks/sequence_classification) - [Token classification task guide](../tasks/token_classification) - [Question answering task guide](../tasks/question_answering) - [Causal language modeling task guide](../tasks/language_modeling) - [Masked language modeling task guide](../tasks/mask...
281_2_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roc_bert.md
https://huggingface.co/docs/transformers/en/model_doc/roc_bert/#rocbertconfig
.md
This is the configuration class to store the configuration of a [`RoCBertModel`]. It is used to instantiate a RoCBert 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 RoCBert [weiweishi/roc-bert...
281_3_0
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roc_bert.md
https://huggingface.co/docs/transformers/en/model_doc/roc_bert/#rocbertconfig
.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*, defaults to 30522): Vocabulary size of the RoCBert model. Defines the number of different tokens that can be...
281_3_1
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roc_bert.md
https://huggingface.co/docs/transformers/en/model_doc/roc_bert/#rocbertconfig
.md
hidden_size (`int`, *optional*, defaults to 768): Dimension 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 i...
281_3_2