Closed kameronren closed 3 years ago
@kameronren It looks like your model is not initialized. You won't be able to save the model before the model get trained.
But we should not throw NPE in this case.
@frankfliu my model is initialized and get trained. the ‘net’ in my code is null, so run it will throw NPE.
@kameronren Please try latest snapshot build, the NPE bug should have been fixed with PR: https://github.com/deepjavalibrary/djl/pull/1076
Please feel free to reopen this issue if you still have questions.
@frankfliu in my project, the djl version have already been 0.11.0 (the latest version ).
@kameronren the fix will be included in 0.12.0 release, you can try 0.12.0-SNAPSHOT version. We publish nightly build to maven snapshot repository
<repositories>
<repository>
<id>djl.ai</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>ai.djl</groupId>
<artifactId>bom</artifactId>
<version>0.12.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>ai.djl</groupId>
<artifactId>api</artifactId>
</dependency>
</dependencies>
@frankfliu thanks
Description
djl version: 0.11.0
I implements a ssd. when execute
net.saveParameters(os);
there will be a exception: java.lang.NullPointerException means net is null.Expected Behavior
save net's parameters into a file.param.
Error Message
java.lang.NullPointerException
How to Reproduce?
run follow code can reproduce:
File mlpParamFile = new File("mlp.param"); DataOutputStream os = new DataOutputStream(Files.newOutputStream(mlpParamFile.toPath())); net.saveParameters(os);