The TensorFlow text processing tutorials provide step-by-step instructions for solving common text and natural language processing (NLP) problems.
TensorFlow provides two solutions for text and natural language processing: KerasNLP and TensorFlow Text. KerasNLP is a high-level NLP library that includes all the latest Transformer-based models as well as lower-level tokenization utilities. It's the recommended solution for most NLP use cases.
If you need access to lower-level text processing tools, you can use TensorFlow Text. TensorFlow Text provides a collection of ops and libraries to help you work with input in text form such as raw text strings or documents.
KerasNLP
- Getting Started with KerasNLP: Learn KerasNLP by performing sentiment analysis at progressive levels of complexity, from using a pre-trained model to building your own Transformer from scratch.
Text generation
- Text generation with an RNN: Generate text using a character-based RNN and a dataset of Shakespeare's writing.
- Neural machine translation with attention: Train a sequence-to-sequence (seq2seq) model for Spanish-to-English translation.
- Neural machine translation with a Transformer and Keras: Create and train a sequence-to-sequence Transformer model to translate Portuguese into English.
- Image captioning with visual attention: Generate image captions using a Transformer-decoder model built with attention layers.
Text classification
- Classify text with BERT: Fine-tune BERT to perform sentiment analysis on a dataset of plain-text IMDb movie reviews.
- Text classification with an RNN: Train an RNN to perform sentiment analysis on IMDb movie reviews.
- TF.Text Metrics: Learn about the metrics available through TensorFlow Text. The library contains implementations of text-similarity metrics such as ROUGE-L, which can be used for automatic evaluation of text generation models.
NLP with BERT
- Solve GLUE tasks using BERT on TPU: Learn how to fine-tune BERT for tasks from the GLUE benchmark.
- Fine-tuning a BERT model: Fine-tune a BERT model using TensorFlow Model Garden.
- Uncertainty-aware Deep Language Learning with BERT-SNGP: Apply SNGP to a natural language understanding (NLU) task. Building on a BERT encoder, you'll improve the NLU model's ability to detect out-of-scope queries.
Embeddings
- Word embeddings: Train your own word embeddings using a simple Keras model for a sentiment classification task, and then visualize them using the Embedding Projector.
- Warm-start embedding layer matrix: Learn how to "warm-start" training for a text sentiment classification model.
- word2vec: Train a word2vec model on a small dataset and visualize the trained embeddings in the Embedding Projector.