Shortcuts

Examples

Example Models

Determined includes several example machine learning models that have been ported to Determined’s APIs. These examples can be found in the examples/ subdirectory of the Determined GitHub repo; download links to each example can also be found below.

Trial API

The examples below use the Trial API. Each example consists of a model definition, along with one or more experiment configuration files. To run one of these examples, download the appropriate .tgz file, extract it, cd into the directory, and use det experiment create to create a new experiment, passing in the appropriate configuration file. For example, here is how to train the mnist_pytorch example with a fixed set of hyperparameters:

tar xzvf mnist_pytorch.tgz
cd mnist_pytorch
det experiment create const.yaml .

For an introduction to using the Trial API, refer to PyTorch MNIST and tf.keras MNIST tutorials.

Framework

Dataset

Filename

PyTorch

MNIST

mnist_pytorch.tgz

PyTorch

CIFAR-10

cifar10_cnn_pytorch.tgz

TensorFlow (Estimator API)

MNIST

mnist_estimator.tgz

TensorFlow (tf.keras)

Fashion MNIST

fashion_mnist_tf_keras.tgz

TensorFlow (tf.keras)

CIFAR-10

cifar10_cnn_tf_keras.tgz

TensorFlow (tf.keras)

Iris

iris_tf_keras.tgz

Tensorpack

MNIST

mnist_tp.tgz

Native API

The examples below use the Native API. These examples create a new experiment via the Python API, so you will not need to specify a separate configuration file or use the det CLI. Here is an example of how to train the native_fashion_mnist_tf_keras model:

tar xzvf native_fashion_mnist_tf_keras.tgz
cd native_fashion_mnist_tf_keras
python native_impl.py

For an introduction to using the Native API, see the Native API Tutorial.

Framework

Dataset

Filename

PyTorch

MNIST

native_mnist_pytorch.tgz

PyTorch

COCO

native_object_detection_pytorch.tgz

TensorFlow (Estimator API)

MNIST

native_mnist_estimator.tgz

TensorFlow (tf.keras)

Fashion MNIST

native_fashion_mnist_tf_keras.tgz

TensorBoard Integration

This example shows how to use Determined with TensorBoard to visualize training and/or validation metrics.

To configure TensorBoard with Determined, follow these steps:

  1. Set up a directory on a shared file system for TensorBoard event files, e.g. /mnt/tensorboard. All agents must be able to write to this directory.

  2. Add an entry to the experiment config to ensure that the shared directory is mounted into each trial container. In this example, we use /tensorboard as the container path:

    bind_mounts:
      - host_path: /mnt/tensorboard
        container_path: /tensorboard
    
  3. Implement the callbacks() interface in your model definition. Use your container_path (/tensorboard in this example) as the log_directory argument.

    from determined.estimator import TFEventWriter
    
    class MNISTTrial(EstimatorTrial):
       ...
       def callbacks(self, hparams):
           return TFEventWriter("/tensorboard")
       ...
    
  4. Start TensorBoard using the host_path from step 2 to view the experiment metrics as the experiment is running or after it has ended.

    tensorboard --logdir=/mnt/tensorboard