0

我正在将 deeplearning4j 与 JBOSS wildfly 一起使用。我已将下面提到的所有模块放在类路径中:

<module name="org.nd4j.jackson" />
<module name="org.nd4j.nd4j-api" />
<module name="org.nd4j.nd4j-context" />
<module name="org.nd4j.nd4j-common" />
<module name="org.nd4j.nd4j-cuda-92" />
<module name="org.nd4j.nd4j-cuda-92-platform" />
<module name="org.nd4j.nd4j-native" />
<module name="org.nd4j.nd4j-native-api" />
<module name="org.nd4j.nd4j-native-platform" />
<module name="org.bytedeco.javacpp" />
<module name="org.bytedeco.javacpp-presets.cuda" />
<module name="org.bytedeco.javacpp-presets.cuda-platform" />
<module name="org.bytedeco.javacpp-presets.mkl" />
<module name="org.bytedeco.javacpp-presets.openblas" />
<module name="org.bytedeco.javacv" />
<module name="org.datavec.datavec-api" />
<module name="org.deeplearning4j.deeplearning4j-core" />
<module name="org.deeplearning4j.deeplearning4j-nlp" />
<module name="org.deeplearning4j.deeplearning4j-nn" />

我仍然收到异常 java.lang.RuntimeException:

org.nd4j.linalg.factory.Nd4jBackend$NoAvailableBackendException: Please ensure that you have an nd4j backend on your classpath. Please see: http://nd4j.org/getstarted.html
at org.nd4j.linalg.factory.Nd4j.initContext(Nd4j.java:5449)
while executing the below line of code, basically where I read the model
org.deeplearning4j.models.embeddings.loader.WordVectorSerializer.readWord2Vec(WordVectorSerializer.java:787)

知道这里会发生什么吗?

4

1 回答 1

0

ND4j 用于ServiceLoader查找后端。在 Wildfly 中启用此功能,在jboss-deployment-structure.xml中提及services="import"

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">  
  <deployment>  
    <dependencies>  
      <module name="module.name" services="import"/>  
    </dependencies>  
  </deployment>    
</jboss-deployment-structure> 
于 2019-11-25T14:20:47.983 回答