Table logger using Rich
Project description
rich-logger
Table logger using Rich, aimed at Pytorch Lightning logging
Features
- display your training logs with pretty rich tables
- describe your fields with
goal("higher_is_better" or "lower_is_better"),formatandname - a field descriptor can be matched with any regex
- a field name can be computed as a regex substitution
- works in Jupyter notebooks as well as in a command line
- integrates easily with Pytorch Lightning
Demo
from rich_logger import RichTablePrinter
import time
import random
from tqdm import trange
logger_fields = {
"step": {},
"(.*)_precision": {
"goal": "higher_is_better",
"format": "{:.4f}",
"name": r"\1_p",
},
"(.*)_recall": {
"goal": "higher_is_better",
"format": "{:.4f}",
"name": r"\1_r",
},
"duration": {"format": "{:.1f}", "name": "dur(s)"},
".*": True, # Any other field must be logged at the end
}
def optimization():
printer = RichTablePrinter(key="step", fields=logger_fields)
printer.hijack_tqdm()
t = time.time()
for i in trange(10):
time.sleep(random.random() / 3)
printer.log(
{
"step": i,
"task_precision": i / 10.0 if i < 5 else 0.5 - (i - 5) / 10.0,
}
)
time.sleep(random.random() / 3)
printer.log(
{
"step": i,
"task_recall": 0.0 if i < 3 else (i - 3) / 10.0,
"duration": time.time() - t,
}
)
printer.log({"test": i})
t = time.time()
for j in trange(5):
time.sleep(random.random() / 10)
printer.finalize()
optimization()
Use it with PytorchLightning
from rich_logger import RichTableLogger
trainer = pl.Trainer(..., logger=[RichTableLogger(key="epoch", fields=logger_fields)])
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 rich_logger-0.3.2.tar.gz.
File metadata
- Download URL: rich_logger-0.3.2.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d8c1c7025dfc21fef6989c11103fb5af12dc2bde9671ddcd2148b255185876d
|
|
| MD5 |
4bcf80211c3191ce503ffd5b4c18b09c
|
|
| BLAKE2b-256 |
5c879f87ce175c3e72df8acb477c71d53728f1db6cb64c4bf0e47265785bdab4
|
Provenance
The following attestation bundles were made for rich_logger-0.3.2.tar.gz:
Publisher:
release.yml on percevalw/rich-logger
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rich_logger-0.3.2.tar.gz -
Subject digest:
7d8c1c7025dfc21fef6989c11103fb5af12dc2bde9671ddcd2148b255185876d - Sigstore transparency entry: 312312821
- Sigstore integration time:
-
Permalink:
percevalw/rich-logger@aba30aeb9b6afedc41dc406c1309ef6a688680d0 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/percevalw
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@aba30aeb9b6afedc41dc406c1309ef6a688680d0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file rich_logger-0.3.2-py3-none-any.whl.
File metadata
- Download URL: rich_logger-0.3.2-py3-none-any.whl
- Upload date:
- Size: 12.5 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 |
68f5882d8aa13d01e494740369e409a0a2b4e54ea033e65c7bcd8b236a1e89b7
|
|
| MD5 |
06496c17df8ae7c59a2d89b805253aea
|
|
| BLAKE2b-256 |
7d35bad957fd994ffa89fbabeef31110717741ff2c4ac450b006632fee0b3dad
|
Provenance
The following attestation bundles were made for rich_logger-0.3.2-py3-none-any.whl:
Publisher:
release.yml on percevalw/rich-logger
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rich_logger-0.3.2-py3-none-any.whl -
Subject digest:
68f5882d8aa13d01e494740369e409a0a2b4e54ea033e65c7bcd8b236a1e89b7 - Sigstore transparency entry: 312312837
- Sigstore integration time:
-
Permalink:
percevalw/rich-logger@aba30aeb9b6afedc41dc406c1309ef6a688680d0 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/percevalw
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@aba30aeb9b6afedc41dc406c1309ef6a688680d0 -
Trigger Event:
release
-
Statement type: