Skip to content

Instantly share code, notes, and snippets.

View bikashg's full-sized avatar

Bikash Gyawali bikashg

  • Spencer Group
  • Hull
View GitHub Profile
Exception in thread "main" java.lang.IllegalStateException: Cannot do backward pass: all epsilons not set
at org.deeplearning4j.nn.graph.vertex.impl.LayerVertex.doBackward(LayerVertex.java:98)
at org.deeplearning4j.nn.graph.ComputationGraph.calcBackpropGradients(ComputationGraph.java:1203)
at org.deeplearning4j.nn.graph.ComputationGraph.computeGradientAndScore(ComputationGraph.java:969)
at org.deeplearning4j.optimize.solvers.BaseOptimizer.gradientAndScore(BaseOptimizer.java:151)
at org.deeplearning4j.optimize.solvers.StochasticGradientDescent.optimize(StochasticGradientDescent.java:54)
at org.deeplearning4j.optimize.Solver.optimize(Solver.java:51)
at org.deeplearning4j.nn.graph.ComputationGraph.fit(ComputationGraph.java:833)
at org.deeplearning4j.nn.graph.ComputationGraph.fit(ComputationGraph.java:740)
at My_Examples.RNN.Seq2Seq.LSTM.NL2OWL.main(NL2OWL.java:212)
ComputationGraphConfiguration configuration = new NeuralNetConfiguration.Builder()
.weightInit(WeightInit.XAVIER)
.learningRate(0.25)
.updater(Updater.RMSPROP)
.optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT).iterations(1) // Nb. of iterations = 1
.seed(123)
.graphBuilder()
//These are the names of the two inputs to the computation graph.
.addInputs("nlPhrase", "owlAxiom")
.setInputTypes(InputType.recurrent(vocab.size()), InputType.recurrent(vocab.size())) // The size of the vocab.
MultiDataSetIterator iterator;
RecordReaderMultiDataSetIterator.Builder datasetBuilder = new RecordReaderMultiDataSetIterator.Builder(miniBatchSize)
.addReader("encoderInput", encoder_input_reader)
.addReader("decoderInput", decoder_input_Reader)
.addReader("decoderOutput", decoder_output_Reader);
datasetBuilder.addInputOneHot("encoderInput", 0, vocab_size);
datasetBuilder.addInputOneHot("decoderInput", 0, vocab_size);
datasetBuilder.addOutputOneHot("decoderOutput", 0, vocab_size);
public static void main(String[] args) throws IOException, InterruptedException {
int vocab_size = 14; // I set it manually here
String datasetBaseDir = "x_DataSet";
int numLinesToSkip = 1; // I used the first line in input/output files to place my own comment; so don't want to read it.
String fileDelimiter = ","; // All my input/output timesteps are single values for now.
int minCountExamples = 0;
int maxCountExamples = 1; // For now, saying that we have only 2 examples.
21:41:35.355 [Thread-261] WARN org.nd4j.jita.allocator.context.impl.LimitedContextPool - Can't allocate new context, sleeping...
21:41:38.984 [Thread-261] WARN org.nd4j.jita.allocator.context.impl.LimitedContextPool - Can't allocate new context, sleeping...
21:41:42.706 [Thread-261] WARN org.nd4j.jita.allocator.context.impl.LimitedContextPool - Can't allocate new context, sleeping...
21:41:46.377 [Thread-261] WARN org.nd4j.jita.allocator.context.impl.LimitedContextPool - Can't allocate new context, sleeping...
21:41:50.107 [Thread-261] WARN org.nd4j.jita.allocator.context.impl.LimitedContextPool - Can't allocate new context, sleeping...
21:41:53.820 [Thread-261] WARN org.nd4j.jita.allocator.context.impl.LimitedContextPool - Can't allocate new context, sleeping...
21:41:57.583 [Thread-261] WARN org.nd4j.jita.allocator.context.impl.LimitedContextPool - Can't allocate new context, sleeping...
21:42:01.345 [Thread-261] WARN org.nd4j.jita.allocator.context.impl.LimitedContextPool - Can't allocate new context, slee
ArrayList<Thread> myThreads = new ArrayList<Thread>();
for each epoch {
net.fit(trainSplitDataSetIterator);
Thread t = new Thread(new MYClass(net)); // The MYClass will use net to calculate some scores; it doesn't modify/update net
myThreads.add(t);
t.start();
}
for (Thread t:myThreads) {
t.join();
ArrayList<Thread> myThreads = new ArrayList<Thread>();
for each epoch {
net.fit(trainSplitDataSetIterator);
Thread t = new Thread(new MYClass(net)); // The MYClass will use net to calculate some scores; it doesn't modify/update net
myThreads.add(t);
t.start();
}
for (Thread t:myThreads) {
t.join();
ArrayList<Thread> myThreads = new ArrayList<Thread>();
for each epoch {
net.fit(trainSplitDataSetIterator);
Thread t = new Thread(new MYClass(net)); // The MYClass will use net to calculate some scores; it doesn't modify/update net
myThreads.add(t);
t.start();
}
for (Thread t:myThreads) {
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>bikash</groupId>
<artifactId>MYExamples</artifactId>
<version>0.1-SNAPSHOT</version>