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/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/
|
.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
|
193_0_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/
|
.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.
-->
|
193_0_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlm
|
.md
|
<a id='Overview'></a>
|
193_1_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#overview
|
.md
|
The LayoutLM model was proposed in the paper [LayoutLM: Pre-training of Text and Layout for Document Image
Understanding](https://arxiv.org/abs/1912.13318) by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei, and
Ming Zhou. It's a simple but effective pretraining method of text and layout for document image understanding and
information extraction tasks, such as form understanding and receipt understanding. It obtains state-of-the-art results
on several downstream tasks:
|
193_2_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#overview
|
.md
|
on several downstream tasks:
- form understanding: the [FUNSD](https://guillaumejaume.github.io/FUNSD/) dataset (a collection of 199 annotated
forms comprising more than 30,000 words).
- receipt understanding: the [SROIE](https://rrc.cvc.uab.es/?ch=13) dataset (a collection of 626 receipts for
training and 347 receipts for testing).
- document image classification: the [RVL-CDIP](https://www.cs.cmu.edu/~aharley/rvl-cdip/) dataset (a collection of
400,000 images belonging to one of 16 classes).
|
193_2_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#overview
|
.md
|
400,000 images belonging to one of 16 classes).
The abstract from the paper is the following:
*Pre-training techniques have been verified successfully in a variety of NLP tasks in recent years. Despite the
widespread use of pretraining models for NLP applications, they almost exclusively focus on text-level manipulation,
while neglecting layout and style information that is vital for document image understanding. In this paper, we propose
|
193_2_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#overview
|
.md
|
while neglecting layout and style information that is vital for document image understanding. In this paper, we propose
the LayoutLM to jointly model interactions between text and layout information across scanned document images, which is
beneficial for a great number of real-world document image understanding tasks such as information extraction from
scanned documents. Furthermore, we also leverage image features to incorporate words' visual information into LayoutLM.
|
193_2_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#overview
|
.md
|
scanned documents. Furthermore, we also leverage image features to incorporate words' visual information into LayoutLM.
To the best of our knowledge, this is the first time that text and layout are jointly learned in a single framework for
document-level pretraining. It achieves new state-of-the-art results in several downstream tasks, including form
understanding (from 70.72 to 79.27), receipt understanding (from 94.02 to 95.24) and document image classification
(from 93.07 to 94.42).*
|
193_2_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#usage-tips
|
.md
|
- In addition to *input_ids*, [`~transformers.LayoutLMModel.forward`] also expects the input `bbox`, which are
the bounding boxes (i.e. 2D-positions) of the input tokens. These can be obtained using an external OCR engine such
as Google's [Tesseract](https://github.com/tesseract-ocr/tesseract) (there's a [Python wrapper](https://pypi.org/project/pytesseract/) available). Each bounding box should be in (x0, y0, x1, y1) format, where
|
193_3_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#usage-tips
|
.md
|
(x0, y0) corresponds to the position of the upper left corner in the bounding box, and (x1, y1) represents the
position of the lower right corner. Note that one first needs to normalize the bounding boxes to be on a 0-1000
scale. To normalize, you can use the following function:
```python
def normalize_bbox(bbox, width, height):
return [
int(1000 * (bbox[0] / width)),
int(1000 * (bbox[1] / height)),
int(1000 * (bbox[2] / width)),
int(1000 * (bbox[3] / height)),
]
```
|
193_3_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#usage-tips
|
.md
|
int(1000 * (bbox[1] / height)),
int(1000 * (bbox[2] / width)),
int(1000 * (bbox[3] / height)),
]
```
Here, `width` and `height` correspond to the width and height of the original document in which the token
occurs. Those can be obtained using the Python Image Library (PIL) library for example, as follows:
```python
from PIL import Image
|
193_3_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#usage-tips
|
.md
|
# Document can be a png, jpg, etc. PDFs must be converted to images.
image = Image.open(name_of_your_document).convert("RGB")
width, height = image.size
```
|
193_3_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#resources
|
.md
|
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with LayoutLM. 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="document-question-answering" />
- A blog post on [fine-tuning
LayoutLM for document-understanding using Keras & Hugging Face
|
193_4_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#resources
|
.md
|
- A blog post on [fine-tuning
LayoutLM for document-understanding using Keras & Hugging Face
Transformers](https://www.philschmid.de/fine-tuning-layoutlm-keras).
- A blog post on how to [fine-tune LayoutLM for document-understanding using only Hugging Face Transformers](https://www.philschmid.de/fine-tuning-layoutlm).
|
193_4_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#resources
|
.md
|
- A notebook on how to [fine-tune LayoutLM on the FUNSD dataset with image embeddings](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Add_image_embeddings_to_LayoutLM.ipynb).
- See also: [Document question answering task guide](../tasks/document_question_answering)
<PipelineTag pipeline="text-classification" />
|
193_4_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#resources
|
.md
|
<PipelineTag pipeline="text-classification" />
- A notebook on how to [fine-tune LayoutLM for sequence classification on the RVL-CDIP dataset](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Fine_tuning_LayoutLMForSequenceClassification_on_RVL_CDIP.ipynb).
- [Text classification task guide](../tasks/sequence_classification)
<PipelineTag pipeline="token-classification" />
|
193_4_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#resources
|
.md
|
- [Text classification task guide](../tasks/sequence_classification)
<PipelineTag pipeline="token-classification" />
- A notebook on how to [ fine-tune LayoutLM for token classification on the FUNSD dataset](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Fine_tuning_LayoutLMForTokenClassification_on_FUNSD.ipynb).
- [Token classification task guide](../tasks/token_classification)
**Other resources**
- [Masked language modeling task guide](../tasks/masked_language_modeling)
|
193_4_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#resources
|
.md
|
**Other resources**
- [Masked language modeling task guide](../tasks/masked_language_modeling)
🚀 Deploy
- A blog post on how to [Deploy LayoutLM with Hugging Face Inference Endpoints](https://www.philschmid.de/inference-endpoints-layoutlm).
|
193_4_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmconfig
|
.md
|
This is the configuration class to store the configuration of a [`LayoutLMModel`]. It is used to instantiate a
LayoutLM 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 LayoutLM
[microsoft/layoutlm-base-uncased](https://huggingface.co/microsoft/layoutlm-base-uncased) architecture.
|
193_5_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmconfig
|
.md
|
[microsoft/layoutlm-base-uncased](https://huggingface.co/microsoft/layoutlm-base-uncased) architecture.
Configuration objects inherit from [`BertConfig`] and can be used to control the model outputs. Read the
documentation from [`BertConfig`] for more information.
Args:
vocab_size (`int`, *optional*, defaults to 30522):
Vocabulary size of the LayoutLM model. Defines the different tokens that can be represented by the
*inputs_ids* passed to the forward method of [`LayoutLMModel`].
|
193_5_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmconfig
|
.md
|
*inputs_ids* passed to the forward method of [`LayoutLMModel`].
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):
|
193_5_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmconfig
|
.md
|
intermediate_size (`int`, *optional*, defaults to 3072):
Dimensionality of the "intermediate" (i.e., feed-forward) layer in the Transformer encoder.
hidden_act (`str` or `function`, *optional*, defaults to `"gelu"`):
The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
`"relu"`, `"silu"` and `"gelu_new"` are supported.
hidden_dropout_prob (`float`, *optional*, defaults to 0.1):
|
193_5_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmconfig
|
.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
|
193_5_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmconfig
|
.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 into [`LayoutLMModel`].
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):
|
193_5_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmconfig
|
.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 value used to pad input_ids.
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
|
193_5_6
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmconfig
|
.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).
use_cache (`bool`, *optional*, defaults to `True`):
|
193_5_7
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmconfig
|
.md
|
use_cache (`bool`, *optional*, defaults to `True`):
Whether or not the model should return the last key/values attentions (not used by all models). Only
relevant if `config.is_decoder=True`.
max_2d_position_embeddings (`int`, *optional*, defaults to 1024):
The maximum value that the 2D position embedding might ever used. Typically set this to something large
just in case (e.g., 1024).
Examples:
```python
>>> from transformers import LayoutLMConfig, LayoutLMModel
|
193_5_8
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmconfig
|
.md
|
>>> # Initializing a LayoutLM configuration
>>> configuration = LayoutLMConfig()
>>> # Initializing a model (with random weights) from the configuration
>>> model = LayoutLMModel(configuration)
>>> # Accessing the model configuration
>>> configuration = model.config
```
|
193_5_9
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmtokenizer
|
.md
|
Construct a LayoutLM tokenizer. Based on WordPiece.
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.
Args:
vocab_file (`str`):
File containing the vocabulary.
do_lower_case (`bool`, *optional*, defaults to `True`):
Whether or not to lowercase the input when tokenizing.
do_basic_tokenize (`bool`, *optional*, defaults to `True`):
|
193_6_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmtokenizer
|
.md
|
Whether or not to lowercase the input when tokenizing.
do_basic_tokenize (`bool`, *optional*, defaults to `True`):
Whether or not to do basic tokenization before WordPiece.
never_split (`Iterable`, *optional*):
Collection of tokens which will never be split during tokenization. Only has an effect when
`do_basic_tokenize=True`
unk_token (`str`, *optional*, defaults to `"[UNK]"`):
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.
|
193_6_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmtokenizer
|
.md
|
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.
sep_token (`str`, *optional*, defaults to `"[SEP]"`):
The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for
sequence classification or for a text and a question for question answering. It is also used as the last
token of a sequence built with special tokens.
pad_token (`str`, *optional*, defaults to `"[PAD]"`):
|
193_6_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmtokenizer
|
.md
|
token of a sequence built with special tokens.
pad_token (`str`, *optional*, defaults to `"[PAD]"`):
The token used for padding, for example when batching sequences of different lengths.
cls_token (`str`, *optional*, defaults to `"[CLS]"`):
The classifier token which is used when doing sequence classification (classification of the whole sequence
instead of per-token classification). It is the first token of the sequence when built with special tokens.
|
193_6_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmtokenizer
|
.md
|
instead of per-token classification). It is the first token of the sequence when built with special tokens.
mask_token (`str`, *optional*, defaults to `"[MASK]"`):
The token used for masking values. This is the token used when training this model with masked language
modeling. This is the token which the model will try to predict.
tokenize_chinese_chars (`bool`, *optional*, defaults to `True`):
Whether or not to tokenize Chinese characters.
This should likely be deactivated for Japanese (see this
|
193_6_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmtokenizer
|
.md
|
Whether or not to tokenize Chinese characters.
This should likely be deactivated for Japanese (see this
[issue](https://github.com/huggingface/transformers/issues/328)).
strip_accents (`bool`, *optional*):
Whether or not to strip all accents. If this option is not specified, then it will be determined by the
value for `lowercase` (as in the original LayoutLM).
clean_up_tokenization_spaces (`bool`, *optional*, defaults to `True`):
|
193_6_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmtokenizer
|
.md
|
value for `lowercase` (as in the original LayoutLM).
clean_up_tokenization_spaces (`bool`, *optional*, defaults to `True`):
Whether or not to cleanup spaces after decoding, cleanup consists in removing potential artifacts like
extra spaces.
|
193_6_6
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmtokenizerfast
|
.md
|
Construct a "fast" LayoutLM tokenizer (backed by HuggingFace's *tokenizers* library). Based on WordPiece.
This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.
Args:
vocab_file (`str`):
File containing the vocabulary.
do_lower_case (`bool`, *optional*, defaults to `True`):
Whether or not to lowercase the input when tokenizing.
|
193_7_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmtokenizerfast
|
.md
|
do_lower_case (`bool`, *optional*, defaults to `True`):
Whether or not to lowercase the input when tokenizing.
unk_token (`str`, *optional*, defaults to `"[UNK]"`):
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.
sep_token (`str`, *optional*, defaults to `"[SEP]"`):
The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for
|
193_7_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmtokenizerfast
|
.md
|
The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for
sequence classification or for a text and a question for question answering. It is also used as the last
token of a sequence built with special tokens.
pad_token (`str`, *optional*, defaults to `"[PAD]"`):
The token used for padding, for example when batching sequences of different lengths.
cls_token (`str`, *optional*, defaults to `"[CLS]"`):
|
193_7_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmtokenizerfast
|
.md
|
cls_token (`str`, *optional*, defaults to `"[CLS]"`):
The classifier token which is used when doing sequence classification (classification of the whole sequence
instead of per-token classification). It is the first token of the sequence when built with special tokens.
mask_token (`str`, *optional*, defaults to `"[MASK]"`):
The token used for masking values. This is the token used when training this model with masked language
modeling. This is the token which the model will try to predict.
|
193_7_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmtokenizerfast
|
.md
|
modeling. This is the token which the model will try to predict.
clean_text (`bool`, *optional*, defaults to `True`):
Whether or not to clean the text before tokenization by removing any control characters and replacing all
whitespaces by the classic one.
tokenize_chinese_chars (`bool`, *optional*, defaults to `True`):
Whether or not to tokenize Chinese characters. This should likely be deactivated for Japanese (see [this
issue](https://github.com/huggingface/transformers/issues/328)).
|
193_7_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmtokenizerfast
|
.md
|
issue](https://github.com/huggingface/transformers/issues/328)).
strip_accents (`bool`, *optional*):
Whether or not to strip all accents. If this option is not specified, then it will be determined by the
value for `lowercase` (as in the original LayoutLM).
wordpieces_prefix (`str`, *optional*, defaults to `"##"`):
The prefix for subwords.
<frameworkcontent>
<pt>
|
193_7_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmmodel
|
.md
|
The bare LayoutLM Model transformer outputting raw hidden-states without any specific head on top.
The LayoutLM model was proposed in [LayoutLM: Pre-training of Text and Layout for Document Image
Understanding](https://arxiv.org/abs/1912.13318) by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
Ming Zhou.
This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) sub-class. Use
|
193_8_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmmodel
|
.md
|
Ming Zhou.
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 ([`LayoutLMConfig`]): 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
|
193_8_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmmodel
|
.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.
|
193_8_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmformaskedlm
|
.md
|
LayoutLM Model with a `language modeling` head on top.
The LayoutLM model was proposed in [LayoutLM: Pre-training of Text and Layout for Document Image
Understanding](https://arxiv.org/abs/1912.13318) by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
Ming Zhou.
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
|
193_9_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmformaskedlm
|
.md
|
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.
Parameters:
config ([`LayoutLMConfig`]): 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.
|
193_9_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmforsequenceclassification
|
.md
|
LayoutLM Model with a sequence classification head on top (a linear layer on top of the pooled output) e.g. for
document image classification tasks such as the [RVL-CDIP](https://www.cs.cmu.edu/~aharley/rvl-cdip/) dataset.
The LayoutLM model was proposed in [LayoutLM: Pre-training of Text and Layout for Document Image
Understanding](https://arxiv.org/abs/1912.13318) by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
Ming Zhou.
|
193_10_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmforsequenceclassification
|
.md
|
Understanding](https://arxiv.org/abs/1912.13318) by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
Ming Zhou.
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 ([`LayoutLMConfig`]): Model configuration class with all the parameters of the model.
|
193_10_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmforsequenceclassification
|
.md
|
behavior.
Parameters:
config ([`LayoutLMConfig`]): 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.
|
193_10_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmfortokenclassification
|
.md
|
LayoutLM Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g. for
sequence labeling (information extraction) tasks such as the [FUNSD](https://guillaumejaume.github.io/FUNSD/)
dataset and the [SROIE](https://rrc.cvc.uab.es/?ch=13) dataset.
The LayoutLM model was proposed in [LayoutLM: Pre-training of Text and Layout for Document Image
Understanding](https://arxiv.org/abs/1912.13318) by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
|
193_11_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmfortokenclassification
|
.md
|
Understanding](https://arxiv.org/abs/1912.13318) by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
Ming Zhou.
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 ([`LayoutLMConfig`]): Model configuration class with all the parameters of the model.
|
193_11_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmfortokenclassification
|
.md
|
behavior.
Parameters:
config ([`LayoutLMConfig`]): 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.
|
193_11_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmforquestionanswering
|
.md
|
LayoutLM Model with a span classification head on top for extractive question-answering tasks such as
[DocVQA](https://rrc.cvc.uab.es/?ch=17) (a linear layer on top of the final hidden-states output to compute `span
start logits` and `span end logits`).
The LayoutLM model was proposed in [LayoutLM: Pre-training of Text and Layout for Document Image
Understanding](https://arxiv.org/abs/1912.13318) by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
Ming Zhou.
|
193_12_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmforquestionanswering
|
.md
|
Understanding](https://arxiv.org/abs/1912.13318) by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and
Ming Zhou.
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 ([`LayoutLMConfig`]): Model configuration class with all the parameters of the model.
|
193_12_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#layoutlmforquestionanswering
|
.md
|
behavior.
Parameters:
config ([`LayoutLMConfig`]): 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.
</pt>
<tf>
|
193_12_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#tflayoutlmmodel
|
.md
|
No docstring available for TFLayoutLMModel
|
193_13_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#tflayoutlmformaskedlm
|
.md
|
No docstring available for TFLayoutLMForMaskedLM
|
193_14_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#tflayoutlmforsequenceclassification
|
.md
|
No docstring available for TFLayoutLMForSequenceClassification
|
193_15_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#tflayoutlmfortokenclassification
|
.md
|
No docstring available for TFLayoutLMForTokenClassification
|
193_16_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/layoutlm.md
|
https://huggingface.co/docs/transformers/en/model_doc/layoutlm/#tflayoutlmforquestionanswering
|
.md
|
No docstring available for TFLayoutLMForQuestionAnswering
</tf>
</frameworkcontent>
|
193_17_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/
|
.md
|
<!--Copyright 2022 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
194_0_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/
|
.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.
-->
|
194_0_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#overview
|
.md
|
The Table Transformer model was proposed in [PubTables-1M: Towards comprehensive table extraction from unstructured documents](https://arxiv.org/abs/2110.00061) by
Brandon Smock, Rohith Pesala, Robin Abraham. The authors introduce a new dataset, PubTables-1M, to benchmark progress in table extraction from unstructured documents,
|
194_1_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#overview
|
.md
|
as well as table structure recognition and functional analysis. The authors train 2 [DETR](detr) models, one for table detection and one for table structure recognition, dubbed Table Transformers.
The abstract from the paper is the following:
*Recently, significant progress has been made applying machine learning to the problem of table structure inference and extraction from unstructured documents.
|
194_1_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#overview
|
.md
|
However, one of the greatest challenges remains the creation of datasets with complete, unambiguous ground truth at scale. To address this, we develop a new, more
comprehensive dataset for table extraction, called PubTables-1M. PubTables-1M contains nearly one million tables from scientific articles, supports multiple input
modalities, and contains detailed header and location information for table structures, making it useful for a wide variety of modeling approaches. It also addresses a significant
|
194_1_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#overview
|
.md
|
source of ground truth inconsistency observed in prior datasets called oversegmentation, using a novel canonicalization procedure. We demonstrate that these improvements lead to a
significant increase in training performance and a more reliable estimate of model performance at evaluation for table structure recognition. Further, we show that transformer-based
|
194_1_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#overview
|
.md
|
object detection models trained on PubTables-1M produce excellent results for all three tasks of detection, structure recognition, and functional analysis without the need for any
special customization for these tasks.*
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/table_transformer_architecture.jpeg"
alt="drawing" width="600"/>
|
194_1_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#overview
|
.md
|
alt="drawing" width="600"/>
<small> Table detection and table structure recognition clarified. Taken from the <a href="https://arxiv.org/abs/2110.00061">original paper</a>. </small>
The authors released 2 models, one for [table detection](https://huggingface.co/microsoft/table-transformer-detection) in
documents, one for [table structure recognition](https://huggingface.co/microsoft/table-transformer-structure-recognition)
(the task of recognizing the individual rows, columns etc. in a table).
|
194_1_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#overview
|
.md
|
(the task of recognizing the individual rows, columns etc. in a table).
This model was contributed by [nielsr](https://huggingface.co/nielsr). The original code can be
found [here](https://github.com/microsoft/table-transformer).
|
194_1_6
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#resources
|
.md
|
<PipelineTag pipeline="object-detection"/>
- A demo notebook for the Table Transformer can be found [here](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/Table%20Transformer).
- It turns out padding of images is quite important for detection. An interesting Github thread with replies from the authors can be found [here](https://github.com/microsoft/table-transformer/issues/68).
|
194_2_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#tabletransformerconfig
|
.md
|
This is the configuration class to store the configuration of a [`TableTransformerModel`]. It is used to
instantiate a Table Transformer 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 Table Transformer
[microsoft/table-transformer-detection](https://huggingface.co/microsoft/table-transformer-detection) architecture.
|
194_3_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#tabletransformerconfig
|
.md
|
[microsoft/table-transformer-detection](https://huggingface.co/microsoft/table-transformer-detection) architecture.
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
documentation from [`PretrainedConfig`] for more information.
Args:
use_timm_backbone (`bool`, *optional*, defaults to `True`):
Whether or not to use the `timm` library for the backbone. If set to `False`, will use the [`AutoBackbone`]
API.
|
194_3_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#tabletransformerconfig
|
.md
|
Whether or not to use the `timm` library for the backbone. If set to `False`, will use the [`AutoBackbone`]
API.
backbone_config (`PretrainedConfig` or `dict`, *optional*):
The configuration of the backbone model. Only used in case `use_timm_backbone` is set to `False` in which
case it will default to `ResNetConfig()`.
num_channels (`int`, *optional*, defaults to 3):
The number of input channels.
num_queries (`int`, *optional*, defaults to 100):
|
194_3_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#tabletransformerconfig
|
.md
|
The number of input channels.
num_queries (`int`, *optional*, defaults to 100):
Number of object queries, i.e. detection slots. This is the maximal number of objects
[`TableTransformerModel`] can detect in a single image. For COCO, we recommend 100 queries.
d_model (`int`, *optional*, defaults to 256):
Dimension of the layers.
encoder_layers (`int`, *optional*, defaults to 6):
Number of encoder layers.
decoder_layers (`int`, *optional*, defaults to 6):
Number of decoder layers.
|
194_3_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#tabletransformerconfig
|
.md
|
Number of encoder layers.
decoder_layers (`int`, *optional*, defaults to 6):
Number of decoder layers.
encoder_attention_heads (`int`, *optional*, defaults to 8):
Number of attention heads for each attention layer in the Transformer encoder.
decoder_attention_heads (`int`, *optional*, defaults to 8):
Number of attention heads for each attention layer in the Transformer decoder.
decoder_ffn_dim (`int`, *optional*, defaults to 2048):
|
194_3_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#tabletransformerconfig
|
.md
|
decoder_ffn_dim (`int`, *optional*, defaults to 2048):
Dimension of the "intermediate" (often named feed-forward) layer in decoder.
encoder_ffn_dim (`int`, *optional*, defaults to 2048):
Dimension of the "intermediate" (often named feed-forward) layer in decoder.
activation_function (`str` or `function`, *optional*, defaults to `"relu"`):
The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
`"relu"`, `"silu"` and `"gelu_new"` are supported.
|
194_3_5
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#tabletransformerconfig
|
.md
|
`"relu"`, `"silu"` and `"gelu_new"` are supported.
dropout (`float`, *optional*, defaults to 0.1):
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
attention_dropout (`float`, *optional*, defaults to 0.0):
The dropout ratio for the attention probabilities.
activation_dropout (`float`, *optional*, defaults to 0.0):
The dropout ratio for activations inside the fully connected layer.
init_std (`float`, *optional*, defaults to 0.02):
|
194_3_6
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#tabletransformerconfig
|
.md
|
The dropout ratio for activations inside the fully connected layer.
init_std (`float`, *optional*, defaults to 0.02):
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
init_xavier_std (`float`, *optional*, defaults to 1):
The scaling factor used for the Xavier initialization gain in the HM Attention map module.
encoder_layerdrop (`float`, *optional*, defaults to 0.0):
|
194_3_7
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#tabletransformerconfig
|
.md
|
encoder_layerdrop (`float`, *optional*, defaults to 0.0):
The LayerDrop probability for the encoder. See the [LayerDrop paper](see https://arxiv.org/abs/1909.11556)
for more details.
decoder_layerdrop (`float`, *optional*, defaults to 0.0):
The LayerDrop probability for the decoder. See the [LayerDrop paper](see https://arxiv.org/abs/1909.11556)
for more details.
auxiliary_loss (`bool`, *optional*, defaults to `False`):
Whether auxiliary decoding losses (loss at each decoder layer) are to be used.
|
194_3_8
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#tabletransformerconfig
|
.md
|
Whether auxiliary decoding losses (loss at each decoder layer) are to be used.
position_embedding_type (`str`, *optional*, defaults to `"sine"`):
Type of position embeddings to be used on top of the image features. One of `"sine"` or `"learned"`.
backbone (`str`, *optional*):
Name of backbone to use when `backbone_config` is `None`. If `use_pretrained_backbone` is `True`, this
will load the corresponding pretrained weights from the timm or transformers library. If `use_pretrained_backbone`
|
194_3_9
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#tabletransformerconfig
|
.md
|
will load the corresponding pretrained weights from the timm or transformers library. If `use_pretrained_backbone`
is `False`, this loads the backbone's config and uses that to initialize the backbone with random weights.
use_pretrained_backbone (`bool`, *optional*, `True`):
Whether to use pretrained weights for the backbone.
backbone_kwargs (`dict`, *optional*):
Keyword arguments to be passed to AutoBackbone when loading from a checkpoint
|
194_3_10
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#tabletransformerconfig
|
.md
|
backbone_kwargs (`dict`, *optional*):
Keyword arguments to be passed to AutoBackbone when loading from a checkpoint
e.g. `{'out_indices': (0, 1, 2, 3)}`. Cannot be specified if `backbone_config` is set.
dilation (`bool`, *optional*, defaults to `False`):
Whether to replace stride with dilation in the last convolutional block (DC5). Only supported when
`use_timm_backbone` = `True`.
class_cost (`float`, *optional*, defaults to 1):
Relative weight of the classification error in the Hungarian matching cost.
|
194_3_11
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#tabletransformerconfig
|
.md
|
class_cost (`float`, *optional*, defaults to 1):
Relative weight of the classification error in the Hungarian matching cost.
bbox_cost (`float`, *optional*, defaults to 5):
Relative weight of the L1 error of the bounding box coordinates in the Hungarian matching cost.
giou_cost (`float`, *optional*, defaults to 2):
Relative weight of the generalized IoU loss of the bounding box in the Hungarian matching cost.
mask_loss_coefficient (`float`, *optional*, defaults to 1):
|
194_3_12
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#tabletransformerconfig
|
.md
|
mask_loss_coefficient (`float`, *optional*, defaults to 1):
Relative weight of the Focal loss in the panoptic segmentation loss.
dice_loss_coefficient (`float`, *optional*, defaults to 1):
Relative weight of the DICE/F-1 loss in the panoptic segmentation loss.
bbox_loss_coefficient (`float`, *optional*, defaults to 5):
Relative weight of the L1 bounding box loss in the object detection loss.
giou_loss_coefficient (`float`, *optional*, defaults to 2):
|
194_3_13
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#tabletransformerconfig
|
.md
|
giou_loss_coefficient (`float`, *optional*, defaults to 2):
Relative weight of the generalized IoU loss in the object detection loss.
eos_coefficient (`float`, *optional*, defaults to 0.1):
Relative classification weight of the 'no-object' class in the object detection loss.
Examples:
```python
>>> from transformers import TableTransformerModel, TableTransformerConfig
|
194_3_14
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#tabletransformerconfig
|
.md
|
>>> # Initializing a Table Transformer microsoft/table-transformer-detection style configuration
>>> configuration = TableTransformerConfig()
>>> # Initializing a model from the microsoft/table-transformer-detection style configuration
>>> model = TableTransformerModel(configuration)
>>> # Accessing the model configuration
>>> configuration = model.config
```
|
194_3_15
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#tabletransformermodel
|
.md
|
The bare Table Transformer Model (consisting of a backbone and encoder-decoder Transformer) outputting raw
hidden-states without any specific head on top.
This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
|
194_4_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#tabletransformermodel
|
.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 ([`TableTransformerConfig`]):
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
|
194_4_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#tabletransformermodel
|
.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
|
194_4_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#tabletransformerforobjectdetection
|
.md
|
Table Transformer Model (consisting of a backbone and encoder-decoder Transformer) with object detection heads on
top, for tasks such as COCO detection.
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.
|
194_5_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#tabletransformerforobjectdetection
|
.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 ([`TableTransformerConfig`]):
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
|
194_5_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/table-transformer.md
|
https://huggingface.co/docs/transformers/en/model_doc/table-transformer/#tabletransformerforobjectdetection
|
.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
|
194_5_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/lilt.md
|
https://huggingface.co/docs/transformers/en/model_doc/lilt/
|
.md
|
<!--Copyright 2022 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
195_0_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/lilt.md
|
https://huggingface.co/docs/transformers/en/model_doc/lilt/
|
.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.
-->
|
195_0_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/lilt.md
|
https://huggingface.co/docs/transformers/en/model_doc/lilt/#overview
|
.md
|
The LiLT model was proposed in [LiLT: A Simple yet Effective Language-Independent Layout Transformer for Structured Document Understanding](https://arxiv.org/abs/2202.13669) by Jiapeng Wang, Lianwen Jin, Kai Ding.
LiLT allows to combine any pre-trained RoBERTa text encoder with a lightweight Layout Transformer, to enable [LayoutLM](layoutlm)-like document understanding for many
languages.
The abstract from the paper is the following:
|
195_1_0
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/lilt.md
|
https://huggingface.co/docs/transformers/en/model_doc/lilt/#overview
|
.md
|
*Structured document understanding has attracted considerable attention and made significant progress recently, owing to its crucial role in intelligent document processing. However, most existing related models can only deal with the document data of specific language(s) (typically English) included in the pre-training collection, which is extremely limited. To address this issue, we propose a simple yet effective Language-independent Layout Transformer (LiLT) for structured document understanding. LiLT
|
195_1_1
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/lilt.md
|
https://huggingface.co/docs/transformers/en/model_doc/lilt/#overview
|
.md
|
we propose a simple yet effective Language-independent Layout Transformer (LiLT) for structured document understanding. LiLT can be pre-trained on the structured documents of a single language and then directly fine-tuned on other languages with the corresponding off-the-shelf monolingual/multilingual pre-trained textual models. Experimental results on eight languages have shown that LiLT can achieve competitive or even superior performance on diverse widely-used downstream benchmarks, which enables
|
195_1_2
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/lilt.md
|
https://huggingface.co/docs/transformers/en/model_doc/lilt/#overview
|
.md
|
that LiLT can achieve competitive or even superior performance on diverse widely-used downstream benchmarks, which enables language-independent benefit from the pre-training of document layout structure.*
|
195_1_3
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/lilt.md
|
https://huggingface.co/docs/transformers/en/model_doc/lilt/#overview
|
.md
|
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/lilt_architecture.jpg"
alt="drawing" width="600"/>
<small> LiLT architecture. Taken from the <a href="https://arxiv.org/abs/2202.13669">original paper</a>. </small>
This model was contributed by [nielsr](https://huggingface.co/nielsr).
The original code can be found [here](https://github.com/jpwang/lilt).
|
195_1_4
|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_doc/lilt.md
|
https://huggingface.co/docs/transformers/en/model_doc/lilt/#usage-tips
|
.md
|
- To combine the Language-Independent Layout Transformer with a new RoBERTa checkpoint from the [hub](https://huggingface.co/models?search=roberta), refer to [this guide](https://github.com/jpWang/LiLT#or-generate-your-own-checkpoint-optional).
The script will result in `config.json` and `pytorch_model.bin` files being stored locally. After doing this, one can do the following (assuming you're logged in with your HuggingFace account):
```python
from transformers import LiltModel
|
195_2_0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.