metric.py file. If you are working with a dataset.toml, you can run the following command to create a metric.py file and automatically add it to the [[files]] section of your dataset.toml:
metric.py if it’s present in the dataset directory.
Default behavior
By default, Harbor averages rewards across tasks and treats missing rewards as 0.- Single dimension
- Multi-dimensional
- Missing dimensions
Rewards
Aggregate
mean). For multi-dimensional rewards, it aggregates each dimension independently. Missing rewards and missing dimensions count as 0.
Custom metrics with metric.py
A metric.py script must accept the following arguments:
-i, --input-path: rewards JSONL file-o, --output-path: output JSON file with computed metrics
Example
metric.py
Considerations
When implementing a custom metric, be sure to account for- Missing or invalid reward keys
- Invalid reward values
- Null rows in the JSONL input
- Default aggregate reward keys
Publishing custom metrics
When publishing a dataset, Harbor automatically publishes themetric.py file in the same directory:
Output format
metric.py output should be a JSON object. Multiple metric values are allowed:

