Tensors and neural networks in Haskell
Switch branches/tags
Clone or download
Latest commit dfe9b02 Dec 9, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.cabal.project.freeze move cabal files to cabal/ and expand number of project.locals Sep 19, 2018
.circleci add bump-ghc.sh Dec 1, 2018
cabal onboarding fixes - add init target to makefile, add script that creat… Nov 8, 2018
dhall @ 6ee18eb start ae experimental example, fix makefile typo #117 Nov 8, 2018
examples fix backprop regression example so it doesn't have too few batches, r… Dec 9, 2018
ffi @ d2ecfc1 sync ffi Dec 5, 2018
hasktorch add uniqueSpec to RandomSpec (tests that tensor samplers generate uni… Nov 26, 2018
indef tweaks to gp example, remove dhall-based configuration for examples d… Dec 8, 2018
signatures remove default extensions to signatures Nov 1, 2018
zoo zoo cabal updates Nov 2, 2018
.gitignore manage cabal files, ignore profiling work Sep 30, 2018
.gitmodules use public submodules Oct 27, 2018
API_DESIGN.md remove output and docs folders Jun 15, 2018
AUTHORS wip Sep 17, 2018
DEVELOPERS.md minor edit to developers.md reflecting bump to 8.4.3 Aug 14, 2018
HLint.hs remove Use head from hlint Nov 14, 2017
LICENSE add license and notice Apr 12, 2018
Makefile sync ffi Dec 5, 2018
NOTICE add license and notice Apr 12, 2018
README.md correct readme #129 Dec 9, 2018
Setup.hs initial commit Sep 8, 2017
build.nix rename hasktorch-{raw,ffi} Oct 29, 2018
cabal.project keep codegen as part of project for now to placate ci Dec 3, 2018
cabal.project.freeze sync ffi Dec 5, 2018
make_cabal_local.sh resolve compatabilility issue with `make_cabal_local.sh` mentioned in #… Nov 27, 2018
setenv remove build step from init, update path in setenv Nov 8, 2018
shell.nix add mkl nix support Oct 24, 2018

README.md

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 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.