TensorFlow Official Models (nightly)
raw JSON → 2.21.0.dev20260217 verified Mon Apr 27 auth: no python
Nightly builds of TensorFlow Official Models, a collection of state-of-the-art models implemented in TensorFlow. Current version 2.21.0.dev20260217, targeting TF 2.21 nightly. Released daily. Note that research/tutorial/sample models have been removed in recent versions.
pip install tf-models-nightly Common errors
error ImportError: cannot import name 'ResNet' from 'official.models' ↓
cause The 'official.models' module was removed; models are now in subpackages like 'official.vision'.
fix
Use 'from official.vision.modeling import ResNet' instead.
error ModuleNotFoundError: No module named 'tensorflow_text' ↓
cause tf-models-nightly does not install tensorflow-text as a dependency; needed for NLP models.
fix
Install tensorflow-text: 'pip install tensorflow-text' (ensure version matches TensorFlow).
error AttributeError: module 'official' has no attribute 'research' ↓
cause Research models were removed in v2.16.0+.
fix
Use a version before v2.16.0 or find alternative implementations.
Warnings
breaking Research/tutorial/sample models have been removed from the repository starting from v2.16.0. Code relying on 'official.research' or 'official.tutorials' will break. ↓
fix Migrate to community-maintained forks or use legacy versions (v2.15.x or earlier).
gotcha The package 'tf-models-nightly' does not install 'tensorflow-text' automatically, but several NLP models require it. If you get an ImportError for TensorFlow Text, install a compatible version separately. ↓
fix Run 'pip install tf-models-nightly-text' or install 'tensorflow-text' manually matching your TensorFlow version.
deprecated The old import 'from official.modeling import ...' is deprecated in favor of subpackage imports like 'from official.vision.modeling import ...'. Old imports may break in future releases. ↓
fix Update imports to use subpackages (e.g., official.vision, official.nlp).
Imports
- OfficialModel wrong
from official.models import ...correctfrom official import vision
Quickstart
import tensorflow as tf
from official import vision
# Example: build a ResNet-50 model
try:
model = vision.modeling.ResNet50()
print(model.name)
except Exception as e:
print(f"Error: {e}")