mleap icon indicating copy to clipboard operation
mleap copied to clipboard

Deserializing fail

Open LTzycLT opened this issue 9 years ago • 8 comments

I followed spark guide link and serialized my pipeline into directory successfully in my toree notebook.

for(bundle <- managed(BundleFile("file:/tmp/mleap-examples/model-dir"))) {
    mleap_pipeline.writeBundle.format(SerializationFormat.Json).save(bundle)
}

But I can't deserialize my pipeline from directory.

val dirBundle = (for(bundle <- managed(BundleFile("file:/tmp/mleap-examples/model-dir"))) yield {
  bundle.loadSparkBundle().get
}).opt.get

Logs in notebook

Name: Unknown
Message: Unable to retrieve error!
StackTrace: 

Logs in terminal

java.util.NoSuchElementException: None.get
  at scala.None$.get(Option.scala:347)
  at scala.None$.get(Option.scala:345)
  ... 48 elided

It seems the None object has been retrieved. But I've checked the directory is filled with many nodes.

oneHot_fe89d6d86262.node/       stdScal_7520fc9c8fa1.node/      vecAssembler_72646a6ac7e5.node/ 
rfc_abe11d71d09c.node/          strIdx_a4314dc62125.node/       w2v_fb08ff5fbe06.node/

What happened? I'm using v0.6.0.

LTzycLT avatar Apr 14 '17 00:04 LTzycLT

@LTzycLT Hey, do you mind posting the directory structure for your model here, including all model.json/node.json files? Often this issue is caused because you have a OneHotEncoder in your pipeline and don't pass a DataFrame when serializing your pipeline. See this issue for more information:

https://github.com/combust/mleap/issues/135

hollinwilkins avatar Apr 19 '17 13:04 hollinwilkins

Another tip is to make sure to unwrap any Try objects that are returned when serializing. This will make sure you don't have any serialization errors and can oftentime produce useful error messages.

hollinwilkins avatar Apr 19 '17 13:04 hollinwilkins

@LTzycLT had the same error. For what is worth, only way I made the deserializing work is by using this code:

val sbc = SparkBundleContext().withDataset(pipeline.transform(dataset))
for(bf <- managed(BundleFile("jar:file:/tmp/test.zip"))) {
        pipeline.writeBundle.save(bf)(sbc).get
      }


manugarri avatar Apr 20 '17 11:04 manugarri

Same error for me. I am deserializing from a zip file.

val model = (for(bundle <- managed(BundleFile(model_name))) yield {
          bundle.loadMleapBundle().get
      }).opt.get.root

And this code actually work in my Mac but not in my Linux environment.

yijiezh avatar May 04 '17 17:05 yijiezh

@EvanzzzZ @manugarri Can you share the bundle file with us, which version of MLeap, and the Linux environment details with us?

You can send the bundle file to mikhail at combust.ml and hollin at combust.ml

seme0021 avatar May 04 '17 17:05 seme0021

Closing this for now until samples can be provided.

hollinwilkins avatar Sep 23 '17 01:09 hollinwilkins

Do you have solved the problem?I meet the same error.

liaosimin avatar Aug 10 '18 08:08 liaosimin

I'm getting a similar error, and when I call .tried on the ExtractableManagedResource[Bundle[Transformer]] I get:

Failure(java.util.NoSuchElementException: key not found: num_classes)

This explains why the Option is None, but I haven't been able to get to the bottom of what's going wrong yet.

rdecaire avatar Aug 14 '18 20:08 rdecaire