j-haj / hasktorch

Tensors and neural networks in Haskell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hasktorch

Stable Status Development Status (master branch | dev branch)

Hasktorch is a library for tensors and neural networks in Haskell. It is an independent open source community project which leverages the core C libraries shared by Torch and PyTorch. This library leverages cabal new-build and backpack.

Note: This project is in early development and should only be used by contributing developers. Expect substantial changes to the library API as it evolves. Contributions and PRs are welcome (see details below).

Project Organization

Directory Description
examples/ Examples of basic usage and experimental prototypes (recommended starting point)
zoo/ Beginnings of a model zoo
hasktorch/ Reexports of the high-level interface to basic tensor creation and math operations and manages allocation/deallocation via foreign pointers
indef/ Orphan instances of the above typeclasses for the relevant backpack signatures
signatures/ Backpack signatures which line up with the generated C-FFI
types/ Memory-managed tensors and core data types that satisfy global and type-specific backpack types
ffi/ Submodule for low-level C ffi

Build Instructions

Due to the Torch Aten C++ library dependency and use of new cabal functionality with backpack, the setup process can be a bit more involved than a typical haskell library. Don't hesitate to reach out to the development team for questions or issues with getting setup (see "Contributing" below).

Currently hasktorch only supports OSX and Linux builds -- if you would like to add *BSD or Windows support, please let us know!

To get started building and testing the library:

  1. Run make init which uses the Makefile to build PyTorch's ATen library dependency.
  1. Install cabal-install > 2.2 for new-build and backpack support if it is not already installed. We would like to support stack in the future, but that is pending the completion of backpack support in stack. Note stack can still be used as an installer for a new version of cabal-install using stack install cabal-install --resolver lts-12.21.
  1. Build Hasktorch and run an example:
cabal new-build all
cabal new-run static-tensor-usage

To build without GPU support/CUDA, use:

cabal new-build all --flags=-cuda
cabal new-run static-tensor-usage --flags=-cuda

To launch a repl with a project (static-tensor-usage example here), use:

cabal new-repl static-tensor-usage

Examples to Get Started

For examples of basic end-user API usage, see statically typed tensor usage and simple linear regression using backprop.

Additional examples can be found in examples/ as well as the test modules.

Contributing

We welcome new contributors. For a rough list of outstanding items on deck (there are many places to contribute), refer to:

https://github.com/hasktorch/hasktorch/projects/1

Contact Austin Huang or Sam Stites for access to the hasktorch slack channel. You can send an email to hasktorch@gmail.com, ping us on gitter in the DataHaskell Lobby, or on twitter as @austinvhuang and @SamStites.

Thanks

Thanks to all hasktorch developers who have contributed to this community effort so far. This project is also indebted to prior work on typed functional programming for deep learning by Justin Le , Edward Yang , Huw Campbell , Kaixi Ruan , and Khanh Nguyen , as well as to the Torch and PyTorch dev teams.

About

Tensors and neural networks in Haskell

License:Other


Languages

Language:Haskell 94.3%Language:Roff 3.1%Language:Nix 1.1%Language:Makefile 0.5%Language:Dockerfile 0.4%Language:Shell 0.3%Language:Python 0.2%