Python extensions using tch to interact with PyTorch
In order to build the extension and test the plugin, run the following command from the root of the github repo. This requires a Python environment that has the appropriate torch version installed.
LIBTORCH_USE_PYTORCH=1 cargo build && cp -f target/debug/libtch_ext.so tch_ext.so
LIBTORCH_USE_PYTORCH results in using the libtorch C++ library from the Python install in
tch and ensures that this is at the proper version (having
tch using a different libtorch version from the one used by the Python runtime may result in segfaults).
tch based plugins can easily be used from colab (though it might be a bit slow to download all the crates and compile), see this example notebook.