TransWikia.com

Fail to Export/Import seq2seq model (NER) to MXNet or ONNX

Mathematica Asked by Fortsaint on April 10, 2021

Mathematica 12.2 on Linux (Debian)

Here’s a simple Named Entity Recognition model:

net = NetChain[{
  EmbeddingLayer[64, 64],
  GatedRecurrentLayer@64,
  NetMapOperator@{10, SoftmaxLayer[]}
  }, "Input" -> 50
] // NetInitialize

This model cannot be exported to onnx format:

Export["~/net.onnx", net]

Export::onnxunslyr2: Layers {EmbeddingLayer,NetMapOperator} are not supported for export to ONNX.

It can be exported to MXNet but then it cannot be imported back:

Export["~/net.json", net, "MXNet"]

"~/net.json"

Import["~/net.json", "MXNet"]

General::deprec: MXNet import is deprecated and will not be supported in future versions of the Wolfram Language. Use ONNX import instead.

Import::invmxlayer: Layer named "1$0_3" couldn’t be created, layer type "_PlusScalar" is not supported.

I would like to export this NER to a format that can be loaded in Python. What alternatives are there?
Thanks

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP