Commit 15069a36 authored by Chen Chen's avatar Chen Chen Committed by A. Unique TensorFlower
Browse files

Open source text_layers.py

PiperOrigin-RevId: 351309008
parent 9fb74a40
......@@ -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).
......
......@@ -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.
......@@ -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
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment