mirror of
https://github.com/clearml/clearml-docs
synced 2025-06-16 03:19:59 +00:00
Rewrite model config example, fix configuration terminology (#45)
This commit is contained in:
parent
df935fa049
commit
de1f0e559f
@ -4,7 +4,7 @@ title: Configuring Models
|
|||||||
|
|
||||||
The [model_config.py](https://github.com/allegroai/clearml/blob/master/examples/reporting/model_config.py) example demonstrates
|
The [model_config.py](https://github.com/allegroai/clearml/blob/master/examples/reporting/model_config.py) example demonstrates
|
||||||
configuring a model and defining label enumeration. Connect the configuration and label enumeration to a Task and, once
|
configuring a model and defining label enumeration. Connect the configuration and label enumeration to a Task and, once
|
||||||
connected, **ClearML** tracks any changes to them. When **ClearML** stores a model, in any framework, **ClearML** stores
|
connected, **ClearML** tracks any changes to them. When **ClearML** stores a model in any framework, **ClearML** stores
|
||||||
the configuration and label enumeration with it.
|
the configuration and label enumeration with it.
|
||||||
|
|
||||||
When the script runs, it creates an experiment named `Model configuration example`, which is associated with the `examples` project.
|
When the script runs, it creates an experiment named `Model configuration example`, which is associated with the `examples` project.
|
||||||
@ -14,35 +14,41 @@ When the script runs, it creates an experiment named `Model configuration exampl
|
|||||||
### Using a configuration file
|
### Using a configuration file
|
||||||
|
|
||||||
Connect a configuration file to a Task by calling the [Task.connect_configuration](../../references/sdk/task.md#connect_configuration)
|
Connect a configuration file to a Task by calling the [Task.connect_configuration](../../references/sdk/task.md#connect_configuration)
|
||||||
method with the file as an argument.
|
method with the file location and the configuration object's name as arguments. In this example, we connect a JSON file and a YAML file
|
||||||
|
to a Task.
|
||||||
|
|
||||||
# Connect a local configuration file
|
config_file_json = 'data_samples/sample.json'
|
||||||
config_file = os.path.join('data_samples', 'sample.json')
|
task.connect_configuration(name="json file", configuration=config_file_json)
|
||||||
config_file = task.connect_configuration(config_file)
|
...
|
||||||
|
config_file_yaml = 'data_samples/config_yaml.yaml'
|
||||||
|
task.connect_configuration(configuration=config_file_yaml, name="yaml file")
|
||||||
|
|
||||||
**ClearML** reports the configuration in the **ClearML Web UI**, experiment details, **CONFIGURATION** tab, **CONFIGURATION OBJECTS**
|
**ClearML** reports the configurations in the **ClearML Web UI** experiment details **>** **CONFIGURATION** tab **>** **CONFIGURATION OBJECTS**
|
||||||
area. See the image in the next section.
|
section. The contents of the JSON file will appear in the **json file** object, and the contents of the YAML file will appear
|
||||||
|
in the **yaml file** object, as specified in the `name` parameter of the `connect_configuration` method.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
### Configuration dictionary
|
### Configuration dictionary
|
||||||
|
|
||||||
Connect a configuration dictionary to a Task by creating a dictionary, and then calling the [Task.connect_configuration](../../references/sdk/task.md#connect_configuration)
|
Connect a configuration dictionary to a Task by creating a dictionary, and then calling the [Task.connect_configuration](../../references/sdk/task.md#connect_configuration)
|
||||||
method with the dictionary as an argument. After the configuration is connected, **ClearML** tracks changes to it.
|
method with the dictionary and the object name as arguments. After the configuration is connected, **ClearML** tracks changes to it.
|
||||||
|
|
||||||
model_config_dict = {
|
model_config_dict = {
|
||||||
'value': 13.37,
|
'CHANGE ME': 13.37,
|
||||||
'dict': {'sub_value': 'string', 'sub_integer': 11},
|
'dict': {'sub_value': 'string', 'sub_integer': 11},
|
||||||
'list_of_ints': [1, 2, 3, 4],
|
'list_of_ints': [1, 2, 3, 4],
|
||||||
}
|
}
|
||||||
model_config_dict = task.connect_configuration(model_config_dict)
|
model_config_dict = task.connect_configuration(name='dictionary', configuration=model_config_dict)
|
||||||
|
|
||||||
# We now update the dictionary after connecting it, and the changes will be tracked as well.
|
# Update the dictionary after connecting it, and the changes will be tracked as well.
|
||||||
model_config_dict['new value'] = 10
|
model_config_dict['new value'] = 10
|
||||||
model_config_dict['value'] *= model_config_dict['new value']
|
model_config_dict['CHANGE ME'] *= model_config_dict['new value']
|
||||||
|
|
||||||
**ClearML** reports the configuration in the **ClearML Web UI** **>** experiment details **>** **CONFIGURATION** tab **>**
|
**ClearML** reports the configuration in the **ClearML Web UI** **>** experiment details **>** **CONFIGURATION** tab **>**
|
||||||
**CONFIGURATION OBJECTS** area.
|
**CONFIGURATION OBJECTS** area **>** **dictionary** object.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Label enumeration
|
## Label enumeration
|
||||||
|
|
||||||
@ -53,3 +59,10 @@ method with the dictionary as an argument.
|
|||||||
labels = {'background': 0, 'cat': 1, 'dog': 2}
|
labels = {'background': 0, 'cat': 1, 'dog': 2}
|
||||||
task.connect_label_enumeration(labels)
|
task.connect_label_enumeration(labels)
|
||||||
|
|
||||||
|
Log a local model file.
|
||||||
|
|
||||||
|
OutputModel().update_weights('my_best_model.bin')
|
||||||
|
|
||||||
|
The model which is stored contains the model configuration and the label enumeration.
|
||||||
|
|
||||||
|

|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 50 KiB |
BIN
docs/img/examples_reporting_config_2.png
Normal file
BIN
docs/img/examples_reporting_config_2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
BIN
docs/img/examples_reporting_config_3.png
Normal file
BIN
docs/img/examples_reporting_config_3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 51 KiB |
@ -131,13 +131,13 @@ Hyperparameters are grouped by their type and appear in **CONFIGURATION** **>**
|
|||||||
|
|
||||||
#### Command line arguments
|
#### Command line arguments
|
||||||
|
|
||||||
The **Args** section shows automatically logged `argparse` arguments, and all older experiments parameters, except TensorFlow Definitions. Hover over a parameter, and the type, description, and default value appear, if they were provided.
|
The **Args** parameter group shows automatically logged `argparse` arguments, and all older experiments parameters, except TensorFlow Definitions. Hover over a parameter, and the type, description, and default value appear, if they were provided.
|
||||||
|
|
||||||
<details className="cml-expansion-panel screenshot">
|
<details className="cml-expansion-panel screenshot">
|
||||||
<summary className="cml-expansion-panel-summary">View a screenshot</summary>
|
<summary className="cml-expansion-panel-summary">View a screenshot</summary>
|
||||||
<div className="cml-expansion-panel-content">
|
<div className="cml-expansion-panel-content">
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
@ -145,13 +145,13 @@ The **Args** section shows automatically logged `argparse` arguments, and all ol
|
|||||||
|
|
||||||
#### Environment variables
|
#### Environment variables
|
||||||
|
|
||||||
If the `CLEARML_LOG_ENVIRONMENT` variable was set, the **Environment** section will show environment variables (see [this FAQ](../faq#track-env-vars)).
|
If the `CLEARML_LOG_ENVIRONMENT` variable was set, the **Environment** group will show environment variables (see [this FAQ](../faq#track-env-vars)).
|
||||||
|
|
||||||
<details className="cml-expansion-panel screenshot">
|
<details className="cml-expansion-panel screenshot">
|
||||||
<summary className="cml-expansion-panel-summary">View a screenshot</summary>
|
<summary className="cml-expansion-panel-summary">View a screenshot</summary>
|
||||||
<div className="cml-expansion-panel-content">
|
<div className="cml-expansion-panel-content">
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
@ -159,27 +159,27 @@ If the `CLEARML_LOG_ENVIRONMENT` variable was set, the **Environment** section w
|
|||||||
|
|
||||||
#### Custom parameter groups
|
#### Custom parameter groups
|
||||||
|
|
||||||
Custom sections shows parameter dictionaries, if the parameters were connected to the Task, using the `Task.connect` method,
|
Custom parameter groups show parameter dictionaries if the parameters were connected to the Task, using the `Task.connect` method,
|
||||||
with a `name` argument provided.
|
with a `name` argument provided.
|
||||||
|
|
||||||
<details className="cml-expansion-panel screenshot">
|
<details className="cml-expansion-panel screenshot">
|
||||||
<summary className="cml-expansion-panel-summary">View a screenshot</summary>
|
<summary className="cml-expansion-panel-summary">View a screenshot</summary>
|
||||||
<div className="cml-expansion-panel-content">
|
<div className="cml-expansion-panel-content">
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
#### TensorFlow Definitions
|
#### TensorFlow Definitions
|
||||||
|
|
||||||
The **TF_DEFINE** sections shows automatic TensorFlow logging.
|
The **TF_DEFINE** parameter group shows automatic TensorFlow logging.
|
||||||
|
|
||||||
<details className="cml-expansion-panel screenshot">
|
<details className="cml-expansion-panel screenshot">
|
||||||
<summary className="cml-expansion-panel-summary">View a screenshot</summary>
|
<summary className="cml-expansion-panel-summary">View a screenshot</summary>
|
||||||
<div className="cml-expansion-panel-content">
|
<div className="cml-expansion-panel-content">
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
@ -205,7 +205,7 @@ except experiments whose status is *Published* (read-only).
|
|||||||
|
|
||||||
**ClearML** tracks experiment (Task) model configuration objects, which appear in **Configuration Objects** **>** **General**.
|
**ClearML** tracks experiment (Task) model configuration objects, which appear in **Configuration Objects** **>** **General**.
|
||||||
These objects include those that are automatically tracked, and those connected to a Task in code (see [Task.connect_configuration](../references/sdk/task.md#connect_configuration)).
|
These objects include those that are automatically tracked, and those connected to a Task in code (see [Task.connect_configuration](../references/sdk/task.md#connect_configuration)).
|
||||||
**ClearML** supports providing a name for a Task model configuration (see the [name](../references/sdk/task.md#connect_configuration)
|
**ClearML** supports providing a name for a Task model configuration object (see the [name](../references/sdk/task.md#connect_configuration)
|
||||||
parameter in `Task.connect_configuration`.
|
parameter in `Task.connect_configuration`.
|
||||||
|
|
||||||
:::important
|
:::important
|
||||||
|
Loading…
Reference in New Issue
Block a user