Error occurs when training spark word2vec


I’m using org.deeplearning4j.spark.models.embeddings.word2vec.Word2Vec to train word2vec, and the following errors occur

Exception in thread “main” java.lang.IllegalStateException: Cannot perform in-place operation “addi”: result array shape does not match the broadcast operation output shape: [200].addi([1, 200]) != [200].
In-place operations like x.addi(y) can only be performed when x and y have the same shape, or x and y are broadcastable with x.shape() == broadcastShape(x,y)
at org.nd4j.linalg.api.shape.Shape.assertBroadcastable(
at org.nd4j.linalg.api.ndarray.BaseNDArray.addi(
at org.nd4j.linalg.api.ndarray.BaseNDArray.addi(
at org.deeplearning4j.spark.models.embeddings.word2vec.Word2Vec.train(
at dl4jword2vec.Fun.main(

Here is my testing program, and the POM.xml is here I’m not sure if I do anything wrong. The training file “/tmp/test” is just 100 lines of “a b c d e f g h I j k”.

Thank you all in advance.

That appears to be a bug. Not many people are still using Word2Vec, and fewer still are using it on Spark.

Please report this bug on github:

Thank you! Will report it.