Manual Model Upload
Trains is now ClearML
This documentation applies to the legacy Trains versions. For the latest documentation, see ClearML.
The manual_model_upload.py example demonstrates Trains tracking of a manually configured model created with PyTorch, including model checkpoints (snapshots), and output to the console. When the script runs, it creates an experiment named Model configuration and upload
, which is associated with the examples
project.
Configure Trains for model checkpoint (model snapshot) storage in any of the following ways (debug sample storage is different):
- In the configuration file, set default_output_uri.
- In code, when initializing a Task, use the
output_uri
parameter. - In the Trains Web (UI), when modifying an experiment.
Configuration
This example shows two ways to connect a configuration, using the same method, Task.connect_configuration.
Connect a configuration file by providing the file's path. Trains Server stores a copy of the file.
# Connect a local configuration file
config_file = os.path.join('..', '..', 'reporting', 'data_samples', 'sample.json')
config_file = task.connect_configuration(config_file)
Or, create a configuration dictionary and provide the dictionary.
model_config_dict = {
'value': 13.37,
'dict': {'sub_value': 'string', 'sub_integer': 11},
'list_of_ints': [1, 2, 3, 4],
}
model_config_dict = task.connect_configuration(model_config_dict)
If the configuration changes, Trains track it.
model_config_dict['new value'] = 10
model_config_dict['value'] *= model_config_dict['new value']
Artifacts
Model artifacts associated with the experiment appear in the experiment info panel (in the EXPERIMENTS tab), and in the model info panel (in the MODELS tab).
The model info panel contains the model details, including the model design (which is also in the experiment info panel), the class label enumeration, model URL, framework, and snapshot locations.
General model information
Model design
Class label enumeration
Connect a class label enumeration dictionary by calling the Task.connect_label_enumeration method.
# store the label enumeration of the training model
labels = {'background': 0, 'cat': 1, 'dog': 2}
task.connect_label_enumeration(labels)