tfjs icon indicating copy to clipboard operation
tfjs copied to clipboard

interoperability - onxx exchange format

Open dberardo opened this issue 3 years ago • 2 comments

i would like to pre-train network models on the backend using just any other library (i prefer using spark for this operations) band then use the results within the tensor.js Framework in the frontend ...

can this already be achieved somehow? i am talking about importing / deserialization

i think this feature would be a game changer for this library.

dberardo avatar Sep 25 '21 15:09 dberardo

onnx provides python package that converts onnx model to tensorflow format,
check onnx documentation (good starting point is https://github.com/onnx/onnx-tensorflow/)

once model is in tensorflow format, use tensorflowjs_converter from python package (maintained by tfjs team) to convert from tf saved model format to tfjs graph model

vladmandic avatar Sep 25 '21 16:09 vladmandic

sounds like a promising approach. i will surely have a look. thanks for the advice. i have tried to find this information on. the official tensorflow.js doc but it seemed to me that only Json (de)serialization was possible, which is not true. . probably a note in the doc to this issue would be good for fiture readers.

dberardo avatar Sep 25 '21 16:09 dberardo

Here's the guide to convert from TensorFlow model to TF.js for serving in the frontend. https://www.tensorflow.org/js/guide/conversion

khanhlvg avatar Mar 20 '23 17:03 khanhlvg

Hi, @dberardo

Apologize for the delayed response and we are re-visiting our older issues and checking whether those issues are resolved or not and May I know above workaround from @vladmandic resolved your issue or not ?

You can refer our official documentation w.r.t Model Conversion and also refer official documentation of TensorFlow.js converter which will help you to resolve your issue and if issue still persists please let us know ? Thank you!

gaikwadrahul8 avatar May 07 '23 14:05 gaikwadrahul8

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you.

google-ml-butler[bot] avatar May 14 '23 14:05 google-ml-butler[bot]

Closing as stale. Please @mention us if this needs more attention.

google-ml-butler[bot] avatar May 21 '23 15:05 google-ml-butler[bot]