Trial API¶
Model Definition Interfaces¶
To create a Trial API model definition, we should implement the Trial interface provided by Determined. This interface returns information about the machine learning task the user wants to perform, like the model architecture to use or the validation metrics that should be computed.
Determined provides versions of the Trial interface for each of the application frameworks it supports:
If you hit any issues creating your Trial API model definition, you can visit Training: Debug. It may also be useful for writing your first trial, as it has a framework for incrementally testing each of the features you will need in a successful Trial definition.
Create an Experiment via the CLI¶
A user can submit an experiment via the det experiment create
CLI command:
$ det experiment create <YAML config file> <context directory>
The context directory of Python files that contain the Trial API implementation should include an
accompanying entrypoint
that specifies from where to load a trial class. The entrypoint
specification is expected to take the form:
<module>:<object reference>
<module>
specifies the module containing the trial class within the model definition, relative
to the root. It may be an empty string if the model definition is a Python package and the trial class is exposed in the
top-level __init__.py
file.
<object reference>
specifies the naming of the trial class within the module. It may be a nested
object delimited by dots.
Examples:
:MNistTrial
expects anMNistTrial
class that is exposed in a__init__.py
file at the top level of the context directory.model_def:CIFAR10Trial
expects aCIFAR10Trial
class that is defined in a filemodel_def.py
at the top level of the context directory.determined_lib.trial:trial_classes.NestedTrial
expects aNestedTrial
class that is an attribute oftrial_classes
, wheretrial_classes
is defined in a filedetermined_lib/trial.py
.
Note that this follows the Entry points specification defined in the Python Packaging User Guide with a single difference: the name of
the context directory is prefixed to <module>
, or used as the module if <module>
is empty.
Since project directories might include large artifacts that should not be packaged as part of the
model definition (e.g., data sets or compiled binaries), users can optionally include a
.detignore
file at the top level that specifies file paths to be omitted from the model
definition. The .detignore
file uses the same syntax as .gitignore. Note that byte-compiled Python files (e.g., .pyc
files
or __pycache__
directories) are always ignored.