Metadata-Version: 2.4
Name: microflame
Version: 0.1.0
Summary: A minimal PyTorch training loop with checkpointing, resuming, and plotting built in.
Project-URL: Homepage, https://github.com/agoth24/microflame
Project-URL: Repository, https://github.com/agoth24/microflame
Author: Agoth Arop
License-Expression: MIT
License-File: LICENSE
Keywords: deep-learning,machine-learning,pytorch,trainer,training
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Requires-Dist: matplotlib>=3.0
Requires-Dist: torch>=2.0
Requires-Dist: tqdm>=4.0
Description-Content-Type: text/markdown

# microflame

[![PyPI](https://img.shields.io/pypi/v/microflame.svg)](https://pypi.org/project/microflame/)
[![Python](https://img.shields.io/pypi/pyversions/microflame.svg)](https://pypi.org/project/microflame/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

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

## Install

```bash
pip install microflame
```

## Quickstart

```python
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:

```python
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](LICENSE).
