deepjavalibrary / djl

An Engine-Agnostic Deep Learning Framework in Java
https://djl.ai
Apache License 2.0
4.07k stars 648 forks source link

How to serialize a ptmodel #1396

Closed napdada closed 2 years ago

napdada commented 2 years ago

hi!I want to use the pytorch model in a distributed environment, but many classes in djl do not implement the Serializable interface.

Inheriting classes and then implementing Serializable interface will involve many other classes that still cannot be serialized, and the whole process is very troublesome, is there an easy way to do this?

error example: `Caused by: java.io.NotSerializableException: ai.djl.pytorch.engine.PtModel Serialization stack:

Thanks!

frankfliu commented 2 years ago

@napdada Please take a look our spark examples about how DJL works in Spark: https://github.com/deepjavalibrary/djl-demo/tree/master/apache-spark