Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
A DSL for deep neural networks, supporting Caffe and Torch
| Date | Stars |
|---|---|
| 2026-07-31 | 709 |
| 2026-08-01 | 709 |
| 2026-08-02 | 709 |
| 2026-08-05 | 709 |
| 2026-08-06 | 709 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
* DNNGraph - A deep neural network model generation DSL in Haskell
It consists of several parts:
- A DSL for specifying the model. This uses the [[http://lens.github.io/][lens]] library for
elegant, composable constructions, and the [[http://hackage.haskell.org/package/fgl-5.5.0.1][fgl]] graph library for
specifying the network layout.
- A set of optimization passes that run over the graph representation
to improve the performance of the model. For example, we can take
advantage of the fact that several layers types (=ReLU=, =Dropout=)
can operate in-place.
- A set of backends to generate code for the platform. Currently, we
generate
- Caffe (by generating model =prototxt= files)
- Torch (by generating Lua scripts)
- A set of useful CLI tools for exporting, visualizing and
understanding a model (visualization of network structure, parameter
density)
For a guided example, see a [[http://bit.ly/17kDYze][demonstration IHaskell Notebook]].
** Building
Make sure that you have Python 2 and =protoc= from [[https://developers.google.com/protocol-buffers/][Protocol Buffers]] installed. Then run
#+BEGIN_SRC
$ cabal install hprotoc
$ ./lens_proto.sh # generate code from protocol buffers
$ cabal install
#+END_SRC
** DSL Examples
The following script generates a replica of
https://github.com/BVLC/caffe/blob/master/models/bvlc_alexnet/train_val.prototxt.
*** AlexNet
#+begin_src haskell
import Control.Lens
import Control.Monad
import NN.DSL
import NN.Examples.ImageNet
import NN.Graph
alexTrain = train & cropSize' 227 & batchSize' 256 & mirror' True
alexTest = test & cropSize' 227 & batchSize' 50 & mirror' False
alexLrn = lrn & localSize' 5 & alphaLRN' 0.0001 & betaLRN' 0.75
alexConv = conv & param' alexMult & weightFillerC' (gaussian 0.01) & biasFillerC' zero
alexIP n = ip n & param' alexMult & weightFillerIP' (gaussian 0.005) & biasFillerIP' (constant 0.1)
alexPool = maxPool & sizeP' 3
alexMult = [def & lrMult' 1 & decayMult' 1, -- weights
def & lrMult' 2 & decayMult' 0] -- biases
-- |Model
conv1 = alexConv & numOutputC' 96 & kernelSizeC' 11 & strideC' 4
conv2 = alexConv & numOutputC' 256 & padC' 2 & kernelSizeC' 5 & groupC' 2
conv3 = alexConv & numOutputC' 384 & padC' 1 & kernelSizeC' 3
conv4 = alexConv & numOutputC' 384 & padC' 1 & kernelSizeC' 3 & groupC' 2 & biasFillerC' (constant 0.1)
conv5 = alexConv & numOutputC' 256 & padC' 1 & kernelSizeC' 3 & groupC' 2 & biasFillerC' (constant 0.1)
alexNet = do
-- Set up the model
(input', representation) <-
sequential [
-- Convolutional Layers
conv1, relu, alexLrn, alexPool & strideP' 3,
conv2, relu, alexLrn, alexPool & strideP' 2,
conv3, relu,
conv4, relu,
conv5, relu, alexPool & strideP' 2,
-- FC Layers
alexIP 4096, relu, dropout 0.5,
alexIP 4096, relu, dropout 0.5,
alexIP 1000 & weightFillerIP' (gaussian 0.01) & biasFillerIP' zero]
forM_ [alexTrain, alexTest] $ attach (To input')
forM_ [accuracy 1, accuracy 5, softmax] $ attach (From representation)
#+end_src
or visually, using =NN.Visualize=,
#+ATTR_HTML: :height 600px
[[http://i.imgur.com/1hKlPdA.png]]
*** GoogLeNet
The following script generates a replica of
https://github.com/BVLC/caffe/blob/master/models/bvlc_googlenet/train_val.prototxt
#+begin_src haskell
module NN.Examples.GoogLeNet where
import Gen.Caffe.FillerParameter as FP
import Gen.Caffe.InnerProductParameter as IP
import Gen.Caffe.LayerParameter as LP
import Control.Lens
import Control.Monad
import Data.Sequence (singleton)
import Data.Word
import NN
import NN.Examples.ImageNet
googleTrain = train & mirror' True & batchSize' 32 & cropSize' 224
Excerpt of 13,056 characters
Read on GitHub17
4
Tony Kelman · United States
1
Would you bet a product on this? Bounded 0–100 and slow moving.
matched fp:99b84eb58ea95d86, llm:Description: 'A DSL for deep neural networks, supporting Caffe and Torch' (repository description). Language: Haskell.
matched fp:99b84eb58ea95d86, llm:Description: 'A DSL for deep neural networks, supporting Caffe and Torch' (repository description). Language: Haskell.