whatisgithub

What is tensor2tensor?

tensorflow/tensor2tensor — explained in plain English

Analysis updated 2026-06-24

17,252PythonAudience · researcherComplexity · 3/5Setup · moderate

In one sentence

Tensor2Tensor is a library of pre-built deep learning models and datasets for research tasks like translation, image generation, and speech recognition, now deprecated in favour of the successor library Trax.

Mindmap

mindmap
  root((tensor2tensor))
    What it does
      Deep learning library
      Pre-built models
      Research benchmarks
    Tech Stack
      Python
      TensorFlow
      t2t-trainer CLI
    Use Cases
      Translation research
      Image classification
      Language modeling
    Status
      Deprecated
      Migrate to Trax
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Run a Transformer model on a standard machine translation benchmark without writing model code from scratch

USE CASE 2

Train an image classifier on ImageNet or CIFAR-10 using a pre-built ResNet or Xception problem definition

USE CASE 3

Experiment with hyperparameter sets on language modeling benchmarks to compare model architectures

USE CASE 4

Reproduce published deep learning results using the included problem, model, and hyperparameter configurations

What is it built with?

PythonTensorFlow

How does it compare?

tensorflow/tensor2tensormustardchef/wsabuildstopoteretes/cognee
Stars17,25217,27717,214
LanguagePythonPythonPython
Setup difficultymoderatemoderatemoderate
Complexity3/52/53/5
Audienceresearchergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Now deprecated, new projects should use the successor library Trax, T2T still accepts bug fixes.

So what is it?

Tensor2Tensor, often shortened to T2T, is a library of pre-built deep learning models and datasets that aims to make deep learning more accessible and to speed up machine learning research. Deep learning is a branch of machine learning that uses neural networks with many layers, and T2T packages up the building blocks so researchers do not have to start from scratch for each new experiment. Inside the library, a "problem" describes a dataset and the task you want to do with it, and a "model" describes the neural network shape. T2T comes with ready-made problems for image classification using datasets like ImageNet, CIFAR-10, CIFAR-100 and MNIST, image generation using CelebA, LSUN Bedrooms and MS-COCO, language modeling using PTB and the billion-word LM1B corpus, speech recognition using Librispeech and Mozilla Common Voice, sentiment analysis using IMDB, question answering using bAbi, and machine translation. It includes several flavours of the Transformer model, plus alternatives like ResNet, Xception and Shake-Shake. You pick a problem, pick a model, pick a set of hyperparameters, and a single command-line trainer called t2t-trainer runs the experiment. Someone would actually use this if they were doing machine learning research and wanted a head start on standard benchmarks, or if they wanted to learn how transformer-style models behave on a particular dataset. The maintainers note that T2T was created by the Google Brain team and is now deprecated, bug fixes are still accepted, but users are encouraged to move to the successor library called Trax. The full README is longer than what was provided.

Copy-paste prompts

Prompt 1
Using Tensor2Tensor, set up the WMT English-to-German translation problem and train a base Transformer model with the t2t-trainer command.
Prompt 2
Help me configure a Tensor2Tensor experiment to train a ResNet-50 on CIFAR-10 and log metrics to TensorBoard.
Prompt 3
Using Tensor2Tensor's hyperparameter sets, run a learning rate sweep for the Transformer on the LM1B language modeling benchmark.
Prompt 4
Show me how to add a custom problem to Tensor2Tensor so I can train a Transformer on my own parallel sentence pairs.
Prompt 5
Using Tensor2Tensor, compare the Transformer and LSTM architectures on the IMDB sentiment benchmark and report validation accuracy.

Frequently asked questions

What is tensor2tensor?

Tensor2Tensor is a library of pre-built deep learning models and datasets for research tasks like translation, image generation, and speech recognition, now deprecated in favour of the successor library Trax.

What language is tensor2tensor written in?

Mainly Python. The stack also includes Python, TensorFlow.

How hard is tensor2tensor to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is tensor2tensor for?

Mainly researcher.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.