Skip to main content

A simple logging library for ML projects using Prometheus

Project description

Prometheus Logging

A simple logging library for ML projects using Prometheus.

Installation

pip install prometheus_logging

Usage

from prometheus_logging import init_logging, log_model_loss, start_metrics_server
import threading

# Initialize logging
init_logging(
project="my_project",
config={"batch_size": 32, "learning_rate": 0.001},
notes="Training run",
name="experiment_1",
fake_gpu=True
)

# Start metrics server in a separate thread
threading.Thread(target=start_metrics_server, daemon=True).start()

# In your training loop
for epoch in range(num_epochs):
for batch in dataloader:
# ... training logic ...
loss = model(batch)
log_model_loss(loss.item())

# Make sure Prometheus is configured to scrape metrics from `localhost:8000`.

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

prometheus_logging-0.1.0.tar.gz (3.2 kB view details)

Uploaded Source

File details

Details for the file prometheus_logging-0.1.0.tar.gz.

File metadata

  • Download URL: prometheus_logging-0.1.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for prometheus_logging-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e2850a69bbe113c06fa08ad873e974b31432559a5329b1d6d7c4770ddad11596
MD5 a4f52b8c27a69646694a12b51532caf2
BLAKE2b-256 8a8302f91aacaf951e66a303f9d7cd5f4846face72ac9542feda385665eabca3

See more details on using hashes here.

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