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/llava_onevision.md
|
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionconfig
|
.md
|
>>> # Accessing the model configuration
>>> configuration = model.config
```
|
297_7_7
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
|
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionprocessor
|
.md
|
Constructs a LLaVa-Onevision processor which wraps a LLaVa-Onevision video processor, LLaVa-NeXT image processor and a LLaMa tokenizer into a single processor.
[`LlavaNextProcessor`] offers all the functionalities of [`LlavaOnevisionVideoProcessor`], [`LlavaOnevisionImageProcessor`] and [`LlamaTokenizerFast`]. See the
[`~LlavaOnevisionVideoProcessor.__call__`], [`~LlavaNextProcessor.__call__`] and [`~LlavaNextProcessor.decode`] for more information.
Args:
|
297_8_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
|
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionprocessor
|
.md
|
Args:
image_processor ([`LlavaOnevisionImageProcessor`], *optional*):
The image processor is a required input.
tokenizer ([`LlamaTokenizerFast`], *optional*):
The tokenizer is a required input.
video_processor ([`LlavaOnevisionVideoProcessor`], *optional*):
The video processor is a required input.
num_image_tokens (`int`, *optional*):
Number of image tokens for one imagethat will be returned by vision tower.
vision_feature_select_strategy (`str`, *optional*):
|
297_8_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
|
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionprocessor
|
.md
|
Number of image tokens for one imagethat will be returned by vision tower.
vision_feature_select_strategy (`str`, *optional*):
The feature selection strategy used to select the vision feature from the vision backbone.
Shoudl be same as in model's config
chat_template (`str`, *optional*): A Jinja template which will be used to convert lists of messages
in a chat into a tokenizable string.
image_token (`str`, *optional*, defaults to `"<image>"`):
Special token used to denote image location.
|
297_8_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
|
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionprocessor
|
.md
|
image_token (`str`, *optional*, defaults to `"<image>"`):
Special token used to denote image location.
video_token (`str`, *optional*, defaults to `"<video>"`):
Special token used to denote video location.
|
297_8_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
|
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionimageprocessor
|
.md
|
Constructs a LLaVa-Onevisino-Video video processor. Based on [`SiglipImageProcessor`] with incorporation of processing each video frame.
Args:
do_resize (`bool`, *optional*, defaults to `True`):
Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by
`do_resize` in the `preprocess` method.
size (`Dict[str, int]` *optional*, defaults to `{"shortest_edge": 224}`):
|
297_9_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
|
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionimageprocessor
|
.md
|
`do_resize` in the `preprocess` method.
size (`Dict[str, int]` *optional*, defaults to `{"shortest_edge": 224}`):
Size of the image after resizing. The shortest edge of the image is resized to size["shortest_edge"], with
the longest edge resized to keep the input aspect ratio. Can be overridden by `size` in the `preprocess`
method.
image_grid_pinpoints (`List` *optional*, defaults to `[[672, 336], [336, 672], [672, 672], [336, 1008], [1008, 336]]`):
|
297_9_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
|
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionimageprocessor
|
.md
|
method.
image_grid_pinpoints (`List` *optional*, defaults to `[[672, 336], [336, 672], [672, 672], [336, 1008], [1008, 336]]`):
A list of possible resolutions to use for processing high resolution images. The best resolution is selected
based on the original size of the image. Can be overridden by `image_grid_pinpoints` in the `preprocess`
method. Not used for processinf videos.
resample (`PILImageResampling`, *optional*, defaults to `Resampling.BICUBIC`):
|
297_9_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
|
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionimageprocessor
|
.md
|
method. Not used for processinf videos.
resample (`PILImageResampling`, *optional*, defaults to `Resampling.BICUBIC`):
Resampling filter to use if resizing the image. Can be overridden by `resample` 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 `do_rescale` in
the `preprocess` method.
rescale_factor (`int` or `float`, *optional*, defaults to `1/255`):
|
297_9_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
|
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionimageprocessor
|
.md
|
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 `rescale_factor` in the `preprocess`
method.
do_normalize (`bool`, *optional*, defaults to `True`):
Whether to normalize the image. Can be overridden by `do_normalize` in the `preprocess` method.
image_mean (`float` or `List[float]`, *optional*, defaults to `[0.48145466, 0.4578275, 0.40821073]`):
|
297_9_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
|
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionimageprocessor
|
.md
|
image_mean (`float` or `List[float]`, *optional*, defaults to `[0.48145466, 0.4578275, 0.40821073]`):
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 `[0.26862954, 0.26130258, 0.27577711]`):
Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
|
297_9_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
|
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionimageprocessor
|
.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.
Can be overridden by the `image_std` parameter in the `preprocess` method.
do_pad (`bool`, *optional*, defaults to `True`):
Whether to pad the image. If `True`, will pad the patch dimension of the images in the batch to the largest
|
297_9_6
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
|
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionimageprocessor
|
.md
|
Whether to pad the image. If `True`, will pad the patch dimension of the images in the batch to the largest
number of patches in the batch. Padding will be applied to the bottom and right with zeros.
do_convert_rgb (`bool`, *optional*, defaults to `True`):
Whether to convert the image to RGB.
|
297_9_7
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
|
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionvideoprocessor
|
.md
|
Constructs a LLaVa-Onevisino-Video video processor. Based on [`SiglipImageProcessor`] with incorporation of processing each video frame.
Args:
do_resize (`bool`, *optional*, defaults to `True`):
Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by
`do_resize` in the `preprocess` method.
size (`Dict[str, int]` *optional*, defaults to `{"shortest_edge": 224}`):
|
297_10_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
|
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionvideoprocessor
|
.md
|
`do_resize` in the `preprocess` method.
size (`Dict[str, int]` *optional*, defaults to `{"shortest_edge": 224}`):
Size of the image after resizing. The shortest edge of the image is resized to size["shortest_edge"], with
the longest edge resized to keep the input aspect ratio. Can be overridden by `size` in the `preprocess`
method.
resample (`PILImageResampling`, *optional*, defaults to `Resampling.BICUBIC`):
|
297_10_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
|
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionvideoprocessor
|
.md
|
method.
resample (`PILImageResampling`, *optional*, defaults to `Resampling.BICUBIC`):
Resampling filter to use if resizing the image. Can be overridden by `resample` 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 `do_rescale` in
the `preprocess` method.
rescale_factor (`int` or `float`, *optional*, defaults to `1/255`):
|
297_10_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
|
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionvideoprocessor
|
.md
|
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 `rescale_factor` in the `preprocess`
method.
do_normalize (`bool`, *optional*, defaults to `True`):
Whether to normalize the image. Can be overridden by `do_normalize` in the `preprocess` method.
image_mean (`float` or `List[float]`, *optional*, defaults to `[0.48145466, 0.4578275, 0.40821073]`):
|
297_10_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
|
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionvideoprocessor
|
.md
|
image_mean (`float` or `List[float]`, *optional*, defaults to `[0.48145466, 0.4578275, 0.40821073]`):
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 `[0.26862954, 0.26130258, 0.27577711]`):
Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
|
297_10_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
|
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionvideoprocessor
|
.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.
Can be overridden by the `image_std` parameter in the `preprocess` method.
do_convert_rgb (`bool`, *optional*, defaults to `True`):
Whether to convert the image to RGB.
|
297_10_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
|
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionforconditionalgeneration
|
.md
|
The LLaVA-Onevision model which consists of a vision backbone and a language model.
This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
|
297_11_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
|
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionforconditionalgeneration
|
.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 ([`LlavaNextConfig`] or [`LlavaNextVisionConfig`]):
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
|
297_11_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/llava_onevision.md
|
https://huggingface.co/docs/transformers/en/model_doc/llava_onevision/#llavaonevisionforconditionalgeneration
|
.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
|
297_11_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/
|
.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
|
298_0_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/
|
.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.
-->
|
298_0_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#overview
|
.md
|
The BROS model was proposed in [BROS: A Pre-trained Language Model Focusing on Text and Layout for Better Key Information Extraction from Documents](https://arxiv.org/abs/2108.04539) by Teakgyu Hong, Donghyun Kim, Mingi Ji, Wonseok Hwang, Daehyun Nam, Sungrae Park.
|
298_1_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#overview
|
.md
|
BROS stands for *BERT Relying On Spatiality*. It is an encoder-only Transformer model that takes a sequence of tokens and their bounding boxes as inputs and outputs a sequence of hidden states. BROS encode relative spatial information instead of using absolute spatial information.
It is pre-trained with two objectives: a token-masked language modeling objective (TMLM) used in BERT, and a novel area-masked language modeling objective (AMLM)
|
298_1_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#overview
|
.md
|
In TMLM, tokens are randomly masked, and the model predicts the masked tokens using spatial information and other unmasked tokens.
AMLM is a 2D version of TMLM. It randomly masks text tokens and predicts with the same information as TMLM, but it masks text blocks (areas).
`BrosForTokenClassification` has a simple linear layer on top of BrosModel. It predicts the label of each token.
|
298_1_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#overview
|
.md
|
`BrosSpadeEEForTokenClassification` has an `initial_token_classifier` and `subsequent_token_classifier` on top of BrosModel. `initial_token_classifier` is used to predict the first token of each entity, and `subsequent_token_classifier` is used to predict the next token of within entity. `BrosSpadeELForTokenClassification` has an `entity_linker` on top of BrosModel. `entity_linker` is used to predict the relation between two entities.
|
298_1_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#overview
|
.md
|
`BrosForTokenClassification` and `BrosSpadeEEForTokenClassification` essentially perform the same job. However, `BrosForTokenClassification` assumes input tokens are perfectly serialized (which is very challenging task since they exist in a 2D space), while `BrosSpadeEEForTokenClassification` allows for more flexibility in handling serialization errors as it predicts next connection tokens from one token.
|
298_1_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#overview
|
.md
|
`BrosSpadeELForTokenClassification` perform the intra-entity linking task. It predicts relation from one token (of one entity) to another token (of another entity) if these two entities share some relation.
BROS achieves comparable or better result on Key Information Extraction (KIE) benchmarks such as FUNSD, SROIE, CORD and SciTSR, without relying on explicit visual features.
The abstract from the paper is the following:
|
298_1_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#overview
|
.md
|
*Key information extraction (KIE) from document images requires understanding the contextual and spatial semantics of texts in two-dimensional (2D) space. Many recent studies try to solve the task by developing pre-trained language models focusing on combining visual features from document images with texts and their layout. On the other hand, this paper tackles the problem by going back to the basic: effective combination of text and layout. Specifically, we propose a pre-trained language model, named
|
298_1_6
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#overview
|
.md
|
going back to the basic: effective combination of text and layout. Specifically, we propose a pre-trained language model, named BROS (BERT Relying On Spatiality), that encodes relative positions of texts in 2D space and learns from unlabeled documents with area-masking strategy. With this optimized training scheme for understanding texts in 2D space, BROS shows comparable or better performance compared to previous methods on four KIE benchmarks (FUNSD, SROIE*, CORD, and SciTSR) without relying on visual
|
298_1_7
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#overview
|
.md
|
performance compared to previous methods on four KIE benchmarks (FUNSD, SROIE*, CORD, and SciTSR) without relying on visual features. This paper also reveals two real-world challenges in KIE tasks-(1) minimizing the error from incorrect text ordering and (2) efficient learning from fewer downstream examples-and demonstrates the superiority of BROS over previous methods.*
|
298_1_8
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#overview
|
.md
|
This model was contributed by [jinho8345](https://huggingface.co/jinho8345). The original code can be found [here](https://github.com/clovaai/bros).
|
298_1_9
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#usage-tips-and-examples
|
.md
|
- [`~transformers.BrosModel.forward`] requires `input_ids` and `bbox` (bounding box). Each bounding box should be in (x0, y0, x1, y1) format (top-left corner, bottom-right corner). Obtaining of Bounding boxes depends on external OCR system. The `x` coordinate should be normalized by document image width, and the `y` coordinate should be normalized by document image height.
```python
def expand_and_normalize_bbox(bboxes, doc_width, doc_height):
# here, bboxes are numpy array
|
298_2_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#usage-tips-and-examples
|
.md
|
# Normalize bbox -> 0 ~ 1
bboxes[:, [0, 2]] = bboxes[:, [0, 2]] / width
bboxes[:, [1, 3]] = bboxes[:, [1, 3]] / height
```
|
298_2_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#usage-tips-and-examples
|
.md
|
```
- [`~transformers.BrosForTokenClassification.forward`, `~transformers.BrosSpadeEEForTokenClassification.forward`, `~transformers.BrosSpadeEEForTokenClassification.forward`] require not only `input_ids` and `bbox` but also `box_first_token_mask` for loss calculation. It is a mask to filter out non-first tokens of each box. You can obtain this mask by saving start token indices of bounding boxes when creating `input_ids` from words. You can make `box_first_token_mask` with following code,
```python
|
298_2_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#usage-tips-and-examples
|
.md
|
```python
def make_box_first_token_mask(bboxes, words, tokenizer, max_seq_length=512):
|
298_2_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#usage-tips-and-examples
|
.md
|
box_first_token_mask = np.zeros(max_seq_length, dtype=np.bool_)
# encode(tokenize) each word from words (List[str])
input_ids_list: List[List[int]] = [tokenizer.encode(e, add_special_tokens=False) for e in words]
# get the length of each box
tokens_length_list: List[int] = [len(l) for l in input_ids_list]
box_end_token_indices = np.array(list(itertools.accumulate(tokens_length_list)))
box_start_token_indices = box_end_token_indices - np.array(tokens_length_list)
|
298_2_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#usage-tips-and-examples
|
.md
|
# filter out the indices that are out of max_seq_length
box_end_token_indices = box_end_token_indices[box_end_token_indices < max_seq_length - 1]
if len(box_start_token_indices) > len(box_end_token_indices):
box_start_token_indices = box_start_token_indices[: len(box_end_token_indices)]
# set box_start_token_indices to True
box_first_token_mask[box_start_token_indices] = True
return box_first_token_mask
```
|
298_2_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#resources
|
.md
|
- Demo scripts can be found [here](https://github.com/clovaai/bros).
|
298_3_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#brosconfig
|
.md
|
This is the configuration class to store the configuration of a [`BrosModel`] or a [`TFBrosModel`]. It is used to
instantiate a Bros 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 Bros
[jinho8345/bros-base-uncased](https://huggingface.co/jinho8345/bros-base-uncased) architecture.
|
298_4_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#brosconfig
|
.md
|
[jinho8345/bros-base-uncased](https://huggingface.co/jinho8345/bros-base-uncased) architecture.
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
documentation from [`PretrainedConfig`] for more information.
Args:
vocab_size (`int`, *optional*, defaults to 30522):
Vocabulary size of the Bros model. Defines the number of different tokens that can be represented by the
`inputs_ids` passed when calling [`BrosModel`] or [`TFBrosModel`].
|
298_4_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#brosconfig
|
.md
|
`inputs_ids` passed when calling [`BrosModel`] or [`TFBrosModel`].
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):
|
298_4_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#brosconfig
|
.md
|
intermediate_size (`int`, *optional*, defaults to 3072):
Dimensionality of the "intermediate" (often named feed-forward) layer in the Transformer encoder.
hidden_act (`str` or `Callable`, *optional*, defaults to `"gelu"`):
The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
`"relu"`, `"silu"` and `"gelu_new"` are supported.
hidden_dropout_prob (`float`, *optional*, defaults to 0.1):
|
298_4_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#brosconfig
|
.md
|
`"relu"`, `"silu"` and `"gelu_new"` are supported.
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 512):
The maximum sequence length that this model might ever be used with. Typically set this to something large
|
298_4_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#brosconfig
|
.md
|
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).
type_vocab_size (`int`, *optional*, defaults to 2):
The vocabulary size of the `token_type_ids` passed when calling [`BrosModel`] or [`TFBrosModel`].
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):
|
298_4_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#brosconfig
|
.md
|
layer_norm_eps (`float`, *optional*, defaults to 1e-12):
The epsilon used by the layer normalization layers.
pad_token_id (`int`, *optional*, defaults to 0):
The index of the padding token in the token vocabulary.
dim_bbox (`int`, *optional*, defaults to 8):
The dimension of the bounding box coordinates. (x0, y1, x1, y0, x1, y1, x0, y1)
bbox_scale (`float`, *optional*, defaults to 100.0):
The scale factor of the bounding box coordinates.
n_relations (`int`, *optional*, defaults to 1):
|
298_4_6
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#brosconfig
|
.md
|
The scale factor of the bounding box coordinates.
n_relations (`int`, *optional*, defaults to 1):
The number of relations for SpadeEE(entity extraction), SpadeEL(entity linking) head.
classifier_dropout_prob (`float`, *optional*, defaults to 0.1):
The dropout ratio for the classifier head.
Examples:
```python
>>> from transformers import BrosConfig, BrosModel
|
298_4_7
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#brosconfig
|
.md
|
>>> # Initializing a BROS jinho8345/bros-base-uncased style configuration
>>> configuration = BrosConfig()
>>> # Initializing a model from the jinho8345/bros-base-uncased style configuration
>>> model = BrosModel(configuration)
>>> # Accessing the model configuration
>>> configuration = model.config
```
|
298_4_8
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#brosprocessor
|
.md
|
Constructs a Bros processor which wraps a BERT tokenizer.
[`BrosProcessor`] offers all the functionalities of [`BertTokenizerFast`]. See the docstring of
[`~BrosProcessor.__call__`] and [`~BrosProcessor.decode`] for more information.
Args:
tokenizer (`BertTokenizerFast`, *optional*):
An instance of ['BertTokenizerFast`]. The tokenizer is a required input.
Methods: __call__
|
298_5_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#brosmodel
|
.md
|
The bare Bros Model transformer outputting raw hidden-states without any specific head on top.
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 ([`BrosConfig`]): Model configuration class with all the parameters of the model.
|
298_6_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#brosmodel
|
.md
|
and behavior.
Parameters:
config ([`BrosConfig`]): 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
|
298_6_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#brosfortokenclassification
|
.md
|
Bros 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 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 ([`BrosConfig`]): Model configuration class with all the parameters of the model.
|
298_7_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#brosfortokenclassification
|
.md
|
and behavior.
Parameters:
config ([`BrosConfig`]): 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
|
298_7_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#brosspadeeefortokenclassification
|
.md
|
Bros Model with a token classification head on top (initial_token_layers and subsequent_token_layer on top of the
hidden-states output) e.g. for Named-Entity-Recognition (NER) tasks. The initial_token_classifier is used to
predict the first token of each entity, and the subsequent_token_classifier is used to predict the subsequent
tokens within an entity. Compared to BrosForTokenClassification, this model is more robust to serialization errors
since it predicts next token from one token.
|
298_8_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#brosspadeeefortokenclassification
|
.md
|
since it predicts next token from one token.
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 ([`BrosConfig`]): 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
|
298_8_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#brosspadeeefortokenclassification
|
.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
|
298_8_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#brosspadeelfortokenclassification
|
.md
|
Bros Model with a token classification head on top (a entity_linker layer on top of the hidden-states output) e.g.
for Entity-Linking. The entity_linker is used to predict intra-entity links (one entity to another entity).
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:
|
298_9_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/bros.md
|
https://huggingface.co/docs/transformers/en/model_doc/bros/#brosspadeelfortokenclassification
|
.md
|
and behavior.
Parameters:
config ([`BrosConfig`]): 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
|
298_9_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/
|
.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
|
299_0_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/
|
.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.
-->
|
299_0_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#roberta
|
.md
|
<div class="flex flex-wrap space-x-1">
<a href="https://huggingface.co/models?filter=roberta">
<img alt="Models" src="https://img.shields.io/badge/All_model_pages-roberta-blueviolet">
</a>
<a href="https://huggingface.co/spaces/docs-demos/roberta-base">
<img alt="Spaces" src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue">
</a>
<a href="https://huggingface.co/papers/1907.11692">
<img alt="Paper page" src="https://img.shields.io/badge/Paper%20page-1907.11692-green">
</a>
</div>
|
299_1_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#overview
|
.md
|
The RoBERTa model was proposed in [RoBERTa: A Robustly Optimized BERT Pretraining Approach](https://arxiv.org/abs/1907.11692) by Yinhan Liu, [Myle Ott](https://huggingface.co/myleott), Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer
Levy, Mike Lewis, Luke Zettlemoyer, Veselin Stoyanov. It is based on Google's BERT model released in 2018.
It builds on BERT and modifies key hyperparameters, removing the next-sentence pretraining objective and training with
|
299_2_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#overview
|
.md
|
It builds on BERT and modifies key hyperparameters, removing the next-sentence pretraining objective and training with
much larger mini-batches and learning rates.
The abstract from the paper is the following:
*Language model pretraining has led to significant performance gains but careful comparison between different
approaches is challenging. Training is computationally expensive, often done on private datasets of different sizes,
|
299_2_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#overview
|
.md
|
approaches is challenging. Training is computationally expensive, often done on private datasets of different sizes,
and, as we will show, hyperparameter choices have significant impact on the final results. We present a replication
study of BERT pretraining (Devlin et al., 2019) that carefully measures the impact of many key hyperparameters and
training data size. We find that BERT was significantly undertrained, and can match or exceed the performance of every
|
299_2_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#overview
|
.md
|
training data size. We find that BERT was significantly undertrained, and can match or exceed the performance of every
model published after it. Our best model achieves state-of-the-art results on GLUE, RACE and SQuAD. These results
highlight the importance of previously overlooked design choices, and raise questions about the source of recently
reported improvements. We release our models and code.*
|
299_2_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#overview
|
.md
|
reported improvements. We release our models and code.*
This model was contributed by [julien-c](https://huggingface.co/julien-c). The original code can be found [here](https://github.com/pytorch/fairseq/tree/master/examples/roberta).
|
299_2_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#usage-tips
|
.md
|
- This implementation is the same as [`BertModel`] with a minor tweak to the embeddings, as well as a setup
for RoBERTa pretrained models.
- RoBERTa has the same architecture as BERT but uses a byte-level BPE as a tokenizer (same as GPT-2) and uses a
different pretraining scheme.
- RoBERTa doesn't have `token_type_ids`, so you don't need to indicate which token belongs to which segment. Just
separate your segments with the separation token `tokenizer.sep_token` (or `</s>`).
|
299_3_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#usage-tips
|
.md
|
separate your segments with the separation token `tokenizer.sep_token` (or `</s>`).
- RoBERTa is similar to BERT but with better pretraining techniques:
* Dynamic masking: tokens are masked differently at each epoch, whereas BERT does it once and for all.
* Sentence packing: Sentences are packed together to reach 512 tokens (so the sentences are in an order that may span several documents).
* Larger batches: Training uses larger batches.
|
299_3_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#usage-tips
|
.md
|
* Larger batches: Training uses larger batches.
* Byte-level BPE vocabulary: Uses BPE with bytes as a subunit instead of characters, accommodating Unicode characters.
- [CamemBERT](camembert) is a wrapper around RoBERTa. Refer to its model page for usage examples.
|
299_3_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#resources
|
.md
|
A list of official Hugging Face and community (indicated by π) resources to help you get started with RoBERTa. If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.
<PipelineTag pipeline="text-classification"/>
|
299_4_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#resources
|
.md
|
<PipelineTag pipeline="text-classification"/>
- A blog on [Getting Started with Sentiment Analysis on Twitter](https://huggingface.co/blog/sentiment-analysis-twitter) using RoBERTa and the [Inference API](https://huggingface.co/inference-api).
- A blog on [Opinion Classification with Kili and Hugging Face AutoTrain](https://huggingface.co/blog/opinion-classification-with-kili) using RoBERTa.
|
299_4_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#resources
|
.md
|
- A notebook on how to [finetune RoBERTa for sentiment analysis](https://colab.research.google.com/github/DhavalTaunk08/NLP_scripts/blob/master/sentiment_analysis_using_roberta.ipynb). π
- [`RobertaForSequenceClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification.ipynb).
|
299_4_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#resources
|
.md
|
- [`TFRobertaForSequenceClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/text-classification) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification-tf.ipynb).
|
299_4_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#resources
|
.md
|
- [`FlaxRobertaForSequenceClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/flax/text-classification) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification_flax.ipynb).
- [Text classification task guide](../tasks/sequence_classification)
<PipelineTag pipeline="token-classification"/>
|
299_4_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#resources
|
.md
|
- [Text classification task guide](../tasks/sequence_classification)
<PipelineTag pipeline="token-classification"/>
- [`RobertaForTokenClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/token-classification) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification.ipynb).
|
299_4_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#resources
|
.md
|
- [`TFRobertaForTokenClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/token-classification) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification-tf.ipynb).
- [`FlaxRobertaForTokenClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/flax/token-classification).
|
299_4_6
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#resources
|
.md
|
- [Token classification](https://huggingface.co/course/chapter7/2?fw=pt) chapter of the π€ Hugging Face Course.
- [Token classification task guide](../tasks/token_classification)
<PipelineTag pipeline="fill-mask"/>
- A blog on [How to train a new language model from scratch using Transformers and Tokenizers](https://huggingface.co/blog/how-to-train) with RoBERTa.
|
299_4_7
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#resources
|
.md
|
- [`RobertaForMaskedLM`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/language-modeling#robertabertdistilbert-and-masked-language-modeling) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb).
|
299_4_8
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#resources
|
.md
|
- [`TFRobertaForMaskedLM`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/language-modeling#run_mlmpy) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb).
|
299_4_9
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#resources
|
.md
|
- [`FlaxRobertaForMaskedLM`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/flax/language-modeling#masked-language-modeling) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/masked_language_modeling_flax.ipynb).
- [Masked language modeling](https://huggingface.co/course/chapter7/3?fw=pt) chapter of the π€ Hugging Face Course.
- [Masked language modeling task guide](../tasks/masked_language_modeling)
|
299_4_10
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#resources
|
.md
|
- [Masked language modeling task guide](../tasks/masked_language_modeling)
<PipelineTag pipeline="question-answering"/>
- A blog on [Accelerated Inference with Optimum and Transformers Pipelines](https://huggingface.co/blog/optimum-inference) with RoBERTa for question answering.
|
299_4_11
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#resources
|
.md
|
- [`RobertaForQuestionAnswering`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering.ipynb).
|
299_4_12
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#resources
|
.md
|
- [`TFRobertaForQuestionAnswering`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/question-answering) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering-tf.ipynb).
- [`FlaxRobertaForQuestionAnswering`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/flax/question-answering).
|
299_4_13
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#resources
|
.md
|
- [Question answering](https://huggingface.co/course/chapter7/7?fw=pt) chapter of the π€ Hugging Face Course.
- [Question answering task guide](../tasks/question_answering)
**Multiple choice**
- [`RobertaForMultipleChoice`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/multiple-choice) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multiple_choice.ipynb).
|
299_4_14
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#resources
|
.md
|
- [`TFRobertaForMultipleChoice`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/multiple-choice) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multiple_choice-tf.ipynb).
- [Multiple choice task guide](../tasks/multiple_choice)
|
299_4_15
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#robertaconfig
|
.md
|
This is the configuration class to store the configuration of a [`RobertaModel`] or a [`TFRobertaModel`]. It is
used to instantiate a RoBERTa 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 RoBERTa
[FacebookAI/roberta-base](https://huggingface.co/FacebookAI/roberta-base) architecture.
|
299_5_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#robertaconfig
|
.md
|
[FacebookAI/roberta-base](https://huggingface.co/FacebookAI/roberta-base) architecture.
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
documentation from [`PretrainedConfig`] for more information.
Args:
vocab_size (`int`, *optional*, defaults to 50265):
Vocabulary size of the RoBERTa model. Defines the number of different tokens that can be represented by the
`inputs_ids` passed when calling [`RobertaModel`] or [`TFRobertaModel`].
|
299_5_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#robertaconfig
|
.md
|
`inputs_ids` passed when calling [`RobertaModel`] or [`TFRobertaModel`].
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):
|
299_5_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#robertaconfig
|
.md
|
intermediate_size (`int`, *optional*, defaults to 3072):
Dimensionality of the "intermediate" (often named feed-forward) layer in the Transformer encoder.
hidden_act (`str` or `Callable`, *optional*, defaults to `"gelu"`):
The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
`"relu"`, `"silu"` and `"gelu_new"` are supported.
hidden_dropout_prob (`float`, *optional*, defaults to 0.1):
|
299_5_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#robertaconfig
|
.md
|
`"relu"`, `"silu"` and `"gelu_new"` are supported.
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 512):
The maximum sequence length that this model might ever be used with. Typically set this to something large
|
299_5_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#robertaconfig
|
.md
|
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).
type_vocab_size (`int`, *optional*, defaults to 2):
The vocabulary size of the `token_type_ids` passed when calling [`RobertaModel`] or [`TFRobertaModel`].
initializer_range (`float`, *optional*, defaults to 0.02):
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
299_5_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#robertaconfig
|
.md
|
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.
position_embedding_type (`str`, *optional*, defaults to `"absolute"`):
Type of position embedding. Choose one of `"absolute"`, `"relative_key"`, `"relative_key_query"`. For
positional embeddings use `"absolute"`. For more information on `"relative_key"`, please refer to
|
299_5_6
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#robertaconfig
|
.md
|
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).
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`):
|
299_5_7
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#robertaconfig
|
.md
|
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`):
Whether or not the model should return the last key/values attentions (not used by all models). Only
relevant if `config.is_decoder=True`.
classifier_dropout (`float`, *optional*):
The dropout ratio for the classification head.
Examples:
```python
>>> from transformers import RobertaConfig, RobertaModel
|
299_5_8
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#robertaconfig
|
.md
|
>>> # Initializing a RoBERTa configuration
>>> configuration = RobertaConfig()
>>> # Initializing a model (with random weights) from the configuration
>>> model = RobertaModel(configuration)
>>> # Accessing the model configuration
>>> configuration = model.config
```
|
299_5_9
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#robertatokenizer
|
.md
|
Constructs a RoBERTa tokenizer, derived from the GPT-2 tokenizer, using byte-level Byte-Pair-Encoding.
This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will
be encoded differently whether it is at the beginning of the sentence (without space) or not:
```python
>>> from transformers import RobertaTokenizer
>>> tokenizer = RobertaTokenizer.from_pretrained("FacebookAI/roberta-base")
>>> tokenizer("Hello world")["input_ids"]
[0, 31414, 232, 2]
|
299_6_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#robertatokenizer
|
.md
|
>>> tokenizer(" Hello world")["input_ids"]
[0, 20920, 232, 2]
```
You can get around that behavior by passing `add_prefix_space=True` when instantiating this tokenizer or when you
call it on some text, but since the model was not pretrained this way, it might yield a decrease in performance.
<Tip>
When used with `is_split_into_words=True`, this tokenizer will add a space before each word (even the first one).
</Tip>
|
299_6_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/roberta.md
|
https://huggingface.co/docs/transformers/en/model_doc/roberta/#robertatokenizer
|
.md
|
When used with `is_split_into_words=True`, this tokenizer will add a space before each word (even the first one).
</Tip>
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.
Args:
vocab_file (`str`):
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
|
299_6_2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.