Go binding for Pytorch C++ API (libtorch)
gotch creates a thin wrapper to Pytorch C++ APIs (Libtorch) to make use of its already optimized C++ tensor APIs (3039) and dynamic graph computation with CUDA support and provides idiomatic Go APIs for developing and implementing Deep Learning in Go.
Some features are
gotch is in active development mode and may have API breaking changes. Feel free to pull request, report issues or discuss any concerns. All contributions are welcome.
gotch current version is v0.9.1
11.8 if CUDA is available otherwise using CPU version.2.1.0NOTE: libtorch will be installed at /usr/local/lib
wget https://github.com/sugarme/gotch/releases/download/v0.9.0/setup-libtorch.sh
chmod +x setup-libtorch.sh
export CUDA_VER=cpu && bash setup-libtorch.shUpdate Environment: in Debian/Ubuntu, add/update the following lines to .bashrc file
export GOTCH_LIBTORCH="/usr/local/lib/libtorch"
export LIBRARY_PATH="$LIBRARY_PATH:$GOTCH_LIBTORCH/lib"
export CPATH="$CPATH:$GOTCH_LIBTORCH/lib:$GOTCH_LIBTORCH/include:$GOTCH_LIBTORCH/include/torch/csrc/api/include"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$GOTCH_LIBTORCH/lib" wget https://github.com/sugarme/gotch/releases/download/v0.9.0/setup-gotch.sh
chmod +x setup-gotch.sh
export CUDA_VER=cpu && export GOTCH_VER=v0.9.1 && bash setup-gotch.shNOTE: make sure your machine has working CUDA.
nvidia-smi wget https://github.com/sugarme/gotch/releases/download/v0.9.0/setup-libtorch.sh
chmod +x setup-libtorch.sh
export CUDA_VER=11.8 && bash setup-libtorch.shUpdate Environment: in Debian/Ubuntu, add/update the following lines to .bashrc file
export GOTCH_LIBTORCH="/usr/local/lib/libtorch"
export LIBRARY_PATH="$LIBRARY_PATH:$GOTCH_LIBTORCH/lib"
export CPATH="$CPATH:$GOTCH_LIBTORCH/lib:$GOTCH_LIBTORCH/include:$GOTCH_LIBTORCH/include/torch/csrc/api/include"
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$GOTCH_LIBTORCH/lib:/usr/lib64-nvidia:/usr/local/cuda-${CUDA_VERSION}/lib64" wget https://github.com/sugarme/gotch/releases/download/v0.9.0/setup-gotch.sh
chmod +x setup-gotch.sh
export CUDA_VER=11.8 && export GOTCH_VER=v0.9.1 && bash setup-gotch.sh……gotch on Google Colab or locallygotch is Apache 2.0 licensed.
No open issues yet, or sync has not completed.