A powerful and elegant logging library designed specifically for neural network and machine learning experiments. nnlogging seamlessly integrates [Rich](https://github.com/Textualize/rich) for beautiful terminal output and [Aim](https://github.com/aimhubio/aim) for comprehensive experiment tracking.
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
nnlogging
nnlogging is a powerful, modern logging library for neural network and machine learning experiments, combining Rich for beautiful terminal output with Aim for comprehensive experiment tracking.
✨ Features
- 🎨 Beautiful Console Output - Rich-powered colorful logging with integrated progress bars.
- 📊 Effortless Experiment Tracking - Seamless Aim integration for metrics, parameters, and system monitoring.
- 🔧 Simplified API - Get started in one line of code with the global functions.
- 📈 Advanced Progress Tracking - Manage multiple progress bars for training, validation, and other tasks.
- 🎯 ML-Focused Design - Purpose-built for the machine learning workflow.
- 🐍 Modern Python - Fully typed, Python 3.10+ codebase.
🚀 Installation
pip install nnlogging
Requirements: Python 3.10-3.12
⚡ Quick Start
The new nnlogging API is designed for simplicity. You can get a
pre-configured, global logger instance and start logging right away.
Basic Logging
Get the global shell or customize your shell from scratch to use logging methods and trackings.
import nnlogging
# Log messages!
nnlogging.info("Starting training...")
nnlogging.warn("Learning rate seems high.")
nnlogging.debug("This is a detailed debug message.")
nnlogging.error("CUDA out of memory.", extra={"show_locals": True})
Experiment Tracking with Aim
Configure the Aim run to track metrics, hyperparameters, and more.
import random
import nnlogging
# 1. Configure the experiment tracker
nnlogging.run_configure(
experiment="resnet_training",
log_system_params=True, # Track CPU/GPU usage
capture_terminal_logs=True # Save console output in Aim
)
# 2. Log hyperparameters
config = {"lr": 0.001, "batch_size": 32, "model": "ResNet50"}
nnlogging.update_metadata("hparams", config)
nnlogging.info(f"Using config: {config}")
# 3. Track metrics in your training loop
for epoch in range(10):
train_loss = 1.0 / (epoch + 1) + random.random() * 0.1
nnlogging.track(train_loss, name="train_loss", epoch=epoch)
nnlogging.info(f"Epoch {epoch}: Loss={train_loss:.4f}")
nnlogging.info("Experiment finished!")
To view the results, run aim up in your terminal.
Progress Tracking
Add tasks to the logger to display and update rich progress bars.
import time
import nnlogging
# 1. Add a task to the progress display
nnlogging.task_add("training", desc="Training", total=500)
# 2. Update the task during your training loop
for step in range(500):
# training_step()
time.sleep(0.01)
nnlogging.advance("training", 1)
if step % 100 == 0:
nnlogging.info(f"Completed step {step}")
# 3. Remove the task when finished
nnlogging.task_remove("training")
nnlogging.info("Training complete!")
🔄 Workflow
- Import
nnlogging- Import thennlogginglibrary at the start of your script. run_configure()- (Optional) Configure Aim for experiment tracking.- Log & Track - Use
nnlogging.info(),nnlogging.track(), andnnlogging.advance()throughout your code. - Visualize - Run
aim upto launch the Aim UI and analyze your results.
🤝 Contributing
Contributions are welcome! Please feel free to open an issue or submit a pull request.
📄 License
This project is licensed under the MIT License.
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 Distributions
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 nnlogging-0.1.4-py3-none-any.whl.
File metadata
- Download URL: nnlogging-0.1.4-py3-none-any.whl
- Upload date:
- Size: 19.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e7cebddbb279b17e69c1afe7f4972f7c2fb5f9601c8eb4bf5b5c571a21bca22
|
|
| MD5 |
9661b0eff3daced043a40b8df06f24b2
|
|
| BLAKE2b-256 |
10e7def8cc3bbc16ac279a93eed188a8f318131ac4f4632ad4dcb86ddde06d5b
|