All Projects → larq → Larq

larq / Larq

Licence: apache-2.0
An Open-Source Library for Training Binarized Neural Networks

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Larq

mybinder.org-deploy
Deployment config files for mybinder.org
Stars: ✭ 64 (-84.65%)
Mutual labels:  binder
examples
Example nteract notebooks with links to execution on mybinder.org
Stars: ✭ 24 (-94.24%)
Mutual labels:  binder
Daemonservice
Android端心跳服务与进程保活
Stars: ✭ 264 (-36.69%)
Mutual labels:  binder
Binder
🦁"Hello World" <-> [🏷, 🏷, 🏷, 🏷]
Stars: ✭ 37 (-91.13%)
Mutual labels:  binder
openrefine-client
The OpenRefine Python Client from Paul Makepeace provides a library for communicating with an OpenRefine server. This fork extends the command line interface (CLI) and is distributed as a convenient one-file-executable (Windows, Linux, Mac). It is also available via Docker Hub, PyPI and Binder.
Stars: ✭ 67 (-83.93%)
Mutual labels:  binder
clustergrammer2-notebooks
Examples using Clustergrammer2 to explore high-dimensional datasets.
Stars: ✭ 35 (-91.61%)
Mutual labels:  binder
vscode-binder
VS Code on Binder
Stars: ✭ 88 (-78.9%)
Mutual labels:  binder
Geopandas Tutorial
Tutorial on geospatial data manipulation with Python
Stars: ✭ 306 (-26.62%)
Mutual labels:  binder
R-in-Jupyter-with-Binder
Example of how to use R in Jupyter notebooks and make compatible with Binder
Stars: ✭ 17 (-95.92%)
Mutual labels:  binder
libgbinder
GLib-style interface to binder
Stars: ✭ 21 (-94.96%)
Mutual labels:  binder
Bifrost
基于JSON PRC 协议的一种Android跨进程调用解决方案。
Stars: ✭ 24 (-94.24%)
Mutual labels:  binder
coronavirus-knowledge-graph
OBSOLETE: Prototype Neo4j Knowledge Graph for Coronavirus outbreaks (see NEW VERSION: https://github.com/covid-19-net/covid-19-community)
Stars: ✭ 17 (-95.92%)
Mutual labels:  binder
mmtf-workshop-2018
Structural Bioinformatics Training Workshop & Hackathon 2018
Stars: ✭ 50 (-88.01%)
Mutual labels:  binder
python-for-excel
This is the companion repo of the O'Reilly book "Python for Excel".
Stars: ✭ 253 (-39.33%)
Mutual labels:  binder
Course Starter R
👩‍🏫🇷 Starter repo for building interactive R courses
Stars: ✭ 281 (-32.61%)
Mutual labels:  binder
ijava-binder
An IJava binder base for trying the Java Jupyter kernel on https://mybinder.org/
Stars: ✭ 28 (-93.29%)
Mutual labels:  binder
covid-19-community
Community effort to build a Neo4j Knowledge Graph (KG) that links heterogeneous data about COVID-19
Stars: ✭ 95 (-77.22%)
Mutual labels:  binder
Keepalive
Fighting against force-stop kill process on Android with binder ioctl / Android高级保活
Stars: ✭ 376 (-9.83%)
Mutual labels:  binder
Agentnet
Deep Reinforcement Learning library for humans
Stars: ✭ 298 (-28.54%)
Mutual labels:  binder
binder-for-linux
An experimental project to port Android Binder IPC subsystem to Ubuntu Linux.
Stars: ✭ 110 (-73.62%)
Mutual labels:  binder
logo

Codecov PyPI - Python Version PyPI PyPI - License DOI Code style: black

Larq is an open-source deep learning library for training neural networks with extremely low precision weights and activations, such as Binarized Neural Networks (BNNs).

Existing deep neural networks use 32 bits, 16 bits or 8 bits to encode each weight and activation, making them large, slow and power-hungry. This prohibits many applications in resource-constrained environments. Larq is the first step towards solving this. It is designed to provide an easy to use, composable way to train BNNs (1 bit) and other types of Quantized Neural Networks (QNNs) and is based on the tf.keras interface. Note that efficient inference using a trained BNN requires the use of an optimized inference engine; we provide these for several platforms in Larq Compute Engine.

Larq is part of a family of libraries for BNN development; you can also check out Larq Zoo for pretrained models and Larq Compute Engine for deployment on mobile and edge devices.

Getting Started

To build a QNN, Larq introduces the concept of quantized layers and quantizers. A quantizer defines the way of transforming a full precision input to a quantized output and the pseudo-gradient method used for the backwards pass. Each quantized layer requires an input_quantizer and a kernel_quantizer that describe the way of quantizing the incoming activations and weights of the layer respectively. If both input_quantizer and kernel_quantizer are None the layer is equivalent to a full precision layer.

You can define a simple binarized fully-connected Keras model using the Straight-Through Estimator the following way:

model = tf.keras.models.Sequential(
    [
        tf.keras.layers.Flatten(),
        larq.layers.QuantDense(
            512, kernel_quantizer="ste_sign", kernel_constraint="weight_clip"
        ),
        larq.layers.QuantDense(
            10,
            input_quantizer="ste_sign",
            kernel_quantizer="ste_sign",
            kernel_constraint="weight_clip",
            activation="softmax",
        ),
    ]
)

This layer can be used inside a Keras model or with a custom training loop.

Examples

Check out our examples on how to train a Binarized Neural Network in just a few lines of code:

Installation

Before installing Larq, please install:

  • Python version 3.6, 3.7 or 3.8
  • Tensorflow version 1.14, 1.15, 2.0, 2.1, 2.2, 2.3, or 2.4:
    pip install tensorflow  # or tensorflow-gpu
    

You can install Larq with Python's pip package manager:

pip install larq

About

Larq is being developed by a team of deep learning researchers and engineers at Plumerai to help accelerate both our own research and the general adoption of Binarized Neural Networks.

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].