Skip to main content

A library to make neural networks lighter and faster with fastai

Project description

Fasterai

header

fasterai is a library created to make neural network smaller and faster. It essentially relies on common compression techniques for networks such as pruning, knowledge distillation, ...

Project Documentation

Visit Read The Docs Project Page or read following README to know more about using Fasterai

Available Methods

1. Pruning

Make your model sparse (i.e. prune it) according to a:

  • Sparsity: the amount of weights that will be replaced by 0
  • Granularity: the granularity at which you operate the pruning (removing weights, vectors, kernels, filters)
  • Method: prune either each layer independantly (local pruning) or the whole model (global pruning)
  • Criteria: the criteria used to select the weights to remove (magnitude, movement, ...)
  • Schedule: which schedule you want to use for pruning (one shot, iterative, gradual, ...)

2. Knowledge Distillation

Distill the knowledge acquired by a big model into a smaller one.

3. Lottery Ticket Hypothesis

Find the winning ticket in you network, i.e. the initial subnetwork able to attain at least similar performances than the network as a whole.

Quick Start

1. Create your model with fastai

learn = cnn_learner(dls, model)

2. Get you Fasterai Callback

sp_cb=SparsifyCallback(end_sparsity, granularity, method, criteria, sched_func)

3. Train you model to make it sparse !

learn.fit_one_cycle(n_epochs, cbs=sp_cb)

More about other methods in the tutorials section

Installation

pip install git+https://github.com/nathanhubens/fasterai.git

or

pip install fasterai

Citing

@misc{Hubens:2020,
  Author = {Nathan Hubens},
  Title = {Fasterai},
  Year = {2020},
  Publisher = {GitHub},
  Journal = {GitHub repository},
  Howpublished = {\url{https://github.com/nathanhubens/fasterai}}
}

footer

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

fasterai-0.1.2.tar.gz (17.3 kB view hashes)

Uploaded Source

Built Distribution

fasterai-0.1.2-py3-none-any.whl (17.6 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