From 73aa760c0f91596452c27548183851606a1f504f Mon Sep 17 00:00:00 2001 From: Alex Black Date: Mon, 20 Apr 2020 10:26:00 +1000 Subject: [PATCH] Timeouts and scala 2.12 for deeplearning4j-nlp-korean workaround (#380) * Increase default timeout on Spark tests Signed-off-by: Alex Black * #8840 disable deeplearning4j-nlp-korean module for scala 2.12 Signed-off-by: Alex Black * Fix for change-scala-versions.sh Signed-off-by: Alex Black * CUDA test fixes + more timeout issues Signed-off-by: Alex Black * More CUDA Signed-off-by: Alex Black * Small fix for cuDNN subsampling + same mode Signed-off-by: Alex Black * Flaky test fix Signed-off-by: Alex Black * Reduce memory requirements for ValidateCuDNN BN test Signed-off-by: Alex Black * Fix slow/ineffirient scalnet tests Signed-off-by: Alex Black * Increase timeouts to avoid failures if CI machines are slower than expected Signed-off-by: Alex Black * Ignore flaky test (issue #8849) and increase timeout for slow CI downloads Signed-off-by: Alex Black --- change-scala-versions.sh | 10 +++++ .../java/org/deeplearning4j/TestUtils.java | 13 +++++- .../iterator/DataSetIteratorTest.java | 2 +- .../gradientcheck/AttentionLayerTest.java | 5 +++ .../gradientcheck/BNGradientCheckTest.java | 5 +++ .../gradientcheck/CNN1DGradientCheckTest.java | 5 +++ .../gradientcheck/CNN3DGradientCheckTest.java | 5 +++ .../gradientcheck/CNNGradientCheckTest.java | 5 +++ .../CapsnetGradientCheckTest.java | 5 +++ .../gradientcheck/DropoutGradientCheck.java | 5 +++ .../GlobalPoolingGradientCheckTests.java | 5 +++ .../gradientcheck/GradientCheckTests.java | 5 +++ .../GradientCheckTestsComputationGraph.java | 5 +++ .../gradientcheck/LRNGradientCheckTests.java | 5 +++ .../gradientcheck/LSTMGradientCheckTests.java | 5 +++ .../LossFunctionGradientCheck.java | 5 +++ .../NoBiasGradientCheckTests.java | 5 +++ .../OutputLayerGradientChecks.java | 5 +++ .../gradientcheck/RnnGradientChecks.java | 5 +++ .../UtilLayerGradientChecks.java | 5 +++ .../gradientcheck/VaeGradientCheckTests.java | 5 +++ .../gradientcheck/YoloGradientCheckTests.java | 5 +++ .../TransferLearningMLNTest.java | 15 ++++--- .../org/deeplearning4j/TestDataTypes.java | 44 +++++++++---------- .../org/deeplearning4j/ValidateCuDNN.java | 25 +++++++---- .../convolution/TestConvolution.java | 31 ++++++++----- .../gradientcheck/CNNGradientCheckTest.java | 5 +++ .../gradientcheck/CuDNNGradientChecks.java | 4 ++ .../lstm/ValidateCudnnDropout.java | 5 +++ .../lstm/ValidateCudnnLSTM.java | 7 ++- .../keras/e2e/KerasModelEndToEndTest.java | 2 +- .../subsampling/SubsamplingLayer.java | 4 +- .../SparkSequenceVectorsTest.java | 6 +++ .../models/word2vec/SparkWord2VecTest.java | 6 +++ .../spark/text/BaseSparkTest.java | 5 +++ .../spark/text/TextPipelineTest.java | 5 ++- .../spark/parameterserver/BaseSparkTest.java | 6 +++ .../spark/BaseSparkKryoTest.java | 5 +++ .../deeplearning4j/spark/BaseSparkTest.java | 5 +++ .../dl4j/feedforward/IrisCSVExample.scala | 6 ++- .../dl4j/recurrent/BasicRNNExample.scala | 2 +- 41 files changed, 247 insertions(+), 61 deletions(-) diff --git a/change-scala-versions.sh b/change-scala-versions.sh index 8968abbf3..aace1b05e 100755 --- a/change-scala-versions.sh +++ b/change-scala-versions.sh @@ -88,5 +88,15 @@ find "$BASEDIR" -name 'pom.xml' -not -path '*target*' \ #Scala maven plugin, 2.11 find "$BASEDIR" -name 'pom.xml' -not -path '*target*' \ -exec bash -c "sed_i 's/\(scalaVersion>\)'$FROM_VERSION'<\/scalaVersion>/\1'$TO_VERSION'<\/scalaVersion>/g' {}" \; + +# Disable deeplearning4j-nlp-korean for scala 2.12 - see https://github.com/eclipse/deeplearning4j/issues/8840 +if [ $TO_VERSION = $SCALA_211_VERSION ]; then + #Enable + sed -i 's/ / deeplearning4j-nlp-korean<\/module>/g' deeplearning4j/deeplearning4j-nlp-parent/pom.xml +else + #Disable + sed -i 's/ deeplearning4j-nlp-korean<\/module>/ /g' deeplearning4j/deeplearning4j-nlp-parent/pom.xml +fi + echo "Done updating Scala versions."; diff --git a/deeplearning4j/deeplearning4j-core/src/test/java/org/deeplearning4j/TestUtils.java b/deeplearning4j/deeplearning4j-core/src/test/java/org/deeplearning4j/TestUtils.java index d90ce628b..d54693f73 100644 --- a/deeplearning4j/deeplearning4j-core/src/test/java/org/deeplearning4j/TestUtils.java +++ b/deeplearning4j/deeplearning4j-core/src/test/java/org/deeplearning4j/TestUtils.java @@ -31,6 +31,7 @@ import org.deeplearning4j.nn.layers.recurrent.LSTM; import org.deeplearning4j.nn.multilayer.MultiLayerNetwork; import org.deeplearning4j.util.ModelSerializer; import org.nd4j.base.Preconditions; +import org.nd4j.linalg.api.buffer.DataType; import org.nd4j.linalg.api.ndarray.INDArray; import org.nd4j.linalg.api.ops.random.impl.BernoulliDistribution; import org.nd4j.linalg.factory.Nd4j; @@ -124,12 +125,20 @@ public class TestUtils { return randomOneHot(examples, nOut, new Random(12345)); } + public static INDArray randomOneHot(DataType dataType, long examples, long nOut){ + return randomOneHot(dataType, examples, nOut, new Random(12345)); + } + public static INDArray randomOneHot(long examples, long nOut, long rngSeed){ return randomOneHot(examples, nOut, new Random(rngSeed)); } - public static INDArray randomOneHot(long examples, long nOut, Random rng){ - INDArray arr = Nd4j.create(examples, nOut); + public static INDArray randomOneHot(long examples, long nOut, Random rng) { + return randomOneHot(Nd4j.defaultFloatingPointType(), examples,nOut, rng); + } + + public static INDArray randomOneHot(DataType dataType, long examples, long nOut, Random rng){ + INDArray arr = Nd4j.create(dataType, examples, nOut); for( int i=0; i> classesToTest = new ArrayList<>(); classesToTest.add(org.deeplearning4j.nn.layers.normalization.BatchNormalization.class); @@ -185,10 +191,11 @@ public class ValidateCuDNN extends BaseDL4JTest { //Test ONLY LRN - no other CuDNN functionality (i.e., DL4J impls for everything else) Nd4j.getRandom().setSeed(12345); + int minibatch = 8; int numClasses = 10; //imageHeight,imageWidth,channels - int imageHeight = 240; - int imageWidth = 240; + int imageHeight = 48; + int imageWidth = 48; int channels = 3; IActivation activation = new ActivationIdentity(); MultiLayerConfiguration multiLayerConfiguration = new NeuralNetConfiguration.Builder() @@ -229,8 +236,8 @@ public class ValidateCuDNN extends BaseDL4JTest { MultiLayerNetwork net = new MultiLayerNetwork(multiLayerConfiguration); net.init(); - int[] fShape = new int[]{32, channels, imageHeight, imageWidth}; - int[] lShape = new int[]{32, numClasses}; + int[] fShape = new int[]{minibatch, channels, imageHeight, imageWidth}; + int[] lShape = new int[]{minibatch, numClasses}; List> classesToTest = new ArrayList<>(); classesToTest.add(org.deeplearning4j.nn.layers.normalization.LocalResponseNormalization.class); diff --git a/deeplearning4j/deeplearning4j-cuda/src/test/java/org/deeplearning4j/convolution/TestConvolution.java b/deeplearning4j/deeplearning4j-cuda/src/test/java/org/deeplearning4j/convolution/TestConvolution.java index c89532ff5..67a2958b7 100644 --- a/deeplearning4j/deeplearning4j-cuda/src/test/java/org/deeplearning4j/convolution/TestConvolution.java +++ b/deeplearning4j/deeplearning4j-cuda/src/test/java/org/deeplearning4j/convolution/TestConvolution.java @@ -70,6 +70,11 @@ public class TestConvolution extends BaseDL4JTest { @Rule public TemporaryFolder testDir = new TemporaryFolder(); + @Override + public long getTimeoutMilliseconds() { + return 240000L; + } + @Test public void testSameModeActivationSizes() { int inH = 3; @@ -117,6 +122,8 @@ public class TestConvolution extends BaseDL4JTest { for (ConvolutionMode c : cm) { for (ConvolutionLayer.AlgoMode a : new ConvolutionLayer.AlgoMode[]{ConvolutionLayer.AlgoMode.NO_WORKSPACE, ConvolutionLayer.AlgoMode.PREFER_FASTEST}) { for (boolean conv : new boolean[]{true, false}) { + String msg = c + " - " + a + " - " + (conv ? "conv" : "subsampling"); + System.out.println(msg); org.deeplearning4j.nn.conf.layers.Layer l; if (conv) { @@ -125,7 +132,9 @@ public class TestConvolution extends BaseDL4JTest { l = new SubsamplingLayer.Builder().kernelSize(4, 4).stride(2, 2).build(); } - MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder().seed(12345) + MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder() + .dataType(DataType.DOUBLE) + .seed(12345) .l2(0.0005).updater(new Sgd(0.01)).weightInit(WeightInit.XAVIER).convolutionMode(c).cudnnAlgoMode(a).list() .layer(0, l) .layer(1, new OutputLayer.Builder(LossFunctions.LossFunction.NEGATIVELOGLIKELIHOOD) @@ -159,32 +168,32 @@ public class TestConvolution extends BaseDL4JTest { throw new RuntimeException(); - INDArray in = Nd4j.rand(new int[]{1, 1, 20, 20}); //(20-4+0)/2 +1 = 9 + INDArray in = Nd4j.rand(DataType.DOUBLE, new int[]{1, 1, 20, 20}); //(20-4+0)/2 +1 = 9 INDArray outCudnn = layerCudnn.activate(in, false, LayerWorkspaceMgr.noWorkspaces()); INDArray outStd = layerStandard.activate(in, false, LayerWorkspaceMgr.noWorkspaces()); - assertEquals(outStd, outCudnn); + assertEquals(msg, outStd, outCudnn); //Check backprop: - INDArray epsilon = Nd4j.rand(outStd.shape()); - Pair pCudnn = layerCudnn.backpropGradient(epsilon, LayerWorkspaceMgr.noWorkspaces()); - Pair pStd = layerStandard.backpropGradient(epsilon, LayerWorkspaceMgr.noWorkspaces()); + INDArray epsilon = Nd4j.rand(DataType.DOUBLE, outStd.shape()); + Pair pCudnn = layerCudnn.backpropGradient(epsilon.dup(), LayerWorkspaceMgr.noWorkspaces()); + Pair pStd = layerStandard.backpropGradient(epsilon.dup(), LayerWorkspaceMgr.noWorkspaces()); - System.out.println(Arrays.toString(pStd.getSecond().data().asFloat())); - System.out.println(Arrays.toString(pCudnn.getSecond().data().asFloat())); +// System.out.println(Arrays.toString(pStd.getSecond().data().asFloat())); +// System.out.println(Arrays.toString(pCudnn.getSecond().data().asFloat())); INDArray epsOutStd = pStd.getSecond(); INDArray epsOutCudnn = pCudnn.getSecond(); - assertTrue(epsOutStd.equalsWithEps(epsOutCudnn, 1e-4)); + assertTrue(msg, epsOutStd.equalsWithEps(epsOutCudnn, 1e-4)); if (conv) { INDArray gradStd = pStd.getFirst().gradient(); INDArray gradCudnn = pCudnn.getFirst().gradient(); - assertTrue(gradStd.equalsWithEps(gradCudnn, 1e-4)); + assertTrue(msg, gradStd.equalsWithEps(gradCudnn, 1e-4)); } } } @@ -192,7 +201,7 @@ public class TestConvolution extends BaseDL4JTest { } - @Test @Ignore //AB 2019/05/21 - Ignored to get master passing - issue logged here: https://github.com/deeplearning4j/deeplearning4j/issues/7766 + @Test public void validateXceptionImport() throws Exception { File dir = testDir.newFolder(); File fSource = Resources.asFile("modelimport/keras/examples/xception/xception_tf_keras_2.h5"); diff --git a/deeplearning4j/deeplearning4j-cuda/src/test/java/org/deeplearning4j/gradientcheck/CNNGradientCheckTest.java b/deeplearning4j/deeplearning4j-cuda/src/test/java/org/deeplearning4j/gradientcheck/CNNGradientCheckTest.java index 1b8c42e14..eb06a70ae 100644 --- a/deeplearning4j/deeplearning4j-cuda/src/test/java/org/deeplearning4j/gradientcheck/CNNGradientCheckTest.java +++ b/deeplearning4j/deeplearning4j-cuda/src/test/java/org/deeplearning4j/gradientcheck/CNNGradientCheckTest.java @@ -61,6 +61,11 @@ public class CNNGradientCheckTest extends BaseDL4JTest { Nd4j.setDataType(DataType.DOUBLE); } + @Override + public long getTimeoutMilliseconds() { + return 180000L; + } + @Test public void testGradientCNNMLN() { //Parameterized test, testing combinations of: diff --git a/deeplearning4j/deeplearning4j-cuda/src/test/java/org/deeplearning4j/gradientcheck/CuDNNGradientChecks.java b/deeplearning4j/deeplearning4j-cuda/src/test/java/org/deeplearning4j/gradientcheck/CuDNNGradientChecks.java index 9e43f042b..a2ab8236f 100644 --- a/deeplearning4j/deeplearning4j-cuda/src/test/java/org/deeplearning4j/gradientcheck/CuDNNGradientChecks.java +++ b/deeplearning4j/deeplearning4j-cuda/src/test/java/org/deeplearning4j/gradientcheck/CuDNNGradientChecks.java @@ -77,6 +77,10 @@ public class CuDNNGradientChecks extends BaseDL4JTest { DataTypeUtil.setDTypeForContext(DataType.DOUBLE); } + @Override + public long getTimeoutMilliseconds() { + return 180000L; + } @Test public void testConvolutional() throws Exception { diff --git a/deeplearning4j/deeplearning4j-cuda/src/test/java/org/deeplearning4j/lstm/ValidateCudnnDropout.java b/deeplearning4j/deeplearning4j-cuda/src/test/java/org/deeplearning4j/lstm/ValidateCudnnDropout.java index 3edf564b5..c46bb99d9 100644 --- a/deeplearning4j/deeplearning4j-cuda/src/test/java/org/deeplearning4j/lstm/ValidateCudnnDropout.java +++ b/deeplearning4j/deeplearning4j-cuda/src/test/java/org/deeplearning4j/lstm/ValidateCudnnDropout.java @@ -30,6 +30,11 @@ import static org.junit.Assert.assertTrue; public class ValidateCudnnDropout extends BaseDL4JTest { + @Override + public long getTimeoutMilliseconds() { + return 180000L; + } + @Test public void testCudnnDropoutSimple() { for (int[] shape : new int[][]{{10, 10}, {5, 2, 5, 2}}) { diff --git a/deeplearning4j/deeplearning4j-cuda/src/test/java/org/deeplearning4j/lstm/ValidateCudnnLSTM.java b/deeplearning4j/deeplearning4j-cuda/src/test/java/org/deeplearning4j/lstm/ValidateCudnnLSTM.java index 08b57aa65..6bbb934a5 100644 --- a/deeplearning4j/deeplearning4j-cuda/src/test/java/org/deeplearning4j/lstm/ValidateCudnnLSTM.java +++ b/deeplearning4j/deeplearning4j-cuda/src/test/java/org/deeplearning4j/lstm/ValidateCudnnLSTM.java @@ -46,6 +46,11 @@ import static org.junit.Assert.*; */ public class ValidateCudnnLSTM extends BaseDL4JTest { + @Override + public long getTimeoutMilliseconds() { + return 180000L; + } + @Test public void validateImplSimple() throws Exception { @@ -109,7 +114,7 @@ public class ValidateCudnnLSTM extends BaseDL4JTest { mln1.computeGradientAndScore(); mln2.computeGradientAndScore(); - assertEquals(mln1.score(), mln2.score(), 1e-8); + assertEquals(mln1.score(), mln2.score(), 1e-5); Gradient g1 = mln1.gradient(); Gradient g2 = mln2.gradient(); diff --git a/deeplearning4j/deeplearning4j-modelimport/src/test/java/org/deeplearning4j/nn/modelimport/keras/e2e/KerasModelEndToEndTest.java b/deeplearning4j/deeplearning4j-modelimport/src/test/java/org/deeplearning4j/nn/modelimport/keras/e2e/KerasModelEndToEndTest.java index 7538d39bc..3e1efa365 100644 --- a/deeplearning4j/deeplearning4j-modelimport/src/test/java/org/deeplearning4j/nn/modelimport/keras/e2e/KerasModelEndToEndTest.java +++ b/deeplearning4j/deeplearning4j-modelimport/src/test/java/org/deeplearning4j/nn/modelimport/keras/e2e/KerasModelEndToEndTest.java @@ -98,7 +98,7 @@ public class KerasModelEndToEndTest extends BaseDL4JTest { @Override public long getTimeoutMilliseconds() { - return 90000L; + return 180000L; //Most benchmarks should run very quickly; large timeout is to avoid issues with unusually slow download of test resources } @Test(expected = IllegalStateException.class) diff --git a/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/convolution/subsampling/SubsamplingLayer.java b/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/convolution/subsampling/SubsamplingLayer.java index b3a7a3c12..b38945e95 100644 --- a/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/convolution/subsampling/SubsamplingLayer.java +++ b/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/convolution/subsampling/SubsamplingLayer.java @@ -116,10 +116,10 @@ public class SubsamplingLayer extends AbstractLayer> sequencesCyclic; private JavaSparkContext sc; diff --git a/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-nlp-java8/src/test/java/org/deeplearning4j/spark/models/word2vec/SparkWord2VecTest.java b/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-nlp-java8/src/test/java/org/deeplearning4j/spark/models/word2vec/SparkWord2VecTest.java index f3b3f974a..a7bdfd45b 100644 --- a/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-nlp-java8/src/test/java/org/deeplearning4j/spark/models/word2vec/SparkWord2VecTest.java +++ b/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-nlp-java8/src/test/java/org/deeplearning4j/spark/models/word2vec/SparkWord2VecTest.java @@ -48,6 +48,12 @@ import static org.junit.Assert.*; * @author raver119@gmail.com */ public class SparkWord2VecTest extends BaseDL4JTest { + + @Override + public long getTimeoutMilliseconds() { + return 120000L; + } + private static List sentences; private JavaSparkContext sc; diff --git a/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-nlp/src/test/java/org/deeplearning4j/spark/text/BaseSparkTest.java b/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-nlp/src/test/java/org/deeplearning4j/spark/text/BaseSparkTest.java index 475572edd..af39a474c 100644 --- a/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-nlp/src/test/java/org/deeplearning4j/spark/text/BaseSparkTest.java +++ b/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-nlp/src/test/java/org/deeplearning4j/spark/text/BaseSparkTest.java @@ -34,6 +34,11 @@ import java.util.Map; public abstract class BaseSparkTest extends BaseDL4JTest implements Serializable { protected transient JavaSparkContext sc; + @Override + public long getTimeoutMilliseconds() { + return 120000L; + } + @Before public void before() throws Exception { sc = getContext(); diff --git a/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-nlp/src/test/java/org/deeplearning4j/spark/text/TextPipelineTest.java b/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-nlp/src/test/java/org/deeplearning4j/spark/text/TextPipelineTest.java index 63c84de7d..9e5ad1d67 100644 --- a/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-nlp/src/test/java/org/deeplearning4j/spark/text/TextPipelineTest.java +++ b/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-nlp/src/test/java/org/deeplearning4j/spark/text/TextPipelineTest.java @@ -31,6 +31,7 @@ import org.deeplearning4j.spark.text.functions.CountCumSum; import org.deeplearning4j.spark.text.functions.TextPipeline; import org.deeplearning4j.text.stopwords.StopWords; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.nd4j.linalg.api.ndarray.INDArray; import org.nd4j.linalg.primitives.Counter; @@ -350,7 +351,7 @@ public class TextPipelineTest extends BaseSparkTest { * * @throws Exception */ - @Test + @Test @Ignore //AB 2020/04/19 https://github.com/eclipse/deeplearning4j/issues/8849 public void testZipFunction1() throws Exception { JavaSparkContext sc = getContext(); JavaRDD corpusRDD = getCorpusRDD(sc); @@ -388,7 +389,7 @@ public class TextPipelineTest extends BaseSparkTest { sc.stop(); } - @Test + @Test @Ignore //AB 2020/04/19 https://github.com/eclipse/deeplearning4j/issues/8849 public void testZipFunction2() throws Exception { JavaSparkContext sc = getContext(); JavaRDD corpusRDD = getCorpusRDD(sc); diff --git a/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-parameterserver/src/test/java/org/deeplearning4j/spark/parameterserver/BaseSparkTest.java b/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-parameterserver/src/test/java/org/deeplearning4j/spark/parameterserver/BaseSparkTest.java index 50aa564c1..9a28fe351 100644 --- a/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-parameterserver/src/test/java/org/deeplearning4j/spark/parameterserver/BaseSparkTest.java +++ b/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-parameterserver/src/test/java/org/deeplearning4j/spark/parameterserver/BaseSparkTest.java @@ -53,6 +53,12 @@ public abstract class BaseSparkTest extends BaseDL4JTest implements Serializable protected transient DataSet data; protected transient JavaRDD sparkData; + + @Override + public long getTimeoutMilliseconds() { + return 120000L; + } + @Before public void before() { diff --git a/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/test/java/org/deeplearning4j/spark/BaseSparkKryoTest.java b/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/test/java/org/deeplearning4j/spark/BaseSparkKryoTest.java index 42fa57a37..f7b4da172 100644 --- a/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/test/java/org/deeplearning4j/spark/BaseSparkKryoTest.java +++ b/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/test/java/org/deeplearning4j/spark/BaseSparkKryoTest.java @@ -28,6 +28,11 @@ import java.util.Map; */ public class BaseSparkKryoTest extends BaseSparkTest { + @Override + public long getTimeoutMilliseconds() { + return 120000L; + } + @Override public JavaSparkContext getContext() { if (sc != null) { diff --git a/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/test/java/org/deeplearning4j/spark/BaseSparkTest.java b/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/test/java/org/deeplearning4j/spark/BaseSparkTest.java index 3d1a9755a..be78ec7cd 100644 --- a/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/test/java/org/deeplearning4j/spark/BaseSparkTest.java +++ b/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/test/java/org/deeplearning4j/spark/BaseSparkTest.java @@ -55,6 +55,11 @@ public abstract class BaseSparkTest extends BaseDL4JTest implements Serializable protected transient DataSet data; protected transient JavaRDD sparkData; + @Override + public long getTimeoutMilliseconds() { + return 120000L; + } + @Before public void before() { diff --git a/scalnet/src/test/scala/org/deeplearning4j/scalnet/examples/dl4j/feedforward/IrisCSVExample.scala b/scalnet/src/test/scala/org/deeplearning4j/scalnet/examples/dl4j/feedforward/IrisCSVExample.scala index 3363c8a29..5f6670364 100644 --- a/scalnet/src/test/scala/org/deeplearning4j/scalnet/examples/dl4j/feedforward/IrisCSVExample.scala +++ b/scalnet/src/test/scala/org/deeplearning4j/scalnet/examples/dl4j/feedforward/IrisCSVExample.scala @@ -21,6 +21,7 @@ import org.datavec.api.records.reader.impl.csv.CSVRecordReader import org.datavec.api.split.FileSplit import org.deeplearning4j.datasets.datavec.RecordReaderDataSetIterator import org.deeplearning4j.datasets.iterator.impl.ListDataSetIterator +import org.deeplearning4j.nn.conf.Updater import org.deeplearning4j.optimize.listeners.ScoreIterationListener import org.deeplearning4j.scalnet.layers.core.Dense import org.deeplearning4j.scalnet.logging.Logging @@ -29,6 +30,7 @@ import org.nd4j.linalg.activations.Activation import org.nd4j.linalg.dataset.api.iterator.DataSetIterator import org.nd4j.linalg.dataset.{ DataSet, SplitTestAndTrain } import org.nd4j.linalg.io.ClassPathResource +import org.nd4j.linalg.learning.config.Adam import org.nd4j.linalg.lossfunctions.LossFunctions.LossFunction object IrisCSVExample extends App with Logging { @@ -41,7 +43,7 @@ object IrisCSVExample extends App with Logging { val hiddenSize = 128 val inputSize = 4 val outputSize = 3 - val epochs = 1000 + val epochs = 20 val scoreFrequency = 5 val seed = 1234 @@ -64,7 +66,7 @@ object IrisCSVExample extends App with Logging { model.add(Dense(nOut = hiddenSize, activation = Activation.RELU)) model.add(Dense(nOut = hiddenSize, activation = Activation.RELU)) model.add(Dense(outputSize, activation = Activation.SOFTMAX)) - model.compile(LossFunction.MCXENT) + model.compile(LossFunction.MCXENT, updater = Updater.ADAM) logger.info("Train model...") model.fit(training_data, epochs, List(new ScoreIterationListener(scoreFrequency))) diff --git a/scalnet/src/test/scala/org/deeplearning4j/scalnet/examples/dl4j/recurrent/BasicRNNExample.scala b/scalnet/src/test/scala/org/deeplearning4j/scalnet/examples/dl4j/recurrent/BasicRNNExample.scala index 605ce1e56..dc2b418f1 100644 --- a/scalnet/src/test/scala/org/deeplearning4j/scalnet/examples/dl4j/recurrent/BasicRNNExample.scala +++ b/scalnet/src/test/scala/org/deeplearning4j/scalnet/examples/dl4j/recurrent/BasicRNNExample.scala @@ -34,7 +34,7 @@ object BasicRNNExample extends App with Logging { val learningString = "*Der Cottbuser Postkutscher putzt den Cottbuser Postkutschkasten.".toVector val learningChars = learningString.distinct val hiddenSize = 64 - val epochs = 200 + val epochs = 20 val seed = 1234 val rand = new Random(seed)