/TorchFusion-Utils

A pytorch helper library for Mixed Precision Training, Initialization, Metrics and More Utilities to simplify training of deep learning models

Primary LanguagePythonMIT LicenseMIT

TorchFusion-Utils

A pytorch helper library for Mixed Precision Training, Metrics and More Utilities to simplify training of deep learning models.

TorchFusion Utils was built to enable pytorch programmers easily take advantage of advanced training techniques without having to use any specific trainer framework. It is very transparent and can be easily plugged in to existing Pytorch code bases

Installation

TorchFusion Utils is extremely light with no other dependency other than Pytorch itself. You can install from pypi

 pip3 install torchfusion-utils --upgrade 

Core Features

Mixed Precision Training

In just two lines of code, you can speed up training of your Pytorch models, reduce memory usage on any GPU and fit in larger batch sizes than was previously possible on your GPU.

#convert your model and optimizer to mixed precision mode
model, optim = convertToFP16(model,optim)

#in your batch loop, replace loss.backward with optim.backward(loss)
optim.backward(loss)

Initialization

A very simple api to easily initialize your model parameters with fine grained control over the type of layers and type of weights to be initialized.

kaiming_normal_init(model,types=[nn.Conv2d],category="weight")

Metrics

An extensible metric package that makes it easy to easily compute accuracy of your models. A number of metrics are provided out of the box and you can extend to add yours.

top5_acc = Accuracy(topk=5)

#sample evaluation loop
for i,(x,y) in enumerate(data_loader):
    predictions = model(x)
    top5_acc.update(predictions,y)

print("Top 5 Acc: ",top5_accc.getValue())

Model Utilities

Simple functions to easily analyse, load and save your Pytorch models in an error free way.

Documentation

Find tutorials and extensive documentation on using TorchFusion Utils from https://utils.torchfusion.org

About The TorchFusion Project

The TorchFusion project is a set of Pytorch based deep learning libraries aimed at making making research easier and more productive. We believe anyone can be a great researcher with the right tools, thats why we build!

TorchFusion is an initiative of DeepQuest AI, founded by John Olafenwa & Moses Olafenwa.

Contact Developers


John Olafenwa
Email: johnolafenwa@gmail.com
Website: https://john.aicommons.science
Twitter: @johnolafenwa
Medium : @johnolafenwa
Facebook : olafenwajohn

Moses Olafenwa
Email: guymodscientist@gmail.com
Website: https://moses.aicommons.science
Twitter: @OlafenwaMoses
Medium : @guymodscientist
Facebook : moses.olafenwa