Torch Runner
A minimal wrapper that removes some of the overhead code in training pytorch models
Note: If you are looking for something more extensive, checkout Pytorch Lightning. This is mostly designed for my personal use.
Requirements
- torch
- tqdm
Installation
pip install torch-runner
Features
- seed all variables
- text logger
- early stopping
- save hyperparameters
- weights & biases support
Example
Checkout the examples folder which contains a jupyter notebook to train a resnet50 using torch_runner.
import torch
import torch_runner as T
class myTrainer(T.TrainerModule):
def calc_metric(self, preds, target):
## Calc metrics such as accuracy etc.
def loss_fct(self, preds, target):
## Calc loss
def train_one_step(self, batch, batch_id):
## Get batch data from dataloader and perform one update
def valid_one_step(self, batch, batch_id):
## Perform validation step
config = T.TrainerConfig()
model = myModel()
optimizer = torch.optim.SGD(model.parameters(), lr=0.01)
train_dataloader = ## pytorch dataloader
val_dataloader = ## pytorch dataloader
Trainer = myTrainer(model, optimizer, config)
Trainer.fit(train_dataloader, val_dataloader, epochs=10)
Metadata
Release files for torch-runner 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| torch_runner-0.1.0.tar.gz | 16.1 kB | Without provenance | Details for torch_runner-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| torch_runner-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for torch_runner-0.1.0-py3-none-any.whl |
Total release size: 22.6 kB
Release files / torch_runner-0.1.0.tar.gz
| Download URL | torch_runner-0.1.0.tar.gz |
|---|---|
| Size | 16.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eda717970d740391978820327b0515f0e06a733dee3088e230a34d92ae6a7758
|
|
BLAKE2b-256 checksum How to use checksums |
36f16bb57b7682d2d6599bec872e432cbd9daff38547db68cba67bee4e4c4864
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.12.5 setuptools/49.6.0.post20200925 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.6.12
|
Release files / torch_runner-0.1.0-py3-none-any.whl
| Download URL | torch_runner-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ba98c78078f0d87e74bba3e718a01b794559c5fff1e1231b4579b64be3ed59b7
|
|
BLAKE2b-256 checksum How to use checksums |
18521fcb9bc28b5445edf27da69d76e7b9356c9ca2f5e4b0b4aec5a3ec363eda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.12.5 setuptools/49.6.0.post20200925 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.6.12
|
Security for torch-runner 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.