From 5f104b41e90d3f2f61b5af493b6ef867f05e3060 Mon Sep 17 00:00:00 2001 From: Siddhant Sadangi Date: Tue, 15 Oct 2024 18:27:14 +0200 Subject: [PATCH 1/2] docs: Marked `step` and `data` as mandatory in `log_metrics` Fixes PRO-206 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8fe446c7..583026f5 100644 --- a/README.md +++ b/README.md @@ -268,9 +268,9 @@ __Parameters__ | Name | Type | Default | Description | |-------------|------------------------------------------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `step` | `Union[float, int]`, optional | `None` | Index of the log entry. Must be increasing. If not specified, the `log_metrics()` call increments the step starting from the highest already logged value. **Tip:** Using float rather than int values can be useful, for example, when logging substeps in a batch. | +| `data` | `Dict[str, Union[float, int]]` | `None` | Dictionary of metrics to log. Each metric value is associated with a step. To log multiple metrics at once, pass multiple key-value pairs. | +| `step` | `Union[float, int]` | `None` | Index of the log entry. Must be increasing.
**Tip:** Using float rather than int values can be useful, for example, when logging substeps in a batch. | | `timestamp` | `datetime`, optional | `None` | Time of logging the metadata. | -| `data` | `Dict[str, Union[float, int]]`, optional | `None` | Dictionary of metrics to log. Each metric value is associated with a step. To log multiple metrics at once, pass multiple key-value pairs. | __Examples__ @@ -281,8 +281,8 @@ from neptune_scale import Run with Run(...) as run: run.log_metrics( - step=1.2, data={"loss": 0.14, "acc": 0.78}, + step=1.2, ) ``` From 3cb54d27aa127168b9bd510e4893d297908f0fab Mon Sep 17 00:00:00 2001 From: Siddhant Sadangi Date: Tue, 15 Oct 2024 18:28:04 +0200 Subject: [PATCH 2/2] Update __init__.py --- src/neptune_scale/__init__.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/neptune_scale/__init__.py b/src/neptune_scale/__init__.py index 2bc91f16..cb827349 100644 --- a/src/neptune_scale/__init__.py +++ b/src/neptune_scale/__init__.py @@ -402,9 +402,9 @@ def _create_run( def log_metrics( self, - step: Optional[Union[float, int]] = None, + data: Dict[str, Union[float, int]], + step: Union[float, int], timestamp: Optional[datetime] = None, - data: Optional[Dict[str, Union[float, int]]] = None, ) -> None: """ Logs the specified metrics to a Neptune run. @@ -419,14 +419,12 @@ def log_metrics( Use namespaces to structure the metadata into meaningful categories. Args: - step: Index of the log entry. Must be increasing. - If not specified, the log_metrics() call increments the step starting from the highest - already logged value. - Tip: Using float rather than int values can be useful, for example, when logging substeps in a batch. - timestamp: Time of logging the metadata. data: Dictionary of metrics to log. Each metric value is associated with a step. To log multiple metrics at once, pass multiple key-value pairs. + step: Index of the log entry. Must be increasing. + Tip: Using float rather than int values can be useful, for example, when logging substeps in a batch. + timestamp (optional): Time of logging the metadata. Examples: @@ -435,8 +433,8 @@ def log_metrics( with Run(...) as run: run.log_metrics( - step=1.2, data={"loss": 0.14, "acc": 0.78}, + step=1.2, ) ``` """