Skip to main content

A minimal PyTorch training loop with checkpointing, resuming, and plotting built in.

Project description

microflame

PyPI Python License: MIT

A minimal PyTorch training loop wrapper for reducing boilerplate.

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 tqdm progress 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


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.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

microflame-0.1.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file microflame-0.1.1.tar.gz.

File metadata

  • Download URL: microflame-0.1.1.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

Hashes for microflame-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2160d5b5eeda3af4211d2a28e02835fbbc05625a54e8545d9bbdc7c160138c9e
MD5 ab6fac9d8720de317d0f5aa571670f94
BLAKE2b-256 ab0494d014bdd79390e383c1a7998ed8e505907674cbc1fb51fabc9340bccc0d

See more details on using hashes here.

File details

Details for the file microflame-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: microflame-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for microflame-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 10efc5d9e465e2e1220857ad0b5e30e29e0fd793c29d33ab53e7a97af3f7dac4
MD5 47b204f9a58cbceed715d2ea08e95ccb
BLAKE2b-256 1890592ca23c10a26a95181da03a72d6aad26b09742c30fcd7f69f89659f66fe

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