sleap.nn.config.training_job¶
Serializable configuration classes for specifying all training job parameters.
These configuration classes are intended to specify all the parameters required to run a training job or perform inference from a serialized one.
They are explicitly not intended to implement any of the underlying functionality that they parametrize. This serves two purposes:
- Parameter specification through simple attributes. These can be read/edited by a
human, as well as easily be serialized/deserialized to/from simple dictionaries and JSON.
- Decoupling from the implementation. This makes it easier to design functional
modules with attributes/parameters that contain objects that may not be easily serializable or may implement additional logic that relies on runtime information or other parameters.
In general, classes that implement the actual functionality related to these configuration classes should provide a classmethod for instantiation from the configuration class instances. This makes it easier to implement other logic not related to the high level parameters at creation time.
Conveniently, this format also provides a single location where all user-facing parameters are aggregated and documented for end users (as opposed to developers).
-
class
sleap.nn.config.training_job.
TrainingJobConfig
(data: sleap.nn.config.data.DataConfig = NOTHING, model: sleap.nn.config.model.ModelConfig = NOTHING, optimization: sleap.nn.config.optimization.OptimizationConfig = NOTHING, outputs: sleap.nn.config.outputs.OutputsConfig = NOTHING)[source]¶ Configuration of a training job.
-
data
¶ Configuration options related to the training data.
-
model
¶ Configuration options related to the model architecture.
-
optimization
¶ Configuration options related to the training.
-
outputs
¶ Configuration options related to outputs during training.
-
classmethod
from_json
(json_data: str) → sleap.nn.config.training_job.TrainingJobConfig[source]¶ Create training job configuration from JSON text data.
- Parameters
json_data – JSON-formatted string that specifies the configurations.
- Returns
A TrainingJobConfig instance parsed from the JSON text.
-
classmethod
from_json_dicts
(json_data_dicts: Dict[str, Any]) → sleap.nn.config.training_job.TrainingJobConfig[source]¶ Create training job configuration from dictionaries decoded from JSON.
- Parameters
json_data_dicts – Dictionaries that specify the configurations. These are typically generated by structuring raw JSON formatted text.
- Returns
A TrainingJobConfig instance parsed from the JSON dicts.
-
classmethod
load_json
(filename: str) → sleap.nn.config.training_job.TrainingJobConfig[source]¶ Load a training job configuration from a file.
- Parameters
filename – Path to a training job configuration JSON file or a directory containing “training_job.json”.
- Returns
A TrainingJobConfig instance parsed from the file.
-