Library build on top of pytorch to fuel productivity
Project description
torchfuel
Build on top of pytorch to fuel productivity.
Features
- Generic Trainer
- Classification Trainer (with cross-entropy loss)
- MSE Trainer
- Additional utility layers
- Better dataloaders (currently only for image datasets)
Classification Example
import os
import time
from collections import namedtuple
import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim import lr_scheduler
from torchvision import datasets, models, transforms
from torchfuel.data_loaders.image import ImageDataLoader
from torchfuel.trainers.classification import ClassificationTrainer
from torchfuel.transforms.noise import DropPixelNoiser
dl = ImageDataLoader(
train_data_folder='imgs/train',
eval_data_folder='imgs/eval',
pil_transformations=[transforms.RandomHorizontalFlip()]
tensor_transformations=[DropPixelNoiser()],
batch_size=64,
imagenet_format=True,
)
train_dataloader, eval_dataloader, n_classes = dl.prepare()
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
model = Model(...).to(device)
optimiser = optim.SGD(model.parameters(), lr=0.01, momentum=0.9)
scheduler = optim.lr_scheduler.ReduceLROnPlateau(optimiser, 'min', patience=20)
trainer = ClassificationTrainer(device, model, optimiser, scheduler)
fitted_model = trainer.fit(epochs, train_dataloader, eval_dataloader)
How to install
Clone repository and run:
pip install .
Optionally (not up to date):
pip install torchfuel
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
torchfuel-0.1.3.tar.gz
(11.0 kB
view details)
Built Distribution
torchfuel-0.1.3-py3-none-any.whl
(18.8 kB
view details)
File details
Details for the file torchfuel-0.1.3.tar.gz
.
File metadata
- Download URL: torchfuel-0.1.3.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15d8d31bfe980965ce9ad91243929593e9df593d590cd7d2bdb6fe6266f1fc14 |
|
MD5 | 0bc570f653afdc27206a8cbd6e6369c2 |
|
BLAKE2b-256 | a72ccf946479015d33140975a56f166b3c4fc874703072d8e5495a6a24d97f90 |
File details
Details for the file torchfuel-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: torchfuel-0.1.3-py3-none-any.whl
- Upload date:
- Size: 18.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 409fe0430fd83e54b8a7112b7d53e3c2412dbf76e14a31296137fff55f977ad9 |
|
MD5 | 6195a647ad16f7a45c8f2826960e99d1 |
|
BLAKE2b-256 | 508799f54ec046e447e6ca30353a30d808cf3bdf290e62df4e27b0ac9c74b60e |