Skip to content

Instantly share code, notes, and snippets.

@basedrhys
Created March 18, 2020 23:48
Show Gist options
  • Save basedrhys/126df008803ccac81a61f94ea2b1d16d to your computer and use it in GitHub Desktop.
Save basedrhys/126df008803ccac81a61f94ea2b1d16d to your computer and use it in GitHub Desktop.
java.lang.RuntimeException: Error deserializing JSON ComputationGraphConfiguration. Saved model JSON is not a valid ComputationGraphConfiguration
at org.deeplearning4j.util.ModelSerializer.restoreComputationGraph(ModelSerializer.java:641)
at org.deeplearning4j.util.ModelSerializer.restoreComputationGraph(ModelSerializer.java:498)
at org.deeplearning4j.zoo.ZooModel.initPretrained(ZooModel.java:101)
at weka.dl4j.zoo.AbstractZooModel.downloadWeights(AbstractZooModel.java:129)
at weka.dl4j.zoo.AbstractZooModel.attemptToLoadWeights(AbstractZooModel.java:83)
at weka.dl4j.zoo.VGG16.init(VGG16.java:64)
at weka.classifiers.functions.Dl4jMlpClassifier.setZooModel(Dl4jMlpClassifier.java:1606)
at weka.filters.unsupervised.attribute.Dl4jMlpFilter.loadModel(Dl4jMlpFilter.java:184)
at weka.filters.unsupervised.attribute.Dl4jMlpFilter.determineOutputFormat(Dl4jMlpFilter.java:194)
at weka.filters.SimpleBatchFilter.batchFinished(SimpleBatchFilter.java:248)
at weka.filters.Filter.filterFile(Filter.java:1159)
at weka.filters.Filter.runFilter(Filter.java:1411)
at myTest.WekaTests.filterTest(Main.java:31)
at myTest.Main.main(Main.java:77)
Caused by: java.lang.RuntimeException: Error deserializing ComputationGraphConfiguration - configuration may have a custom layer, vertex or preprocessor, in pre version 1.0.0-beta JSON format.
Models in legacy format with custom layers should be loaded in 1.0.0-beta to 1.0.0-beta4 and saved again, before loading in the current version of DL4J
at org.deeplearning4j.nn.conf.ComputationGraphConfiguration.fromJson(ComputationGraphConfiguration.java:187)
at org.deeplearning4j.util.ModelSerializer.restoreComputationGraph(ModelSerializer.java:628)
... 13 more
Caused by: org.nd4j.shade.jackson.databind.exc.InvalidTypeIdException: Missing type id when trying to resolve subtype of [simple type, class org.deeplearning4j.nn.conf.graph.GraphVertex]: missing type id property '@class' (for POJO property 'vertices')
at [Source: (StringReader); line: 132, column: 5] (through reference chain: org.deeplearning4j.nn.conf.ComputationGraphConfiguration["vertices"]->java.util.LinkedHashMap["block1_conv1"])
at org.nd4j.shade.jackson.databind.exc.InvalidTypeIdException.from(InvalidTypeIdException.java:43)
at org.nd4j.shade.jackson.databind.DeserializationContext.missingTypeIdException(DeserializationContext.java:1768)
at org.nd4j.shade.jackson.databind.DeserializationContext.handleMissingTypeId(DeserializationContext.java:1297)
at org.nd4j.shade.jackson.databind.jsontype.impl.TypeDeserializerBase._handleMissingTypeId(TypeDeserializerBase.java:299)
at org.nd4j.shade.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer._deserializeTypedUsingDefaultImpl(AsPropertyTypeDeserializer.java:164)
at org.nd4j.shade.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer.deserializeTypedFromObject(AsPropertyTypeDeserializer.java:105)
at org.nd4j.shade.jackson.databind.deser.AbstractDeserializer.deserializeWithType(AbstractDeserializer.java:254)
at org.nd4j.shade.jackson.databind.deser.std.MapDeserializer._readAndBindStringKeyMap(MapDeserializer.java:529)
at org.nd4j.shade.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:364)
at org.nd4j.shade.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:29)
at org.nd4j.shade.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
at org.nd4j.shade.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
at org.nd4j.shade.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at org.deeplearning4j.nn.conf.serde.ComputationGraphConfigurationDeserializer.deserialize(ComputationGraphConfigurationDeserializer.java:57)
at org.deeplearning4j.nn.conf.serde.ComputationGraphConfigurationDeserializer.deserialize(ComputationGraphConfigurationDeserializer.java:47)
at org.nd4j.shade.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4202)
at org.nd4j.shade.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3205)
at org.nd4j.shade.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3173)
at org.deeplearning4j.nn.conf.ComputationGraphConfiguration.fromJson(ComputationGraphConfiguration.java:176)
... 14 more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment