3

I'm new to neural networks and NLP. I've found this library: DeepLearning4J. I'm trying to get it to work but whenever I execute this instruction:

Collection<String> similar = vec.wordsNearest("word_to_search", 10);

If the word I'm searching is mapped into the network I get the following exception:

java.lang.IllegalArgumentException: XERBLA: Error on argument 6 (LDA) in SGEMV
at org.jblas.NativeBlas.sgemv(Native Method)
at org.nd4j.linalg.jblas.blas.JblasLevel2.sgemv(JblasLevel2.java:25)
at org.nd4j.linalg.api.blas.impl.BaseLevel2.gemv(BaseLevel2.java:53)
at org.nd4j.linalg.api.ndarray.BaseNDArray.mmuli(BaseNDArray.java:2569)
at org.nd4j.linalg.api.ndarray.BaseNDArray.mmul(BaseNDArray.java:2377)
at org.deeplearning4j.models.embeddings.wordvectors.WordVectorsImpl.wordsNearest(WordVectorsImpl.java:290)
at org.deeplearning4j.models.embeddings.wordvectors.WordVectorsImpl.wordsNearest(WordVectorsImpl.java:337)
at word2vec.Word2VecTest.main(Word2VecTest.java:74)
Exception in thread "main" java.lang.NoSuchMethodError: org.nd4j.linalg.api.ndarray.INDArray.mean(I)Lorg/nd4j/linalg/api/ndarray/INDArray;
at org.deeplearning4j.models.embeddings.wordvectors.WordVectorsImpl.wordsNearest(WordVectorsImpl.java:283)
at word2vec.Word2VecTest.main(Word2VecTest.java:89)

I know that the NoSuchMethodError may be due to libraries different versions. In this specific case, this is probably caused by nd4j. I've checked the versions lots of time and this is what I'm importing at the moment:

  • akka-actor_2.11-2.4-M3.jar
  • akka-cluster_2.11-2.4-M3.jar
  • akka-remote_2.11-2.4-M3.jar
  • akka-slf4j_2.11-2.4-M3.jar
  • byte-buddy-0.6.15.jar
  • config-1.3.0.jar
  • deeplearning4j-core-0.0.3.3.4.alpha2.jar
  • deeplearning4j-nlp-0.0.3.3.4.alpha2.jar
  • deeplearning4j-scaleout-akka-0.0.3.3.4.alpha2.jar
  • deeplearning4j-ui-0.0.3.3.4.alpha2.jar
  • javassist-3.12.1.GA.jar
  • jblas-1.2.4.jar
  • jcublas-6.5.jar
  • lucene-analyzers-common-4.10.3.jar
  • lucene-core-4.10.3.jar
  • nd4j-api-0.4-rc3.4.jar
  • nd4j-bytebuddy-0.4-rc3.4.jar
  • nd4j-jblas-0.4-rc3.4.jar
  • nd4j-jcublas-common-0.4-rc3.4.jar
  • netty-3.10.4.Final.jar
  • protobuf-java-2.6.1.jar
  • reflections-0.9.10.jar
  • scala-library-2.12.0-M2.jar
  • selenium-server-standalone-2.47.1.jar

Can someone explain to me the problem?

1 Answer 1

4

The error is telling you that DeepLearning4J tried to call the method INDArray INDArray.mean(int value) but this method was not found.

Looking at nd4j 0.4-rc3.4 source code, you can see that the mean method actually takes a vararg int... as input. Since this is not int, the error is thrown.

This change was made by this commit when nd4j bumped version from 0.0.3.5.5.5 to 0.4-rc0.

As a result, you need to downgrade nd4j to version 0.0.3.5.5.5. With this downgrade, you will not have any more incompatibility since this is the actual version that DeepLearning4J is depending on. You can see that in the Maven dependencies of deeplearning4j-core-0.0.3.3.4.alpha2.

1
  • This was exactly the problem. After downgrading I had to fix some other dependencies but now is working fine. Funny enough I had that version originally and I don't remember why I've upgraded. I spent countless hours trying to fix it and I probably would have never figured that out without your help. Thank you very much.
    – Aurasphere
    Sep 25, 2015 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.