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:
Create an Experiment via
A user can submit an experiment from Python by executing the
class MyTrial(...): ... det.experimental.create(trial_def=MyTrial, context_dir=".")
In addition to a trial class definition, the
create() API requires a
context directory (
context_dir). The context directory specifies
the root directory of the code containing the trial implementation –
for a majority of users this is the current working directory (.). The
create() API also accepts two boolean keyword arguments:
local=Falsewill submit the experiment to a Determined cluster.
local=Truewill execute the the training loop in your local Python environment (although currently, local training is not implemented, so you must also set
test=True). Defaults to False.
test=Truewill execute a minimal training loop rather than a full experiment. This can be useful for porting or debugging a model because many common errors will surface quickly. Defaults to False.
Create an Experiment via the CLI¶
A user can submit an experiment via the
det experiment create CLI
$ det experiment create <YAML config file> <context directory>
The context directory of Python files that contain the Trial API
implementation should include an accompanying
specifies from where to load a trial class. The entrypoint specification
is expected to take the form:
<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
<object reference> specifies the naming of the trial class within
the module. It may be a nested object delimited by dots.
MNistTrialclass that is exposed in a
__init__.pyfile at the top level of the model definition.
CIFAR10Trialclass that is defined in a file
model_def.pyat the top level of the model definition.
NestedTrialclass that is an attribute of
trial_classesis defined in a file
Note that this follows the Entry points specification defined in the
Python Packaging User Guide with a
single difference: the directory name of the model definition is
<module>, or used as the module if
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.
.detignore file uses the same syntax as .gitignore. Note that byte-compiled Python
.pyc files or
__pycache__ directories) are always