Skip to main content

A pytorch wrapper that makes .fit() possible!

Project description

Welcome to torchy

torchy is a work in progress and will be going through constant changes everyday.

Introduction

easy-torch is a PyTorch wrapper that has some additional benefits to using plain pytorch. With easy-torch you have everything in pytorch plus some additional features found on other libraries.

Installation using pip

Additional Functionality

import torchy.nn as nn
import torch
from torchy.utils.data import TensorDataset, DataLoader, random_split, DeviceDL

x = torch.tensor([[12.],[13],[15]])
y = torch.tensor([[2.],[3],[4]])
train = TensorDataset(x,y)
class Model(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(1, 1)

    def forward(self,x):
        return self.linear(x)

loss_fn = nn.functional.mse_loss
model = Model()
opt = torch.optim.SGD(model.parameters(),lr=0.001,momentum=.9)
model = model.fit(train, loss_fn,opt,20,valid_pct = 20,batch_size=2)

You can also use a dataloader instead of a dataset. If you're using a dataloader be sure to pass additional argument "valid_dataloader" otherwise the no model validation would be carried out.

dl = DataLoader(train,batch_size = 2)
model = model.fit(dl, loss_fn,opt,20)

To-do

more documentation and all arguments and their function table comming soon.

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

torchy-0.0.1.tar.gz (6.9 kB view hashes)

Uploaded Source

Built Distribution

torchy-0.0.1-py3-none-any.whl (6.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page