All Projects → nathanhubens → fasterai1

nathanhubens / fasterai1

Licence: MIT license
FasterAI: A repository for making smaller and faster models with the FastAI library.

Programming Languages

Jupyter Notebook
11667 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to fasterai1

Model Optimization
A toolkit to optimize ML models for deployment for Keras and TensorFlow, including quantization and pruning.
Stars: ✭ 992 (+2817.65%)
Mutual labels:  compression, pruning
SSD-Pruning-and-quantization
Pruning and quantization for SSD. Model compression.
Stars: ✭ 19 (-44.12%)
Mutual labels:  compression, pruning
Aimet
AIMET is a library that provides advanced quantization and compression techniques for trained neural network models.
Stars: ✭ 453 (+1232.35%)
Mutual labels:  compression, pruning
Model Compression And Acceleration Progress
Repository to track the progress in model compression and acceleration
Stars: ✭ 63 (+85.29%)
Mutual labels:  compression, pruning
Hrank
Pytorch implementation of our CVPR 2020 (Oral) -- HRank: Filter Pruning using High-Rank Feature Map
Stars: ✭ 164 (+382.35%)
Mutual labels:  compression, pruning
prunnable-layers-pytorch
Prunable nn layers for pytorch.
Stars: ✭ 47 (+38.24%)
Mutual labels:  compression, pruning
Nncf
PyTorch*-based Neural Network Compression Framework for enhanced OpenVINO™ inference
Stars: ✭ 218 (+541.18%)
Mutual labels:  compression, pruning
torchprune
A research library for pytorch-based neural network pruning, compression, and more.
Stars: ✭ 133 (+291.18%)
Mutual labels:  compression, pruning
MEGA Manager
Cloud syncing manager for multiple MEGA cloud storage accounts with syncing, data gathering, compresssion and optimization capabilities.
Stars: ✭ 29 (-14.71%)
Mutual labels:  compression
FAI-notes
Some notes, tutorials, and some experimentation with the fast.ai library (https://github.com/fastai/fastai)
Stars: ✭ 58 (+70.59%)
Mutual labels:  fastai
Lib.AspNetCore.WebSocketsCompression
[Archived] Lib.AspNetCore.WebSocketsCompression is a library which provides a managed implementation of the WebSocket protocol, along with server integration components and support for permessage-deflate compression.
Stars: ✭ 23 (-32.35%)
Mutual labels:  compression
encrypted-skin-cancer-detection
Detecting skin cancer in encrypted images with TensorFlow
Stars: ✭ 27 (-20.59%)
Mutual labels:  fastai
zstd-rs
zstd-decoder in pure rust
Stars: ✭ 148 (+335.29%)
Mutual labels:  compression
torch-model-compression
针对pytorch模型的自动化模型结构分析和修改工具集,包含自动分析模型结构的模型压缩算法库
Stars: ✭ 126 (+270.59%)
Mutual labels:  pruning
laravel-Packer
CSS, Javascript and Images packer/processors to Laravel
Stars: ✭ 57 (+67.65%)
Mutual labels:  compression
compbench
⌛ Benchmark and visualization of various compression algorithms
Stars: ✭ 21 (-38.24%)
Mutual labels:  compression
Dynamic Model Pruning with Feedback
Implement of Dynamic Model Pruning with Feedback with pytorch
Stars: ✭ 25 (-26.47%)
Mutual labels:  pruning
fastai-docker
Fast.AI course complete docker container for Paperspace and Gradient
Stars: ✭ 52 (+52.94%)
Mutual labels:  fastai
neural-compressor
Intel® Neural Compressor (formerly known as Intel® Low Precision Optimization Tool), targeting to provide unified APIs for network compression technologies, such as low precision quantization, sparsity, pruning, knowledge distillation, across different deep learning frameworks to pursue optimal inference performance.
Stars: ✭ 666 (+1858.82%)
Mutual labels:  pruning
lossyless
Generic image compressor for machine learning. Pytorch code for our paper "Lossy compression for lossless prediction".
Stars: ✭ 81 (+138.24%)
Mutual labels:  compression

fasterai

FasterAI: A repository for making smaller and faster models with the FastAI library.

Fasterai now exists here for fastai 2.0 !

It allows you to use techniques such as:

  • Knowledge Distillation
  • Pruning
  • Batch Normalization Folding
  • Matrix Decomposition

Usage:

Knowledge Distillation

Used as a callback to make the student model train on soft-labels generated by a teacher model.

 KnowledgeDistillation(student:Learner, teacher:Learner)

You only need to give to the callback function your student learner and your teacher learner. Behind the scenes, fasterai will take care of making your model train using knowledge distillation


Sparsify the network

Used as a callback, will iteratively replace the lowest-norm parameters by zeroes. More information in this blog post

SparsifyCallback(learn, sparsity, granularity, method, criteria, sched_func)
  • sparsity: the percentage of sparsity that you want in your network
  • granularity: on what granularity you want the sparsification to be operated (currently supported: weight, kernel, filter)
  • method: either local or global, will affect the selection of parameters to be choosen in each layer independently (local) or on the whole network (global).
  • criteria: the criteria used to select which parameters to remove (currently supported: l1, grad)
  • sched_func: which schedule you want to follow for the sparsification (currently supported: any scheduling function of fastai, i.e annealing_linear, annealing_cos, ... and annealing_gradual, the schedule proposed by Zhu & Gupta) (shown in Figure below)

Prune the network

Will physically remove the parameters zeroed out in step before. More information in this blog post

Warning: this only works when filter sparsifying has been performed and for fully feed-forward architectures such as VGG16.

pruner = Pruner()
pruned_model = pruner.prune_model(learn.model)

You just need to pass the model whose filters has previously been sparsified and FasterAI will take care of removing them.


Batch Normalization Folding

Will remove batch normalization layers by injecting its normalization statistics (mean and variance) into the previous convolutional layer. More information in this blog post

bn_folder = BN_Folder()
bn_folder.fold(learn.model))

Again, you only need to pass your model and FasterAI takes care of the rest. For models built using the nn.Sequential, you don't need to change anything. For others, if you want to see speedup and compression, you actually need to subclass your model to remove the batch norm from the parameters and from the forward method of your network.


Fully-Connected Layers Decomposition

Will replace fully-connected layers by a factorized version that is more parameter efficient.

FCD = FCDecomposer()
decomposed_model = FCD.decompose(model, percent_removed)

The percent_removed corresponds to the percentage of singular values removed (k value above).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].