Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Library build on top of pytorch to fuel productivity

Project description

torchfuel

Build Status codecov

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.

Files for torchfuel, version 0.1.3
Filename, size File type Python version Upload date Hashes
Filename, size torchfuel-0.1.3-py3-none-any.whl (18.8 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size torchfuel-0.1.3.tar.gz (11.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page