Почему я получаю ошибку
java.lang.NoClassDefFoundError: org/nd4j/linalg/api/ops/impl/transforms/floating/Histogram
при попытке настроить прослушиватель как gan.setListeners(new StatsListener(statsStorage));
для такой сети
GAN (из примера кода https://github.com/wmeddie/dl4j-gans):
generator = generatorSupplier.get();
generator.init();
Layer[] genLayers = generator.getLayers();
int numGenLayers = genLayers.length;
discriminator = discriminatorSupplier.provide(updater);
discriminator.init();
MultiLayerNetwork ganDiscriminator = discriminatorSupplier.provide(UPDATER_ZERO);
ganDiscriminator.init();
Layer[] disLayers = ganDiscriminator.getLayers();
Layer[] layers = ArrayUtils.addAll(genLayers, disLayers);
MultiLayerConfiguration genConf = generator.getLayerWiseConfigurations();
MultiLayerConfiguration disConf = ganDiscriminator.getLayerWiseConfigurations();
org.deeplearning4j.nn.conf.layers.Layer[] confLayers = new org.deeplearning4j.nn.conf.layers.Layer[layers.length];
Map<Integer, InputPreProcessor> preProcessors = new HashMap<>();
for (int i = 0; i < layers.length; i++) {
confLayers[i] = layers[i].conf().getLayer();
if (i < numGenLayers) {
preProcessors.put(i, genConf.getInputPreProcess(i));
} else {
preProcessors.put(i, disConf.getInputPreProcess(i - numGenLayers));
}
}
MultiLayerConfiguration ganConf = new NeuralNetConfiguration.Builder()
.seed(seed)
.updater(updater)
.biasUpdater(biasUpdater)
.optimizationAlgo(optimizer)
.gradientNormalization(gradientNormalizer)
.gradientNormalizationThreshold(gradientNormalizationThreshold)
.activation(Activation.IDENTITY)
.trainingWorkspaceMode(trainingWorkSpaceMode)
.inferenceWorkspaceMode(inferenceWorkspaceMode)
.cacheMode(cacheMode)
.list(confLayers)
.inputPreProcessors(preProcessors)
.build();
gan = new MultiLayerNetwork(ganConf);
gan.init();
Exception in thread "main" java.lang.NoClassDefFoundError: org/nd4j/linalg/api/ops/impl/transforms/floating/Histogram
at org.deeplearning4j.ui.stats.BaseStatsListener.getHistograms(BaseStatsListener.java:766)
at org.deeplearning4j.ui.stats.BaseStatsListener.onForwardPass(BaseStatsListener.java:267)
at org.deeplearning4j.ui.stats.BaseStatsListener.onForwardPass(BaseStatsListener.java:257)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.computeGradientAndScore(MultiLayerNetwork.java:2633)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.computeGradientAndScore(MultiLayerNetwork.java:2587)
at org.deeplearning4j.optimize.solvers.BaseOptimizer.gradientAndScore(BaseOptimizer.java:160)
at org.deeplearning4j.optimize.solvers.StochasticGradientDescent.optimize(StochasticGradientDescent.java:63)
at org.deeplearning4j.optimize.Solver.optimize(Solver.java:52)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.fitHelper(MultiLayerNetwork.java:2169)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.fit(MultiLayerNetwork.java:2126)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.fit(MultiLayerNetwork.java:2194)
at io.skymind.example.GAN.fit(GAN.java:175)
at io.skymind.example.MnistSimpleGAN.main(MnistSimpleGAN.java:132)
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:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: java.lang.ClassNotFoundException: org.nd4j.linalg.api.ops.impl.transforms.floating.Histogram
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 18 more
Так что же не так и как сделать так, чтобы панель инструментов localhost: 9000 работала для этого?
И когда я пытаюсь наблюдать, скажем, только генератор, Я получаю пустые панели на локальном хосте: 9000
Версия пользовательского интерфейса в pom. xml равна
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-ui_2.10</artifactId>
<version>1.0.0-beta4</version>
</dependency>
в то время как другие зависимости были:
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-native-platform</artifactId>
<version>1.0.0-beta3</version>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-core</artifactId>
<version>1.0.0-beta3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.25</version>
</dependency>
UPD. Переключение всех на бета3 сделало эту ошибку при попытке заставить UI слушать сеть gan:
Exception in thread "main" java.lang.RuntimeException: org.nd4j.shade.jackson.databind.JsonMappingException: Type id handling not implemented for type java.lang.Object (through reference chain: org.deeplearning4j.nn.conf.MultiLayerConfiguration["inputPreProcessors"]->java.util.HashMap["0"])