Skip to main content
App version: 3.4.14

Log parameters and model configuration

To store parameters, hyperparameters, configs, or other single values, use the log_configs() function.

To organize and label the metadata in the run structure, define namespaces.

In the below example, the parameters are stored in a namespace called parameters. Inside that namespace, an attribute is created for each parameter.

from neptune_scale import Run


if __name__ == "__main__":
run = Run(experiment_name=...)
run.log_configs(
{
"parameters/learning_rate": 0.001,
"parameters/batch_size": 64,
},
)

Log nested dictionaries

To log nested data, use the flatten parameter to handle the structure:

nested_data = {
"parameters": {
"learning_rate": 0.001,
"batch_size": 64,
},
"metrics": {
"token_count": 76420,
"agg": {
"loss": 0.13,
"acc": 0.97,
}
},
}

if __name__ == "__main__":
run = Run(experiment_name=...)

run.log_configs(data=nested_data, flatten=True)

You'll get a similar nested structure in the resulting Neptune run:

run/
|-- parameters/
|-- learning_rate: 0.001
|-- batch_size: 64
|-- metrics/
|-- token_count: 76420
|-- agg/
|-- loss: 0.13
|-- acc: 0.97

Cast unsupported values

If your dictionary contains data types that Neptune doesn't support, you can enable type casting with the cast_unsupported parameter:

data = {
"metrics": {
"token_count": 76420,
"agg": {
"loss": None,
"acc": None,
}
},
"some_list": [1, "test", None],
}

if __name__ == "__main__":
run = Run(experiment_name=...)

run.log_configs(
data=data,
flatten=True,
cast_unsupported=True,
)

Unsupported values are cast to strings in the Neptune run structure:

run/
|-- metrics/
|-- token_count: 76420
|-- agg/
|-- loss: ""
|-- acc: ""
|-- some_list: '[1, "test", None]'

View configs in the app

You can find your logged configs in the Attributes section of the run.

In dashboards and reports, you can use the single value widget to display a value from one selected run.

To compare configs or other single values for multiple runs at once, use the following: