This repo is a reproduction of Jianling's implementation of a neural net in pytorch using jank's seamless C++ interop.
Clone the project and fetch all the git submodules.
git submodule update --recursive --initCurrently the build setup only works for MacOS.
To get libtorch on other OS's you can get it directly from the PyTorch website by selecting the following options:
- PyTorch Build: Stable.
- Your OS.
- Package: LibTorch.
- Language: C++.
- Compute platform: Default (Auto-selected).
And then running the command displayed on their site.
NOTE: If you get libtorch from their site instead of building it locally the
Makefilevariables will need to be updated to point to the new installation.
Setup pytorch by running the following commands:
cd third-party/pytorch
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -r requirements.txt
python3 -m pip install -r requirements-build.txt
# The python venv needs to be active and the root of the project needs to be the current working directory.
cd ../..
./bin/install_libtorch.shDownload the sample data for training from here and place it in the data folder.
make test-setupmake runmake repl