Examples for the Hacker's Machine Learning Framework Leaf
Clone or download
hobofan Merge pull request #10 from autumnai/feat/features
feat/build: add feature flags
Latest commit 73e4912 Mar 9, 2016


Leaf Examples

CLI for running leaf examples. More examples and benchmark tests can be found at the leaf examples directory.

Install CLI

DISCLAIMER: Currently both CUDA and cuDNN are required for the examples to build.

Compile and call the build.

# install rust, if you need to
curl -sSf https://static.rust-lang.org/rustup.sh | sh
# download the code
git clone git@github.com:autumnai/leaf-examples.git && cd leaf-examples
# build the binary
cargo build --release
# and you should see the CLI help page
target/release/leaf-examples --help
# which means, you can run the examples from below

Note for OSX El Capitan users: openssl no longer ships with OSX by default. brew link --force openssl should fix the problem. If not, see this Github issue for more details.


The MNIST Datasets comes not shipped with this repository (it's too big), but you can load it directly via the CLI.

# download the MNIST dataset.
target/release/leaf-examples load-dataset mnist

# run the MNIST linear example
target/release/leaf-examples mnist linear --batch-size 10
# run the MNIST MLP (Multilayer Perceptron) example
target/release/leaf-examples mnist mlp --batch-size 5 --learning-rate 0.001
# run the MNIST Convolutional Neural Network example
target/release/leaf-examples mnist conv --batch-size 10 --learning-rate 0.002