Skip to main content

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
  • (Optionally) Drift metrics; e.g. a p-value

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gangplank-0.5.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gangplank-0.5.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file gangplank-0.5.0.tar.gz.

File metadata

  • Download URL: gangplank-0.5.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for gangplank-0.5.0.tar.gz
Algorithm Hash digest
SHA256 36f569d869ed16ab5b501dc4fbe2ab02479d72f4dcbcf68ff26508acfd08b7ae
MD5 f3695ac7eb111cf39b4ea2e1bbfd756c
BLAKE2b-256 7abb2d706f6abaa7ed3854c1c34f625c7866a821cccfd4e7164f196517b57933

See more details on using hashes here.

Provenance

The following attestation bundles were made for gangplank-0.5.0.tar.gz:

Publisher: publish-to-pypi.yml on hammingweight/gangplank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gangplank-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: gangplank-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for gangplank-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d855436b48d6fdf515735dc539dc550d3df68909062932d7cd1d2cdf2364a65b
MD5 da13743e5d62d34760c7d1b14b855026
BLAKE2b-256 272c3c565b7e2f0340c2b7ba0d8e5623f3627c98bd5fba8c9fac02709ad252eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for gangplank-0.5.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on hammingweight/gangplank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page