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 |
|
PyTorch |
CIFAR-10 |
|
TensorFlow (Estimator API) |
MNIST |
|
TensorFlow (tf.keras) |
Fashion MNIST |
|
TensorFlow (tf.keras) |
CIFAR-10 |
|
TensorFlow (tf.keras) |
Iris |
|
Tensorpack |
MNIST |
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 |
|
PyTorch |
COCO |
|
TensorFlow (Estimator API) |
MNIST |
|
TensorFlow (tf.keras) |
Fashion MNIST |
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:
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.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
Implement the
callbacks()
interface in your model definition. Use yourcontainer_path
(/tensorboard
in this example) as thelog_directory
argument.from determined.estimator import TFEventWriter class MNISTTrial(EstimatorTrial): ... def callbacks(self, hparams): return TFEventWriter("/tensorboard") ...
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