Skip to content

kwalcock/torchscript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

torchscript

To run the Python programs, it should suffice to install the Python distribution of PyTorch from pytorch.org. Choose, for example, the stable build, your operating system, Conda or Pip, Python, and CPU. It appears that setting the LD_LIBRARY_PATH as described in the next paragraph will interfere with Python operations, so avoid it or turn it off for the Python programs.

To run the Java or Scala programs, you need to have the libraries installed and accessible. At pytorch.org choose, for example, the stable build, your operating system, LibTorch, C++/Java, and CPU. Download the packange and unzip the file on your hard drive.

  • Linux

    Make sure the LD_LIBRARY_PATH environment variable includes the the lib directory of the unzipped package, such as /home/you/libtorch/lib. The operating system will use this to load *.so files and Java borrows it to set the value of java.library.path.

    $ export LD_LIBRARY_PATH=/home/you/libtorch/lib`
  • Windows

    Make sure the PATH environment variable includes the lib directory of the unzipped package, such as D:\Users\you\libtorch\lib. The operating system will use this to load *.dll files and Java borrows it to set the value of java.library.path.

    For the regular command prompt it might look like

    > set PATH=D:\Users\you\libtorch\lib;%PATH%

    and for PowerShell like this:

    PS> $env:PATH="D:\Users\you\libtorch\lib;" + $env:PATH
  • Mac

    This is problematic. Java apparently and maybe officially does not have access to the LD_LIBRARY_PATH or DYLD_LIBRARY_PATH variables and cannot use them to build java.library.path or use them in sbt so that a torchscript program will run from there. The operating system uses the variables to find the *.dylib files and Java borrows them to set the value of java.library.path. So far the only way the example program has worked is by being called directly from Java after sbt dist with all the aforementioned variables having been set manually.

    $ export LD_LIBRARY_PATH=/home/you/libtorch/lib
    $ export DYLD_LIBRARY_PATH=/home/you/libtorch/lib
    $ java -Djava.library.path=/home/you/libtorch/lib ...

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published