Metadata-Version: 2.4
Name: google-cloud-mldiagnostics
Version: 0.4.0
Summary: diagnostic packages for profiling and ML experiment management
Author-email: Google Diagon++ <hypercompute-diagon@google.com>
License: Apache-2.0
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: google-api-core>=2.0.0
Requires-Dist: google-auth>=2.0.0
Requires-Dist: google-cloud-logging>=2.0.0
Requires-Dist: psutil>=6.0.0
Requires-Dist: packaging>=24.0
Dynamic: license-file

<!--
 Copyright 2025 Google LLC
 
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
      https://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 -->
# google-cloud-mldiagnostics

## Overview

TBD

### Supported Framework

- [jax-ml](https://github.com/jax-ml/jax)
  - any versions
- Other in progress

## How to install

### Install

Install pypi package [link](https://pypi.org/project/google-cloud-mldiagnostics/)

```bash
pip install google-cloud-mldiagnostics
```

This package does not install `jax-ml` and `xprof` and expected they will be
installed separately.

### Imports

Add important into training script

```python
from google_cloud_mldiagnostics import machinelearning_run
from google_cloud_mldiagnostics import metrics
from google_cloud_mldiagnostics import xprof
```

## How to use

### Monitor training

At the begging of training script add next one:

```python
from google_cloud_mldiagnostics import machinelearning_run

machinelearning_run(
  gcs_path="gs://<bucket>",
)
```

### Monitor with ondemand profiling

```python
from google_cloud_mldiagnostics import machinelearning_run

machinelearning_run(
  gcs_path="gs://<bucket>",
  on_demand_xprof=True
)
```

### Monitor with profiling

```python
from google_cloud_mldiagnostics import machinelearning_run
from google_cloud_mldiagnostics import xprof

machinelearning_run(
  gcs_path="gs://<bucket>",
)

xprof=xprof()
xprof.start()
# some code
xprof.stop()
```

### Monitor with customer metrics

```python
from google_cloud_mldiagnostics import machinelearning_run
from google_cloud_mldiagnostics import metrics

machinelearning_run(
  gcs_path="gs://<bucket>",
)

metrics.record("<my-metric>", <value>)
```

To pair metric value with current step:

```python
metrics.record("<my-metric>", <value>, step=1)
```
