Torchest
Pytorch tools and utilities (Trainers, data generators, functions, and more...)
Trainers
One of the most common tasks you will do in pytorch is define training loops, which is a hassle because they are almost always the same. Torchest has trainers you can use for your projects
from torchest.trainer import SimpleTrainer
# previous definition of model and data preparation
# train_dataloader = DataLoader(train_data)
# dev_dataloader = DataLoader(dev_data)
# test_dataloader = DataLoader(test_data)
# model = nn.Sequential(...)
...
"""
Prepare Trainer
"""
loss_fn = nn.CrossEntropyLoss()
learning_rate= 1e-2
optimizer = optim.Adam(model.parameters(), lr=learning_rate)
trainer = SimpleTrainer(model, loss_fn, optimizer)
"""
Train
"""
epochs = 500
trainer.train(data_train=train_dataloader, data_dev=dev_dataloader, data_test=test_dataloader, epochs=epochs)
Training loop progress
31%|██████████████████▍ | 156/500 [00:02<00:05, 58.01epoch/s, train_accuracy=76.2, train_cost=0.238290]
Trainer also saves the cost for the train, dev and test passes. You can simply call trainer.plot_costs() to display the graph with the costs
Wandb visualization
Trainers support wandb to visualize loss and acurracy as well as to save model versions. if you want to enable you have to set 2 parameters in your trainer initialization, name and wandb
trainer = SimpleTrainer(model, loss_fn, optimizer, wandb_project_name="MyProject", wandb=True)
On the first run you will have to enter your API key, which you can obtain at https://wandb.ai/settings
Data generators
Spiral data
This will create a 2d matrix with points in a dataplot. Ideal for testing non-linearity in your network
from torchest.datagen import spiral_datagen
class_num = 3
X, Y = spiral_datagen(450, class_num) # 450 elements per class
Metadata
Release files for torchest 0.0.6
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 | |
|---|---|---|---|---|
| torchest-0.0.6.tar.gz | 7.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| torchest-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.7 kB
Release files / torchest-0.0.6.tar.gz
| Download URL | torchest-0.0.6.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a214051b7127432b7ea551e007d0ec0923b6098365571d5806e4773fa96a5688
|
|
BLAKE2b-256 checksum How to use checksums |
513ad5c3ad1bf07d9436728ed42e3893b52c5ddd5a4012d642931f45d62d0010
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / torchest-0.0.6-py3-none-any.whl
| Download URL | torchest-0.0.6-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8d706e814e54655c57c6d9fc71b216c4aff4566d33b79526878cc7d9f5268e3f
|
|
BLAKE2b-256 checksum How to use checksums |
52c27727ffc7eb228909cdeb788099dd1b29365247ccf98825e2e0d7ff3b459a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for torchest 0.0.6
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.