Prometheus metrics collectors for Keras
Project description
Gangplank
Exposing Keras Metrics to Prometheus
Keras is a library for creating artificial neural networks. Prometheus is a monitoring system that pulls metrics from applications and infrastructure. Gangplank is a bridge from Keras to Prometheus that exports Keras training, evaluation and inference metrics to Prometheus.
Keras metrics are exposed in two ways:
- Training and testing metrics use Keras callbacks to push metrics to a Prometheus Pushgateway.
- Inference metrics are exposed by instrumenting a proxy of a Keras model.
The examples demonstrate both techniques to export metrics to Prometheus.
What Metrics are exported?
Training Metrics
During training, the following metrics are exported:
- The number of completed training epochs
- The time spent training
- The number of model weights (both trainable and non-trainable)
- The model's loss
- All metrics configured for the model (e.g. accuracy for a classification model or mean absolute error for a regression model)
- (Optionally) A histogram of the model's trainable weights at the end of the training run
Testing (Evaluation) Metrics
For testing (i.e. evaluation), the following metrics are exported:
- The time spent testing
- The model's loss
- All metrics configured for the model (accuracy, mean absolute error, etc.)
- (Optionally) A histogram of the model's trainable weights
Prediction (Inference) Metrics
A deployed model can expose the following metrics:
- The total number of model predictions
- The time spent doing inference
Installing Gangplank
Gangplank can be installed from PyPI
pip install gangplank
The installation will also install Keras. Keras needs a tensor arithmetic backend like TensorFlow, JAX or PyTorch. You can install a backend at the same time as installing Gangplank by running one of the following
pip install gangplank[tensorflow]
pip install gangplank[jax]
pip install gangplank[torch]
Note: Running, e.g., pip install gangplank[jax] will install a CPU-only version of JAX. If you want, say, CUDA support you should install JAX separately
pip install gangplank
pip install jax[cuda12]
Similar comments apply to TensorFlow and PyTorch.
Examples
Examples of using Gangplank can be found here.
Acknowledgement
The example code uses a model from "Deep Learning with Python, Second Edition" by François Chollet. Gangplank was inspired by the same book's coverage of callbacks and TensorBoard.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gangplank-0.3.3.tar.gz.
File metadata
- Download URL: gangplank-0.3.3.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e8f85064a8bbaea3dd4ecad7078333bb9ba16dee45f15a82512d3ce783833f4
|
|
| MD5 |
ad5e1fef7e5c966033b86957a7c63e49
|
|
| BLAKE2b-256 |
9abd9c43f5e9308da841c345e4b8e0be7312d6d1403f63bd12f3bd7d43dd398d
|
Provenance
The following attestation bundles were made for gangplank-0.3.3.tar.gz:
Publisher:
publish-to-pypi.yml on hammingweight/gangplank
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gangplank-0.3.3.tar.gz -
Subject digest:
4e8f85064a8bbaea3dd4ecad7078333bb9ba16dee45f15a82512d3ce783833f4 - Sigstore transparency entry: 232873002
- Sigstore integration time:
-
Permalink:
hammingweight/gangplank@4cc8b2227c6a99fc0384e92a20b1a074f832ceaa -
Branch / Tag:
refs/tags/0.3.3 - Owner: https://github.com/hammingweight
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@4cc8b2227c6a99fc0384e92a20b1a074f832ceaa -
Trigger Event:
push
-
Statement type:
File details
Details for the file gangplank-0.3.3-py3-none-any.whl.
File metadata
- Download URL: gangplank-0.3.3-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
722b0339a4732aeabe8989798e30abc1c01647cc3585f373ff6b6e5705433a24
|
|
| MD5 |
1070bbc1e873d5353978c3e752ba9f40
|
|
| BLAKE2b-256 |
f24e34775b976619e461ca80321b4f5066c530b0824131ff9c91857f40ead886
|
Provenance
The following attestation bundles were made for gangplank-0.3.3-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on hammingweight/gangplank
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gangplank-0.3.3-py3-none-any.whl -
Subject digest:
722b0339a4732aeabe8989798e30abc1c01647cc3585f373ff6b6e5705433a24 - Sigstore transparency entry: 232873074
- Sigstore integration time:
-
Permalink:
hammingweight/gangplank@4cc8b2227c6a99fc0384e92a20b1a074f832ceaa -
Branch / Tag:
refs/tags/0.3.3 - Owner: https://github.com/hammingweight
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@4cc8b2227c6a99fc0384e92a20b1a074f832ceaa -
Trigger Event:
push
-
Statement type: