This is alpha version, but the
examples are working.
Merlin: deep learning framework in Julia
Merlin is a deep learning framework written in Julia.
It aims to provide a fast, flexible and compact deep learning library for machine learning.
Our primary goal is to develop a natural language processing toolkit based on
Merlin is tested against Julia
0.5 on Linux, OS X, and Windows (x64).
- Julia 0.5 or later
- g++ (for OSX or Linux)
First, install Julia. Currently, version 0.5 is supported.
Then, clone and build the package.
julia> Pkg.clone("https://github.com/hshindo/Merlin.jl.git") julia> Pkg.build("Merlin")
To run the Merlin examples, add
which provides an access to common machine learning datasets.
- Wrap your data with
- Apply functions to
Varmemorizes a history of functional applications for auto-differentiation.
- Compute gradients if necessary.
Here is an example of three-layer network:
using Merlin T = Float32 x = zerograd(rand(T,10,5)) # initialize Var with zero gradient y = Linear(T,10,7)(x) y = relu(y) y = Linear(T,7,3)(y) gradient!(y) println(x.grad)
If you don't need gradients of
x = Var(rand(T,10,5)).
When you apply
Var() to a function, it's lazily evaluated.
T = Float32 x = Var() y = Linear(T,10,7)(x) y = relu(y) y = Linear(T,7,3)(y) @assert y.data == nothing f = compile(y, x) # output: y, input: x x = zerograd(rand(T,10,10)) y = f(x)
compile(y, x) compiles the network structure from output variable:
y and input variable:
x, and create a
When the network structure is static, it is recommended to use this style.
More examples can be found in
Common datasets are available via MLDatasets.jl.