Giter Club home page Giter Club logo

BlinkDL

A minimalist deep learning library in Javascript using WebGL + asm.js. Runs in your browser.

Currently it is a proof-of-concept (inference only). Note: Convolution is buggy when memories overlap.

The WebGL backend is powered by weblas: https://github.com/waylonflinn/weblas.

Example

https://withablink.coding.me/goPolicyNet/ : a weiqi (baduk, go) policy network in AlphaGo style:

board_image

const N = 19;
const NN = N * N;
const nFeaturePlane = 8;
const nFilter = 128;

const x = new BlinkArray();
x.Init('weblas');
x.nChannel = nFeaturePlane;
x.data = new Float32Array(nFeaturePlane * NN);
for (var i = 0; i < NN; i++)
    x.data[5 * NN + i] = 1; // set feature plane for empty board

// pre-act residual network with 6 residual blocks
const bak = new Float32Array(nFilter * NN);
x.Convolution(nFilter, 3);
x.CopyTo(bak);
x.BatchNorm().ReLU().Convolution(nFilter, 3);
x.BatchNorm().ReLU().Convolution(nFilter, 3);
x.Add(bak).CopyTo(bak);
x.BatchNorm().ReLU().Convolution(nFilter, 3);
x.BatchNorm().ReLU().Convolution(nFilter, 3);
x.Add(bak).CopyTo(bak);
x.BatchNorm().ReLU().Convolution(nFilter, 3);
x.BatchNorm().ReLU().Convolution(nFilter, 3);
x.Add(bak).CopyTo(bak);
x.BatchNorm().ReLU().Convolution(nFilter, 3);
x.BatchNorm().ReLU().Convolution(nFilter, 3);
x.Add(bak).CopyTo(bak);
x.BatchNorm().ReLU().Convolution(nFilter, 3);
x.BatchNorm().ReLU().Convolution(nFilter, 3);
x.Add(bak).CopyTo(bak);
x.BatchNorm().ReLU().Convolution(nFilter, 3);
x.BatchNorm().ReLU().Convolution(nFilter, 3);
x.Add(bak);
x.BatchNorm().ReLU().Convolution(1, 1).Softmax();

performance_image

Usage

<script src='weblas.js' type='text/javascript'></script>
<script src='BlinkDL.js' type='text/javascript'></script>

Todo

  • Convolution (3x3_pad_1 and 1x1), BatchNorm, ReLU, Softmax
  • Pooling layer
  • FC layer
  • Strided convolution
  • Transposed convolution
  • Webworker and async
  • Faster inference with weblas pipeline, WebGPU, WebAssembly
  • Memory manager
  • Training

PENG Bo's Projects

ai-writer icon ai-writer

AI 写小说,生成玄幻和言情网文等等。中文预训练生成模型。采用我的 RWKV 模型,类似 GPT-2 。AI写作。RWKV for Chinese novel generation.

basis icon basis

The Basis Programming Language

blinkdl icon blinkdl

A minimalist deep learning library in Javascript using WebGL + asm.js. Run convolutional neural network in your browser.

blinktodo icon blinktodo

A minimalist ToDo.txt page. 如果你的ToDo有一百项以上,试试这个基于txt的极简事项管理工具。

bookcnn icon bookcnn

《深度卷积网络:原理与实践》现已在淘宝天猫京东当当发售. 这里是其中的代码下载.

chatrwkv icon chatrwkv

ChatRWKV is like ChatGPT but powered by RWKV (100% RNN) language model, and open source.

fastchat icon fastchat

An open platform for training, serving, and evaluating large languages. Release repo for Vicuna and FastChat-T5.

gpt-neox icon gpt-neox

An implementation of model parallel autoregressive transformers on GPUs, based on the DeepSpeed library.

hua icon hua

Hua is an AI image editor with Stable Diffusion (and more).

libai icon libai

LiBai(李白): A Toolbox for Large-Scale Distributed Parallel Training

lm-trick-questions icon lm-trick-questions

Here we collect trick questions and failed tasks for open source LLMs to improve them.

mathbook icon mathbook

一个较为系统的数学笔记(graduate level)

mingpt-tuned icon mingpt-tuned

A *tuned* minimal PyTorch re-implementation of the OpenAI GPT (Generative Pretrained Transformer) training

nala icon nala

The Nala markup, to turn a "Natural Language" sentence into a code-like statement. Nala 标注,将自然语言变为编程语言。

pathtracingjs icon pathtracingjs

Path tracing demo with JS in your web browser. 用浏览器JS做路径跟踪渲染。

projectivory icon projectivory

Project Ivory is a simple forum written a few years ago.

rwkv-cuda icon rwkv-cuda

The CUDA version of the RWKV language model ( https://github.com/BlinkDL/RWKV-LM )

rwkv-lm icon rwkv-lm

RWKV is an RNN with transformer-level LLM performance. It can be directly trained like a GPT (parallelizable). So it's combining the best of RNN and transformer - great performance, fast inference, saves VRAM, fast training, "infinite" ctx_len, and free sentence embedding.

rwkv-v2-rnn-pile icon rwkv-v2-rnn-pile

RWKV-v2-RNN trained on the Pile. See https://github.com/BlinkDL/RWKV-LM for details.

smallinitemb icon smallinitemb

LayerNorm(SmallInit(Embedding)) in a Transformer to improve convergence

worldmodel icon worldmodel

Let us make Psychohistory (as in Asimov) a reality, and accessible to everyone. Useful for LLM grounding and games / fiction / business / finance / governance, and can align agents with human too.

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.