Differential Programming in JavaScript.
Linux & Mac | Windows |
---|---|
Propel is under heavy development and its API, sadly, is subject to change. We do intend to make a Promise of Compatibility in in the future; but it can't be done yet.
Please have a look at our example neural network here https://github.com/propelml/propel/blob/master/example.ts
Also the documentation has many examples: http://propelml.org/docs
./tools/build.js
ts-node ./example.ts
(Our example program is in TypeScript because it is used in our
tests, however the example can be easily modified to work with normal
JavaScript. ts-node
is a simple wrapper around node
for executing
TypeScript files, it can be installed with npm install -g ts-node
)
If you're on Linux and would like to build a CUDA version of
Propel set the environmental variable PROPEL_BUILD_GPU=1
.
PROPEL_BUILD_GPU=1 ./tools/build.js
npm packages are built with ./tools/package.js
. Here are links
to the various packages:
https://www.npmjs.com/package/propel
https://www.npmjs.com/package/propel_linux
https://www.npmjs.com/package/propel_linux_gpu
https://www.npmjs.com/package/propel_mac
https://www.npmjs.com/package/propel_windows
Check out Propel, including its git submodules.
git clone --recursive https://github.com/propelml/propel.git
Propel generally bundles its dependencies in the "deps" submodule.
To run the complete test suite:
./tools/presubmit.js
One unincluded dependency is a chromium binary for running tests. If puppeteer complains that chromium hasn't been downloaded, run:
npm rebuild puppeteer
Most of the tests are run on every pull request, however there are three sets of tests which currently must be run manually:
-
Check that tests pass on a Linux machine with CUDA. Run this command:
PROPEL_BUILD_GPU=1 ./tools/presubmit.js
-
Check that the WebGL backend works. (Puppeteer headless doesn't support WebGL.) Run this command:
PP_TEST_DEBUG=1 ts-node tools/test_browser.ts
-
Check that the DeepLearn tests run. (These tests also require WebGL) Run this command:
PP_TEST_DL=1 ts-node tools/test_browser.ts
Propel has two major components:
-
the core framework, located in
src/
, and -
the website, located in
website/
.
Due to the notebook and documentation, the website is fairly non-trivial. It is written in React (actually Preact), but does not use JSX.
When working on the website, it's often nice to run a dev server
./tools/dev_website.js
This will automatically rebuild the website on any scss or javascript changes.
To run the website tests, point your browser to http://localhost:8080/static/test.html#script=/test_website.js
To build the production website, ./tools/render_website.js prod
must be run.
Propel is under heavy development and is missing implementations for many common ops. Here is a rough outline of how to add an op
-
Add the frontend implementation to
api.ts
ortensor.ts
(depending on if its a method of Tensor or a standalone function) -
Add the op's signature to the
BackendOps
interface intypes.ts
. -
Add the forward and backwards passes to
ops.ts
. -
Finally implement the op for DL and TF in
dl.ts
andtf.ts
respectively. -
Add a test demonstrating the desired behavior in
src/api_test.ts
. The tensorflow binding can be built using./tools/build_binding.js
and the test can be run by doingts-node src/api_test.ts MyTest
. The DL test can be run by setting an environmental variable:PROPEL=dl ts-node src/api_test.ts MyTest