Skip to main content

TensorFlow Template

The TensorFlow template scaffolds a production-ready ML project with TensorFlow, Keras, and common ML dependencies. Two variants are available:
  • tensorflow: basic inference template for deployment
  • tensorflow-train: full training pipeline with ModelCheckpoint and EarlyStopping callbacks

Quick Start

The model type (classification, regression, etc.) is selected interactively during cirron init.

Project Structure

For shared files (Dockerfile, .gitignore, README.md, .env.example, tests), see Common files.

Cirron-specific bits

cirron.yaml

Profiling hooks

The generated train.py and inference.py integrate with the Cirron SDK. Call ci.profile() once before training begins; the Keras callback auto-registers and tracks model.fit:

requirements.txt

Model Types

  • Classification: sparse_categorical_crossentropy loss, softmax output, accuracy metric. Default architecture is a small CNN.
  • Regression: mse loss, linear output, MAE metric. Default architecture is a Keras Sequential MLP.
The interactive cirron init prompt selects which one is generated into src/model.py via create_model().

Built-in Callbacks

The generated train.py wires standard Keras callbacks:
  • ModelCheckpoint: saves best model by validation loss to checkpoints/best_model.h5
  • EarlyStopping: stops training when val loss stops improving (patience=5)
Add more callbacks (e.g. ReduceLROnPlateau) in get_callbacks().

Usage

GPU Support

TensorFlow automatically detects available GPUs. The tensorflow-train variant supports mixed-precision training:

Next Steps

PyTorch Template

Alternative deep learning framework

scikit-learn Template

Traditional ML algorithms

Common files

Dockerfile, tests, and shared scaffolding

Deployment

Deploy your trained model