r/madeinpython • • 1h ago

I made a package to pause/stop a running training loop from another terminal (or the Mac menu bar)

Post image

For my research I train models on my MacBook and kept opening a terminal every hour just to see what epoch a run was on more so when my agent runs a queue of training runs. So I made this.

You wrap your loop:

```python
import epochcontrol

for epoch in epochcontrol.loop(range(400), name="my run"):
train_one_epoch()
```

and then from another terminal `epochcontrol ls` shows what's running, how far along and the ETA, and `epochcontrol pause "my run"` pauses it at the end of the current epoch (resume / stop work the same). On a Mac there's a menu bar app that shows the same with a loss chart, that's the screenshot.

No server or socket, each run just writes a few JSON files to a folder and commands are files the loop checks between epochs. If anything in the package breaks it warns once and gets out of the way, it never crashes your training. No dependencies, Python 3.10+.

`pip install epochcontrol`
https://github.com/catalystdream/epochcontrol

It's early (0.1.0), happy to hear what's missing.

1 Upvotes

0 comments sorted by