Code Monkey home page Code Monkey logo

pyjet's Introduction

PyJet (WIP)

Build Status Coverage Status license

Custom Pytorch Frontend I gradually build on for my projects. This has pretty much become a multi-year personal project I use to keep a personally customized front-end for deep learning when trying out new projects. Over the years I've added all kinds of cool features like:

  • Input size inferral - no need to define the input size to your layers
  • Interface to train models with multiple or arbitrarily complex optimizer schemes
  • Interface to train models with multiple or arbitrarily complex loss schemes
  • Tracking training stats that can persist state over multiple batches
  • Keras-like training and usage of models
  • Pythonic pipelining and management of data
  • Integration with useful libraries like imgaug and tqdm

Below is the console and graph output from running mnist.py in the examples folder Example Console

Example Console

Installation

To install run the following in your HOME directory.

git clone https://github.com/abhmul/PyJet/
cd PyJet
sudo pip install -e .
cd ..

Update

To update, go to your PyJet installation directory (should be HOME/PyJet if you followed the installation instructions) and run

git pull

pyjet's People

Contributors

abhmul avatar

Stargazers

Soumik Rakshit avatar Samarth Wahal avatar Gunny Liu avatar

Watchers

James Cloos avatar  avatar Gunny Liu avatar  avatar

pyjet's Issues

ImageAugmentor and GeneratorEnqueuer do not share DatasetGenerator Attributes

Right now all operations on a DatasetGenerator are complicated with ImageAugmentor and GeneratorEnqueuers (and possibly more generators to come) since they do not share the same attributes of a DatasetGenerator. These classes need to be modified to allow their use in any place a normal DatasetGenerator might be used.

This might be achieved by subclassing the DatasetGenerator or creating a super class. This can also be achieved by creating matching attributes for GeneratorEnqueuer and ImageAugmentor defined by the attributes of DatasetGenerator.

Ideally, changing DatasetGenerator should not require changing any solution code for this issue.

Mimicking Keras Training API

In order to be able to seamlessly swap pyjet models with keras models, pyjet needs to change to use the same API for training and interact the same way with training related keras objects (e.g. callbacks). In order to do so, the following needs to happen:

  • Write a compile method for SLModel to pass in loss functions, optimizers, and metrics into
  • Support multi-input, multi-loss, and multi-output in the same fashion as keras
  • Make fit_generator create a training log for callbacks just like Keras
  • Modify fit_generator to return a history object
  • Replace save_state and load_state with save_weights and load_weights respectively
  • Create save and load_model just like with keras
  • Change impelentable method for the forward pass of the network to call not forward to use forward for some forward pass overhead
  • Create non-generator equivalents (i.e. create Keras's fit, evaluate, and predict methods)

Increase Testing and Coverage

Most of the current PyJet code was hacked together in one weekend without testing. Major, hidden bugs do exist. Having increased testing will not only uncover these bugs, but also increase the stability and organization of the project.

Goal: Have 95% test coverage before adding any new features.

Create better functionality for loss functions

Currently loss functions and auxiliary loss functions are supported, but the setup is very clunky. One main loss function is supported, but the input must be stored in self.loss_in in the network forward() method. Auxiliary losses are appended to the self.aux_loss_in and these losses must be input into the fit_generator method in the exact same order their arguments were appended to self.aux_loss_in. Currently, assigning various optimizers to different losses is not supported.

Some avenues to improve functionality

  • Use some kind of dictionary under the hood to link up losses by name with their inputs.
  • Have some methods that abstract the use of this dictionary for users to use when creating network. Something like
add_loss_fn(self, name, loss_fn, *inputs)
  • Store some kind of similar dictionary to figure out which optimizers go to which losses. This can be input into the fit_generator
  • Consider making a compile method that will build this stuff before calling fit_generator. This will allow us to mimic keras better. This method compile will be able to to be called any number of times to change the loss + optimizer dictionaries.

GeneratorEnqueuer improperly terminates

When a program running a generator enqueuer is interrupted or finishes, the termination of the generator enqueuer will hang. This is most likely due to imporperly terminating the threads and some being stuck running or in deadlock during termination.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.