Comments (9)
Wow, incredible debugging skills with very little info. Adding the $JAVA_OPTS
before -jar
seems to have worked!
from java-demo.
I think anything after -jar foo.jar
is treated as an argument to your Java program. Any arguments to the JVM need to be before. Glad you got it working. Please provide feedback on the Java bindings and let us know how you're using them!
from java-demo.
Can you paste the command you are running? Did you remember to export LIBTORCH_HOME
? Did you remember to export USE_LIBTORCH_NIGHTLY=1
? Can you run ./gradlew --info run
and paste the logging output?
from java-demo.
@dreiss I'm not running the exact demo but something representative with a jar build, so the export of USE_LIBTORCH_NIGHTLY
isn't necessary. My exact command is:
java -jar MyApplication.jar -Djava.library.path=$LIBTORCH_HOME/lib
$LIBTORCH_HOME
is exported appropriately (see above find
output), and my gradle build file has the following:
dependencies {
// ...
compile 'org.pytorch:pytorch_java_only:1.5.0-SNAPSHOT'
}
def LIBTORCH_HOME = System.getenv('LIBTORCH_HOME')
applicationDefaultJvmArgs = ["-Djava.library.path=$LIBTORCH_HOME/lib"]
from java-demo.
What if you put -Djava.library.path=$LIBTORCH_HOME/lib
before -jar
on the command line?
from java-demo.
$LIBTORCH_HOME is exported appropriately (see above find output)
That find command would still work even if LIBTORCH_HOME was not exported. But your command also doesn't require it to be exported, so shrug.
from java-demo.
I'm a bit curious why the $JAVA_OPTS
need to be present in jar invocation given the build.gradle
already forces the java args in the application run, but that's likely a separate thing altogether.
from java-demo.
I'm a bit curious why the $JAVA_OPTS need to be present in jar invocation given the build.gradle already forces the java args in the application run, but that's likely a separate thing altogether.
I think applicationDefaultJvmArgs
only applies when using gradle run
.
from java-demo.
Makes perfect sense and this seems to agree with you. Thanks for the remote rubberducking!
from java-demo.
Related Issues (20)
- how to build demo with javac HOT 4
- NoSuchMethodError HOT 5
- java+libtorch version runs much slower than the python+torchscript version HOT 4
- No prob
- rem
- any instructions on how to use the downloaded libtorch in Maven project? HOT 1
- Just a question on "demo-model.pt1"
- Question on TorchScriptForJavaDemo.ipynb
- LIBTORCH_HOME not present in environment HOT 3
- Build java_only version using only cpu
- no pytorch_jni in java.library.path in linux HOT 2
- Is there a way to set the number of threads from Java API? HOT 1
- build fail HOT 1
- Windows support HOT 2
- Suggestion: Update to README saying that a libtorch pre-CXX 11 build is required (as of 1.9)?
- How to compile from command line (using javac instead of gradle)? HOT 2
- Exception in thread "main" com.facebook.jni.CppException: open file failed, file path: /tmp/model-deploy.pt HOT 1
- java.lang.UnsatisfiedLinkError: no pytorch_jni in java.library.path HOT 1
- the torch java_only-1.4.0.jar is not compatible with java 7 HOT 3
- macOS File Permission Issue at Runtime HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from java-demo.