0

I am using deeplearning4j with JBOSS wildfly. I have placed all the modules as mentioned below in the classpath:

<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" />

I am still getting an exception 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)

Any idea what could be going on here?

GhostCat
  • 137,827
  • 25
  • 176
  • 248
Dwai
  • 119
  • 1
  • 15
  • Other users marked your question for low quality and need for improvement. I re-worded/formatted your input to make it easier to read/understand. Please review my changes to ensure they reflect your intentions. Feel free to drop me a comment in case you have further questions or feedback for me. – GhostCat Oct 01 '18 at 13:18
  • Thanks @GhostCat – Dwai Oct 01 '18 at 14:58
  • I might be wrong, but may be something related to libraries needed for linear algebra.. usually i go for openblas... just try to run nd4j examples... I feel they will throw same error. Somewhere you'll have to configure them either for native CPU or GPU.. – tired and bored dev Oct 16 '18 at 02:22

1 Answers1

0

ND4j uses ServiceLoader to find the backend. In the Wildfly to enable this, in the jboss-deployment-structure.xml mention 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> 
Milo
  • 3,365
  • 9
  • 30
  • 44