Skip to content

Issue executing GenerateTxtCharCompGraphModel.java #1063

@gregbarton

Description

@gregbarton

Issue Description

The GenerateTxtCharCompGraphModel example seems to be broken. After getting around the missing input data ("java.io.IOException: Server returned HTTP response code: 403 for URL: https://s3.amazonaws.com/dl4j-distribution/pg100.txt", changed url to https://www.gutenberg.org/cache/epub/100/pg100.txt to fix), the ComputationGraphConfiguration appears to be misconfigured. Running the example results in the following error:

java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:293)
    at java.lang.Thread.run (Thread.java:750)
Caused by: java.lang.IllegalStateException: Sequence lengths do not match for RnnOutputLayer input and labels:Arrays should be rank 3 with shape [minibatch, size, sequenceLength] - mismatch on dimension 2 (sequence length) - input=[32, 400, 50] vs. label=[32, 77, 50]
    at org.nd4j.common.base.Preconditions.throwStateEx (Preconditions.java:639)
    at org.nd4j.common.base.Preconditions.checkState (Preconditions.java:337)
    at org.deeplearning4j.nn.layers.recurrent.RnnOutputLayer.backpropGradient (RnnOutputLayer.java:59)
    at org.deeplearning4j.nn.graph.vertex.impl.LayerVertex.doBackward (LayerVertex.java:148)
    at org.deeplearning4j.nn.graph.ComputationGraph.calcBackpropGradients (ComputationGraph.java:2776)
    at org.deeplearning4j.nn.graph.ComputationGraph.computeGradientAndScore (ComputationGraph.java:1385)
    at org.deeplearning4j.nn.graph.ComputationGraph.computeGradientAndScore (ComputationGraph.java:1345)
    at org.deeplearning4j.optimize.solvers.BaseOptimizer.gradientAndScore (BaseOptimizer.java:174)
    at org.deeplearning4j.optimize.solvers.StochasticGradientDescent.optimize (StochasticGradientDescent.java:61)
    at org.deeplearning4j.optimize.Solver.optimize (Solver.java:52)
    at org.deeplearning4j.nn.graph.ComputationGraph.doTruncatedBPTT (ComputationGraph.java:3739)
    at org.deeplearning4j.nn.graph.ComputationGraph.fitHelper (ComputationGraph.java:1160)
    at org.deeplearning4j.nn.graph.ComputationGraph.fit (ComputationGraph.java:1119)
    at org.deeplearning4j.nn.graph.ComputationGraph.fit (ComputationGraph.java:1106)
    at org.deeplearning4j.nn.graph.ComputationGraph.fit (ComputationGraph.java:988)
    at org.deeplearning4j.examples.advanced.modelling.charmodelling.generatetext.GenerateTxtCharCompGraphModel.main (GenerateTxtCharCompGraphModel.java:116)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:293)
    at java.lang.Thread.run (Thread.java:750)

Input size to "outputLayer" is correctly set to 2*lstmLayerSize, and the output sizes of both layers flowing to "outputLayer" are lstmLayerSize each. This appears to be the correct configuration. But the network seems to be expecting the input size (i.e. "iter.inputColumns()") at that point.

How can this be fixed?

Version Information

Please indicate relevant versions, including, if relevant:

  • Deeplearning4j version - 1.0.0-M2
  • platform information - MacOS x86

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions