Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
15069a36
Commit
15069a36
authored
Jan 11, 2021
by
Chen Chen
Committed by
A. Unique TensorFlower
Jan 11, 2021
Browse files
Open source text_layers.py
PiperOrigin-RevId: 351309008
parent
9fb74a40
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1133 additions
and
0 deletions
+1133
-0
official/README.md
official/README.md
+13
-0
official/nlp/modeling/layers/README.md
official/nlp/modeling/layers/README.md
+5
-0
official/nlp/modeling/layers/__init__.py
official/nlp/modeling/layers/__init__.py
+3
-0
official/nlp/modeling/layers/text_layers.py
official/nlp/modeling/layers/text_layers.py
+621
-0
official/nlp/modeling/layers/text_layers_test.py
official/nlp/modeling/layers/text_layers_test.py
+491
-0
No files found.
official/README.md
View file @
15069a36
...
...
@@ -105,6 +105,12 @@ pip will install all models and dependencies automatically.
pip
install
tf-models-official
```
If you are using nlp packages, please also install
**tensorflow-text**
:
```
shell
pip
install
tensorflow-text
```
Please check out our
[
example
](
colab/fine_tuning_bert.ipynb
)
to learn how to use a PIP package.
...
...
@@ -143,6 +149,13 @@ os.environ['PYTHONPATH'] += ":/path/to/models"
pip3
install
--user
-r
official/requirements.txt
```
Finally, if you are using nlp packages, please also install
**tensorflow-text-nightly**
:
```
shell
pip3
install
tensorflow-text-nightly
```
## Contributions
If you want to contribute, please review the
[
contribution guidelines
](
https://github.com/tensorflow/models/wiki/How-to-contribute
)
.
...
...
official/nlp/modeling/layers/README.md
View file @
15069a36
...
...
@@ -89,3 +89,8 @@ assemble new layers, networks, or models.
[
MobileBertTransformer
](
mobile_bert_layers.py
)
implement the embedding layer
and also transformer layer proposed in the
[
MobileBERT paper
](
https://arxiv.org/pdf/2004.02984.pdf
)
.
*
[
BertPackInputs
](
text_layers.py
)
and
[
BertTokenizer
](
text_layers.py
)
and
[
SentencepieceTokenizer
](
text_layers.py
)
implements the layer to tokenize raw text and pack them into the inputs for
BERT models.
official/nlp/modeling/layers/__init__.py
View file @
15069a36
...
...
@@ -32,6 +32,9 @@ from official.nlp.modeling.layers.relative_attention import TwoStreamRelativeAtt
from
official.nlp.modeling.layers.rezero_transformer
import
ReZeroTransformer
from
official.nlp.modeling.layers.self_attention_mask
import
SelfAttentionMask
from
official.nlp.modeling.layers.talking_heads_attention
import
TalkingHeadsAttention
from
official.nlp.modeling.layers.text_layers
import
BertPackInputs
from
official.nlp.modeling.layers.text_layers
import
BertTokenizer
from
official.nlp.modeling.layers.text_layers
import
SentencepieceTokenizer
from
official.nlp.modeling.layers.tn_transformer_expand_condense
import
TNTransformerExpandCondense
from
official.nlp.modeling.layers.transformer
import
*
from
official.nlp.modeling.layers.transformer_scaffold
import
TransformerScaffold
...
...
official/nlp/modeling/layers/text_layers.py
0 → 100644
View file @
15069a36
This diff is collapsed.
Click to expand it.
official/nlp/modeling/layers/text_layers_test.py
0 → 100644
View file @
15069a36
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment