https://github.com/kabouzeid/mini-kit
Small self-contained micro packages for deep learning codebases.
https://github.com/kabouzeid/mini-kit
deep-learning library python pytorch
Last synced: 6 months ago
JSON representation
Small self-contained micro packages for deep learning codebases.
- Host: GitHub
- URL: https://github.com/kabouzeid/mini-kit
- Owner: kabouzeid
- Created: 2025-10-07T16:31:10.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-12-14T15:15:55.000Z (7 months ago)
- Last Synced: 2025-12-16T23:39:18.942Z (7 months ago)
- Topics: deep-learning, library, python, pytorch
- Language: Python
- Homepage: https://kabouzeid.github.io/mini-kit/
- Size: 447 KB
- Stars: 5
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Agents: AGENTS.md
Awesome Lists containing this project
README
# mini-kit
Minimal, hackable building blocks for deep learning projects. The goal is to keep every layer small enough that you can read it, tweak it, or drop it into your own codebase.
[](https://pypi.python.org/pypi/mini-kit)
[](https://kabouzeid.github.io/mini-kit/)
## Quick Start
```bash
pip install mini-kit
```
You now have three tiny helpers that play nicely together:
1. `mini.config` loads plain-Python configs. Start with a single dictionary, then grow into composable templates and parent chains without learning a new DSL.
2. `mini.builder` turns dictionaries into Python objects. Supports both registry shortcuts and fully qualified import paths.
3. `mini.trainer` provides a lightweight training framework with hooks for logging, checkpointing, and customization.
The example below shows `mini.config` and `mini.builder` in action.
```python
# configs/model.py
config = {
"model": {
"type": "Classifier",
"encoder": {"type": "Encoder", "channels": 64},
"head": {"type": "torch.nn.Linear", "*": [64, 10]},
},
"optimizer": {"type": "torch.optim.AdamW", "lr": 3e-4},
}
```
```python
# main.py
from mini.builder import register, build
from mini.config import apply_overrides, load
@register()
class Encoder:
def __init__(self, channels: int):
self.channels = channels
@register()
class Classifier:
def __init__(self, encoder, head):
self.encoder = encoder
self.head = head
cfg = load("configs/model.py")
cfg = apply_overrides(cfg, ["optimizer.lr=1e-3", "model.encoder.channels=128"])
model = build(cfg["model"])
optimizer = build(cfg["optimizer"])
```
- `load` executes `configs/model.py`; keep a simple `config = {...}` for small projects, or swap to `def config(...):` and `parents = [...]` when you need templates and composition.
- `apply_overrides` allows for painless command-line overrides: tweak nested keys with a short-hand syntax: `optimizer.lr=...`, append with `+=`, or drop entries with `!=`.
- `build` looks at the `"type"` key, grabs the right constructor (from the registry or import path), and wires up dependencies for you.
## Docs
More details live in the [documentation site](https://kabouzeid.github.io/mini-kit).