source URLは、deb http://ftp.riken.jp/Linux/debian/debian-archive/debian sarge main contrib non-freeを自分でedit
/etc/apt/sources.list
backportを付加。
12
deb http://ftp.riken.jp/Linux/debian/debian-archive/debian sarge main contrib non-free
deb http://archive.debian.org/backports.org/ sarge-backports main contrib non-free
$ groovy dl4j.groovy
Caught: java.lang.NoClassDefFoundError: org/bytedeco/javacpp/hdf5$Group
java.lang.NoClassDefFoundError: org/bytedeco/javacpp/hdf5$Group
at org.deeplearning4j.nn.modelimport.keras.utils.KerasModelBuilder.modelHdf5Filename(KerasModelBuilder.java:226)
at org.deeplearning4j.nn.modelimport.keras.KerasModelImport.importKerasSequentialModelAndWeights(KerasModelImport.java:194)
at org.deeplearning4j.nn.modelimport.keras.KerasModelImport$importKerasSequentialModelAndWeights.call(Unknown Source)
at dl4j.run(dl4j.groovy:17)
Caused by: java.lang.ClassNotFoundException: org.bytedeco.javacpp.hdf5$Group
... 4 more
$ groovy -cp ~/.groovy/grapes/org.bytedeco.javacpp-presets/hdf5/jars/hdf5-1.10.2-1.4.2-linux-x86_64.jar dl4j.groovy
[main] INFO org.deeplearning4j.nn.modelimport.keras.Hdf5Archive - Unexpected end-of-input: was expecting closing quote for a string value at [Source: {"config": {"name": "model_1", "input_layers": ......, "name; line: 1, column: 20001]
Caught: org.deeplearning4j.nn.modelimport.keras.exceptions.InvalidKerasConfigurationException: Model class name must be Sequential (found Model). For more information, see http://deeplearning4j.org/model-import-keras.
org.deeplearning4j.nn.modelimport.keras.exceptions.InvalidKerasConfigurationException: Model class name must be Sequential (found Model). For more information, see http://deeplearning4j.org/model-import-keras.
at org.deeplearning4j.nn.modelimport.keras.KerasSequentialModel.<init>(KerasSequentialModel.java:94)
at org.deeplearning4j.nn.modelimport.keras.KerasSequentialModel.<init>(KerasSequentialModel.java:61)
at org.deeplearning4j.nn.modelimport.keras.utils.KerasModelBuilder.buildSequential(KerasModelBuilder.java:320)
at org.deeplearning4j.nn.modelimport.keras.KerasModelImport.importKerasSequentialModelAndWeights(KerasModelImport.java:195)
at org.deeplearning4j.nn.modelimport.keras.KerasModelImport$importKerasSequentialModelAndWeights.call(Unknown Source)
at dl4j.run(dl4j.groovy:18)
$ groovy -cp ~/.groovy/grapes/org.bytedeco.javacpp-presets/hdf5/jars/hdf5-1.10.2-1.4.2-linux-x86_64.jar dl4j.groovy
[main] INFO org.deeplearning4j.nn.modelimport.keras.Hdf5Archive - Unexpected end-of-input: was expecting closing quote for a string value at [Source: {"config": {"name": "model_1", ......, "name; line: 1, column: 20001]
Caught: java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError
at org.deeplearning4j.nn.conf.dropout.Dropout.initializeHelper(Dropout.java:107)
at org.deeplearning4j.nn.conf.dropout.Dropout.<init>(Dropout.java:100)
at org.deeplearning4j.nn.conf.dropout.Dropout.<init>(Dropout.java:80)
at org.deeplearning4j.nn.conf.layers.Layer$Builder.dropOut(Layer.java:257)
at org.deeplearning4j.nn.modelimport.keras.layers.convolutional.KerasConvolution2D.<init>(KerasConvolution2D.java:101)
at org.deeplearning4j.nn.modelimport.keras.utils.KerasLayerUtils.getKerasLayerFromConfig(KerasLayerUtils.java:226)
at org.deeplearning4j.nn.modelimport.keras.KerasModel.prepareLayers(KerasModel.java:220)
at org.deeplearning4j.nn.modelimport.keras.KerasModel.<init>(KerasModel.java:166)
at org.deeplearning4j.nn.modelimport.keras.KerasModel.<init>(KerasModel.java:98)
at org.deeplearning4j.nn.modelimport.keras.utils.KerasModelBuilder.buildModel(KerasModelBuilder.java:305)
at org.deeplearning4j.nn.modelimport.keras.KerasModelImport.importKerasModelAndWeights(KerasModelImport.java:144)
at org.deeplearning4j.nn.modelimport.keras.KerasModelImport$importKerasModelAndWeights.call(Unknown Source)
at dl4j.run(dl4j.groovy:18)
Caused by: java.lang.RuntimeException: org.nd4j.linalg.factory.Nd4jBackend$NoAvailableBackendException: Please ensure that you have an nd4j backend on your classpath. Please see: http://nd4j.org/getstarted.html
at org.nd4j.linalg.factory.Nd4j.initContext(Nd4j.java:5449)
at org.nd4j.linalg.factory.Nd4j.<clinit>(Nd4j.java:213)
... 13 more
Caused by: org.nd4j.linalg.factory.Nd4jBackend$NoAvailableBackendException: Please ensure that you have an nd4j backend on your classpath. Please see: http://nd4j.org/getstarted.html
at org.nd4j.linalg.factory.Nd4jBackend.load(Nd4jBackend.java:213)
at org.nd4j.linalg.factory.Nd4j.initContext(Nd4j.java:5446)
... 14 more
$ groovy -cp ~/.groovy/grapes/org.bytedeco.javacpp-presets/hdf5/jars/hdf5-1.10.2-1.4.2-linux-x86_64.jar:/home/u-ryo/.groovy/grapes/org.nd4j/nd4j-native/jars/nd4j-native-1.0.0-beta2-linux-x86_64.jar dl4j.groovy
[main] INFO org.deeplearning4j.nn.modelimport.keras.Hdf5Archive - Unexpected end-of-input: was expecting closing quote for a string value at [Source: {"config": {"name": "model_1", ......, "name; line: 1, column: 20001]
[main] INFO org.nd4j.linalg.factory.Nd4jBackend - Loaded [CpuBackend] backend
[main] INFO org.nd4j.nativeblas.NativeOpsHolder - Number of threads used for NativeOps: 2
Caught: java.lang.UnsatisfiedLinkError: no jniopenblas_nolapack in java.library.path
java.lang.UnsatisfiedLinkError: no jniopenblas_nolapack in java.library.path
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1225)
at org.bytedeco.javacpp.Loader.load(Loader.java:983)
at org.bytedeco.javacpp.Loader.load(Loader.java:882)
at org.bytedeco.javacpp.openblas_nolapack.<clinit>(openblas_nolapack.java:10)
at org.bytedeco.javacpp.Loader.load(Loader.java:941)
at org.bytedeco.javacpp.Loader.load(Loader.java:898)
at org.bytedeco.javacpp.presets.openblas_nolapack.blas_set_num_threads(openblas_nolapack.java:189)
at org.nd4j.linalg.cpu.nativecpu.blas.CpuBlas.setMaxThreads(CpuBlas.java:136)
at org.nd4j.nativeblas.Nd4jBlas.<init>(Nd4jBlas.java:52)
at org.nd4j.linalg.cpu.nativecpu.blas.CpuBlas.<init>(CpuBlas.java:31)
at org.nd4j.linalg.cpu.nativecpu.CpuNDArrayFactory.createBlas(CpuNDArrayFactory.java:91)
at org.nd4j.linalg.factory.BaseNDArrayFactory.blas(BaseNDArrayFactory.java:72)
at org.nd4j.linalg.cpu.nativecpu.ops.NativeOpExecutioner.getEnvironmentInformation(NativeOpExecutioner.java:1236)
at org.nd4j.linalg.api.ops.executioner.DefaultOpExecutioner.printEnvironmentInformation(DefaultOpExecutioner.java:649)
at org.nd4j.linalg.factory.Nd4j.initWithBackend(Nd4j.java:5575)
at org.nd4j.linalg.factory.Nd4j.initContext(Nd4j.java:5447)
at org.nd4j.linalg.factory.Nd4j.<clinit>(Nd4j.java:213)
at org.deeplearning4j.nn.conf.dropout.Dropout.initializeHelper(Dropout.java:107)
at org.deeplearning4j.nn.conf.dropout.Dropout.<init>(Dropout.java:100)
at org.deeplearning4j.nn.conf.dropout.Dropout.<init>(Dropout.java:80)
at org.deeplearning4j.nn.conf.layers.Layer$Builder.dropOut(Layer.java:257)
at org.deeplearning4j.nn.modelimport.keras.layers.convolutional.KerasConvolution2D.<init>(KerasConvolution2D.java:101)
at org.deeplearning4j.nn.modelimport.keras.utils.KerasLayerUtils.getKerasLayerFromConfig(KerasLayerUtils.java:226)
at org.deeplearning4j.nn.modelimport.keras.KerasModel.prepareLayers(KerasModel.java:220)
at org.deeplearning4j.nn.modelimport.keras.KerasModel.<init>(KerasModel.java:166)
at org.deeplearning4j.nn.modelimport.keras.KerasModel.<init>(KerasModel.java:98)
at org.deeplearning4j.nn.modelimport.keras.utils.KerasModelBuilder.buildModel(KerasModelBuilder.java:305)
at org.deeplearning4j.nn.modelimport.keras.KerasModelImport.importKerasModelAndWeights(KerasModelImport.java:144)
at org.deeplearning4j.nn.modelimport.keras.KerasModelImport$importKerasModelAndWeights.call(Unknown Source)
at dl4j.run(dl4j.groovy:19)
Caused by: java.lang.UnsatisfiedLinkError: no openblas_nolapack in java.library.path
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1225)
at org.bytedeco.javacpp.Loader.load(Loader.java:968)
... 28 more
openblasがない? sudo apt install libopenblas-base libopenblas-devしても変わりません。 うーん。 色々探すと、libopenblas_nolapack.so.0: cannot open shared object file: No such file or directory #6132という記事があり、 「nd4j-backends」から「mkl-dnn」をexcludeしろ、とあります。 えー! nd4j-backendsはpomだけでjarないんですけど。 org.bytedeco.javacpp-presets:mkl-dnnを見てみると、 windowsのjarmkl-dnn-0.15-1.4.2-windows-x86_64.jarが落ちてきていました。 それならっていうんで、linux-x86 64版を持ってきて-cpで指定します。 ついでに、org.bytedeco.javacpp-presets:openblasというのもあって こっちにもwindows-x86 64版のjarだったので、これについてもlinux-x86 64版を 持ってきてClassPathに入れます。 するとどうでしょう、漸く動き出しました。 けれども、ヌルポで落ちます。
12345678910111213141516171819
$ groovy -cp ~/.groovy/grapes/org.bytedeco.javacpp-presets/hdf5/jars/hdf5-1.10.2-1.4.2-linux-x86_64.jar:/home/u-ryo/.groovy/grapes/org.nd4j/nd4j-native/jars/nd4j-native-1.0.0-beta2-linux-x86_64.jar:/home/u-ryo/.groovy/grapes/org.bytedeco.javacpp-presets/mkl-dnn/jars/mkl-dnn-0.15-1.4.2-linux-x86_64.jar:/home/u-ryo/.groovy/grapes/org.bytedeco.javacpp-presets/openblas/jars/openblas-0.3.0-1.4.2-linux-x86_64.jar dl4j.groovy
[main] INFO org.deeplearning4j.nn.modelimport.keras.Hdf5Archive - Unexpected end-of-input: was expecting closing quote for a string value at [Source: {"config": {"name": "model_1",......, "name; line: 1, column: 20001]
[main] INFO org.nd4j.linalg.factory.Nd4jBackend - Loaded [CpuBackend] backend
[main] INFO org.nd4j.nativeblas.NativeOpsHolder - Number of threads used for NativeOps: 2
[main] INFO org.nd4j.nativeblas.Nd4jBlas - Number of threads used for BLAS: 2
[main] INFO org.nd4j.linalg.api.ops.executioner.DefaultOpExecutioner - Backend used: [CPU]; OS: [Linux]
[main] INFO org.nd4j.linalg.api.ops.executioner.DefaultOpExecutioner - Cores: [4]; Memory: [4.3GB];
[main] INFO org.nd4j.linalg.api.ops.executioner.DefaultOpExecutioner - Blas vendor: [MKL]
{config={lr=9.999999747378752E-5, decay=0.0, momentum=0.8999999761581421, nesterov=false}, class_name=SGD}
Caught: java.lang.NullPointerException
java.lang.NullPointerException
at org.deeplearning4j.nn.modelimport.keras.utils.KerasOptimizerUtils.mapOptimizer(KerasOptimizerUtils.java:119)
at org.deeplearning4j.nn.modelimport.keras.KerasModel.importTrainingConfiguration(KerasModel.java:253)
at org.deeplearning4j.nn.modelimport.keras.KerasModel.<init>(KerasModel.java:173)
at org.deeplearning4j.nn.modelimport.keras.KerasModel.<init>(KerasModel.java:98)
at org.deeplearning4j.nn.modelimport.keras.utils.KerasModelBuilder.buildModel(KerasModelBuilder.java:305)
at org.deeplearning4j.nn.modelimport.keras.KerasModelImport.importKerasModelAndWeights(KerasModelImport.java:144)
at org.deeplearning4j.nn.modelimport.keras.KerasModelImport$importKerasModelAndWeights.call(Unknown Source)
at dl4j.run(dl4j.groovy:19)
[main] INFO org.nd4j.linalg.factory.Nd4jBackend - Loaded [CpuBackend] backend
[main] INFO org.nd4j.nativeblas.NativeOpsHolder - Number of threads used for NativeOps: 2
[main] INFO org.nd4j.nativeblas.Nd4jBlas - Number of threads used for BLAS: 2
[main] INFO org.nd4j.linalg.api.ops.executioner.DefaultOpExecutioner - Backend used: [CPU]; OS: [Linux]
[main] INFO org.nd4j.linalg.api.ops.executioner.DefaultOpExecutioner - Cores: [4]; Memory: [4.3GB];
[main] INFO org.nd4j.linalg.api.ops.executioner.DefaultOpExecutioner - Blas vendor: [MKL]
{config={lr=9.999999747378752E-5, decay=0.0, momentum=0.8999999761581421, nesterov=false}, class_name=SGD}
Caught: org.deeplearning4j.exception.DL4JInvalidConfigException: Invalid configuration for layer (idx=-1, name=block2_conv1, type=ConvolutionLayer) for width dimension: Invalid input configuration for kernel width. Require 0 < kW<=inWidth+2*padW;got(kW=3,inWidth=1,padW=0)Inputtype =InputTypeConvolutional(h=112,w=1,c=64),kernel =[3,3],strides =[1,1],padding =[0,0],layersize(outputchannels)=128,convolutionmode =Sameorg.deeplearning4j.exception.DL4JInvalidConfigException:Invalidconfigurationforlayer(idx=-1,name=block2_conv1,type=ConvolutionLayer)forwidthdimension:Invalidinputconfigurationforkernelwidth.Require0<kW<=inWidth+2*padW;got(kW=3,inWidth=1,padW=0)Inputtype =InputTypeConvolutional(h=112,w=1,c=64),kernel =[3,3],strides =[1,1],padding =[0,0],layersize(outputchannels)=128,convolutionmode =Sameatorg.deeplearning4j.nn.conf.layers.InputTypeUtil.getOutputTypeCnnLayers(InputTypeUtil.java:349)atorg.deeplearning4j.nn.conf.layers.ConvolutionLayer.getOutputType(ConvolutionLayer.java:181)atorg.deeplearning4j.nn.modelimport.keras.layers.convolutional.KerasConvolution2D.getOutputType(KerasConvolution2D.java:150)atorg.deeplearning4j.nn.modelimport.keras.KerasModel.inferOutputTypes(KerasModel.java:306)atorg.deeplearning4j.nn.modelimport.keras.KerasModel.<init>(KerasModel.java:181)
at org.deeplearning4j.nn.modelimport.keras.KerasModel.<init>(KerasModel.java:98)
at org.deeplearning4j.nn.modelimport.keras.utils.KerasModelBuilder.buildModel(KerasModelBuilder.java:305)
at org.deeplearning4j.nn.modelimport.keras.KerasModelImport.importKerasModelAndWeights(KerasModelImport.java:144)
at org.deeplearning4j.nn.modelimport.keras.KerasModelImport$importKerasModelAndWeights.call(Unknown Source)
at tt.run(tt.groovy:19)