A minimal PyTorch training loop with checkpointing, resuming, and plotting built in.
Project description
microflame
A minimal PyTorch training loop — checkpointing, resuming, and plotting built in.
Install
pip install microflame
Quickstart
from torch import nn
from torch.optim import Adam
from microflame import Trainer
model = nn.Sequential(nn.Flatten(), nn.Linear(28 * 28, 128), nn.ReLU(), nn.Linear(128, 10))
trainer = Trainer(
train_dataloader=train_loader,
val_dataloader=val_loader,
model=model,
loss_fn=nn.CrossEntropyLoss(),
optimizer=Adam(model.parameters(), lr=1e-3),
)
trainer.fit(num_epochs=10, save_path="checkpoint.pth", save_frequency=5)
trainer.plot()
Resume from a checkpoint:
trainer.resume("checkpoint.pth", num_epochs=20)
Features
- Automatic device selection (CUDA → MPS → CPU)
- Training + validation loop with live
tqdmprogress and per-epoch metrics - Loss/accuracy history tracking
- Checkpoint save/load (model, optimizer, scheduler, history)
- Resume training from a checkpoint
- One-line loss/accuracy plots via matplotlib
License
MIT © Agoth Arop — see 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 Distribution
microflame-0.1.0.tar.gz
(4.0 kB
view details)
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 microflame-0.1.0.tar.gz.
File metadata
- Download URL: microflame-0.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f87bdfa35ad242f1455dbdb677c607dc80bdffb044a5646257052d624715f458
|
|
| MD5 |
df0c2c37ad37ec486587646188369470
|
|
| BLAKE2b-256 |
2ba1e28a5c1571ed33f727693c03d2ad2a2a28d0207fb091b6422f750df3b83d
|
File details
Details for the file microflame-0.1.0-py3-none-any.whl.
File metadata
- Download URL: microflame-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0dad81f53255875dff8737347ddb2f8347303981640b9198c1030758fc0f9a79
|
|
| MD5 |
0d4f5cd5291b40914ef090827808d282
|
|
| BLAKE2b-256 |
3b71a5012bcc0051c23535f70de338f3aa9acc56d628f90f94ea9ce01e4cfde9
|