Skip to content

Commit

Permalink
Docs Update (#1432)
Browse files Browse the repository at this point in the history
* modify transforner-rst

* modify roformer tokenizer

* delete modifications

* modify chunk

* delete changes

* init layoutlm model

* modify layoutlmmodel

* test

* fix errors

* add layoutlmformaskedlm

* modify tokenizer

* update

* update

* add layoutlm example

* add example

* update

* update

* delete data

* update

* modify preprocess

* update

* modify loss

* modify example

* find error

* fix errors

* fix errors

* update

* update

* update
  • Loading branch information
huhuiwen99 authored Dec 10, 2021
1 parent e468e19 commit 21e61b5
Show file tree
Hide file tree
Showing 19 changed files with 179 additions and 14 deletions.
7 changes: 7 additions & 0 deletions docs/source/paddlenlp.transformers.chinesebert.modeling.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
modeling
==================================================

.. automodule:: paddlenlp.transformers.chinesebert.modeling
:members:
:no-undoc-members:
:show-inheritance:
14 changes: 14 additions & 0 deletions docs/source/paddlenlp.transformers.chinesebert.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
chinesebert
==========================================

.. automodule:: paddlenlp.transformers.chinesebert
:members:
:no-undoc-members:
:show-inheritance:


.. toctree::
:maxdepth: 4

paddlenlp.transformers.chinesebert.modeling
paddlenlp.transformers.chinesebert.tokenizer
7 changes: 7 additions & 0 deletions docs/source/paddlenlp.transformers.chinesebert.tokenizer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tokenizer
===================================================

.. automodule:: paddlenlp.transformers.chinesebert.tokenizer
:members:
:no-undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/paddlenlp.transformers.layoutlm.modeling.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
modeling
===============================================

.. automodule:: paddlenlp.transformers.layoutlm.modeling
:members:
:no-undoc-members:
:show-inheritance:
14 changes: 14 additions & 0 deletions docs/source/paddlenlp.transformers.layoutlm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
layoutlm
=======================================

.. automodule:: paddlenlp.transformers.layoutlm
:members:
:no-undoc-members:
:show-inheritance:


.. toctree::
:maxdepth: 4

paddlenlp.transformers.layoutlm.modeling
paddlenlp.transformers.layoutlm.tokenizer
7 changes: 7 additions & 0 deletions docs/source/paddlenlp.transformers.layoutlm.tokenizer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tokenizer
================================================

.. automodule:: paddlenlp.transformers.layoutlm.tokenizer
:members:
:no-undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/paddlenlp.transformers.layoutlmv2.modeling.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
modeling
=================================================

.. automodule:: paddlenlp.transformers.layoutlmv2.modeling
:members:
:no-undoc-members:
:show-inheritance:
14 changes: 14 additions & 0 deletions docs/source/paddlenlp.transformers.layoutlmv2.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
layoutlmv2
=========================================

.. automodule:: paddlenlp.transformers.layoutlmv2
:members:
:no-undoc-members:
:show-inheritance:


.. toctree::
:maxdepth: 4

paddlenlp.transformers.layoutlmv2.modeling
paddlenlp.transformers.layoutlmv2.tokenizer
7 changes: 7 additions & 0 deletions docs/source/paddlenlp.transformers.layoutlmv2.tokenizer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tokenizer
==================================================

.. automodule:: paddlenlp.transformers.layoutlmv2.tokenizer
:members:
:no-undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/paddlenlp.transformers.mobilebert.modeling.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
modeling
=================================================

.. automodule:: paddlenlp.transformers.mobilebert.modeling
:members:
:no-undoc-members:
:show-inheritance:
14 changes: 14 additions & 0 deletions docs/source/paddlenlp.transformers.mobilebert.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
mobilebert
=========================================

.. automodule:: paddlenlp.transformers.mobilebert
:members:
:no-undoc-members:
:show-inheritance:


.. toctree::
:maxdepth: 4

paddlenlp.transformers.mobilebert.modeling
paddlenlp.transformers.mobilebert.tokenizer
7 changes: 7 additions & 0 deletions docs/source/paddlenlp.transformers.mobilebert.tokenizer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tokenizer
==================================================

.. automodule:: paddlenlp.transformers.mobilebert.tokenizer
:members:
:no-undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/paddlenlp.transformers.reformer.modeling.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
modeling
===============================================

.. automodule:: paddlenlp.transformers.reformer.modeling
:members:
:no-undoc-members:
:show-inheritance:
14 changes: 14 additions & 0 deletions docs/source/paddlenlp.transformers.reformer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
reformer
=======================================

.. automodule:: paddlenlp.transformers.reformer
:members:
:no-undoc-members:
:show-inheritance:


.. toctree::
:maxdepth: 4

paddlenlp.transformers.reformer.modeling
paddlenlp.transformers.reformer.tokenizer
7 changes: 7 additions & 0 deletions docs/source/paddlenlp.transformers.reformer.tokenizer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tokenizer
================================================

.. automodule:: paddlenlp.transformers.reformer.tokenizer
:members:
:no-undoc-members:
:show-inheritance:
5 changes: 5 additions & 0 deletions docs/source/paddlenlp.transformers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ paddlenlp.transformers
paddlenlp.transformers.bigbird
paddlenlp.transformers.blenderbot
paddlenlp.transformers.blenderbot_small
paddlenlp.transformers.chinesebert
paddlenlp.transformers.convbert
paddlenlp.transformers.ctrl
paddlenlp.transformers.distilbert
Expand All @@ -28,10 +29,14 @@ paddlenlp.transformers
paddlenlp.transformers.ernie_gen
paddlenlp.transformers.ernie_gram
paddlenlp.transformers.gpt
paddlenlp.transformers.layoutlm
paddlenlp.transformers.layoutlmv2
paddlenlp.transformers.layoutxlm
paddlenlp.transformers.mbart
paddlenlp.transformers.mobilebert
paddlenlp.transformers.mpnet
paddlenlp.transformers.nezha
paddlenlp.transformers.reformer
paddlenlp.transformers.roberta
paddlenlp.transformers.roformer
paddlenlp.transformers.skep
Expand Down
5 changes: 5 additions & 0 deletions paddlenlp/transformers/auto/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
("BlenderbotSmall", "blenderbot_small"),
("Blenderbot", "blenderbot"),
("ConvBert", "convbert"),
("MobileBert", "mobilebert"),
("ChineseBert", "chinesebert"),
("CTRL", "ctrl"),
("DistilBert", "distilbert"),
("Electra", "electra"),
Expand All @@ -49,11 +51,14 @@
("Ernie", "ernie"),
("GPT", "gpt"),
("LayoutXLM", "layoutxlm"),
("LayoutLMv2", "layoutlmv2"),
("LayoutLM", "layoutlm"),
("MBart", "mbart"),
("MPNet", "mpnet"),
("NeZha", "nezha"),
("Roberta", "roberta"),
("RoFormer", "roformer"),
("Reformer", "reformer"),
("SqueezeBert", "squeezebert"),
("T5", "t5"),
("TinyBert", "tinybert"),
Expand Down
5 changes: 5 additions & 0 deletions paddlenlp/transformers/auto/tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
("BlenderbotSmallTokenizer", "blenderbot_small"),
("BlenderbotTokenizer", "blenderbot"),
("ConvBertTokenizer", "convbert"),
("MobileBertTokenizer", "mobilebert"),
("ChineseBertTokenizer", "chinesebert"),
("CTRLTokenizer", "ctrl"),
("DistilBertTokenizer", "distilbert"),
("ElectraTokenizer", "electra"),
Expand All @@ -40,11 +42,14 @@
("ErnieTokenizer", "ernie"),
("GPTTokenizer", "gpt"),
("LayoutXLMTokenizer", "layoutxlm"),
("LayoutLMv2Tokenizer", "layoutlmv2"),
("LayoutLMTokenizer", "layoutlm"),
("MBartTokenizer", "mbart"),
("MPNetTokenizer", "mpnet"),
("NeZhaTokenizer", "nezha"),
("RobertaTokenizer", "roberta"),
("RoFormerTokenizer", "roformer"),
("ReformerTokenizer", "reformer"),
("SqueezeBertTokenizer", "squeezebert"),
("T5Tokenizer", 't5'),
("TinyBertTokenizer", "tinybert"),
Expand Down
38 changes: 24 additions & 14 deletions paddlenlp/transformers/layoutlm/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,27 +158,22 @@ class LayoutLMPretrainedModel(PretrainedModel):
"layer_norm_eps": 1e-12,
"pad_token_id": 0,
"type_vocab_size": 2,
"use_cache": True,
},
"layoutlm-large-uncased": {
"attention_probs_dropout_prob": 0.1,
"hidden_act": "gelu",
"hidden_dropout_prob": 0.1,
"vocab_size": 30522,
"hidden_size": 1024,
"initializer_range": 0.02,
"num_attention_heads": 16,
"num_hidden_layers": 24,
"intermediate_size": 4096,
"layer_norm_eps": 1e-12,
"hidden_act": "gelu",
"hidden_dropout_prob": 0.1,
"attention_probs_dropout_prob": 0.1,
"max_2d_position_embeddings": 1024,
"max_position_embeddings": 512,
"num_attention_heads": 16,
"num_hidden_layers": 24,
"initializer_range": 0.02,
"layer_norm_eps": 1e-12,
"pad_token_id": 0,
"type_vocab_size": 2,
"output_attentions": False,
"output_hidden_states": False,
"num_labels": 2,
"use_cache": True,
"vocab_size": 30522
}
}
resource_files_names = {"model_state": "model_state.pdparams"}
Expand Down Expand Up @@ -242,8 +237,23 @@ class LayoutLMModel(LayoutLMPretrainedModel):
The dropout probability for all fully connected layers in the embeddings and encoder.
attention_probs_dropout_prob (float):
The dropout probability for all fully connected layers in the pooler.
type_vocab_size (int, optional):
The vocabulary size of `token_type_ids`.
Defaults to `16`.
initializer_range (float):
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
The standard deviation of the normal initializer.
Defaults to 0.02.
.. note::
A normal_initializer initializes weight matrices as normal distributions.
See :meth:`LayoutLMPretrainedModel.init_weights()` for how weights are initialized in `LayoutLMModel`.
pad_token_id (int, optional):
The index of padding token in the token vocabulary.
Defaults to `0`.
pooled_act (str, optional):
The non-linear activation function in the pooling layer.
Defaults to `"tanh"`.
"""

def __init__(
Expand Down

0 comments on commit 21e61b5

Please sign in to comment.