Getting Started with BiDAF

I’m just a simple nut farmer. I’ve chosen a bit of a complex model to get started with I guess. Based on example resources, I’ve gathered how to declare some TensorShape input and run the model, but for this model I am unsure how to preprocess the string data into the appropriate TensorShape. The example codes [here] are written in Python and I’m trying to use C#. Can anyone help me out with what the preprocess and main functions should look like, or direct me to a C# BiDAF project I can take apart myself?

I think I read Tensors of type string are not supported yet, but don’t take my word for it. but besides that, yo ucan use Python in unity (editor) if you install the Python For Unity package, or whatever its named. com.unity.scripting.python
So you should be able to use their python as-is (once you install the packages it needs like numpy and nltk)

Hey @utzsar so yes, string tensor are not supported.
However Bidaf is quite easy to work around this.
If you look at the model, the string input just gets mapped to a int value given a few CategoryMapper operator.
You can do that easily in C# with a Dictionary :slight_smile:

so you have two ways to acheive that

  • you modify the onnx file to remove CategoryMapper and change the input tensor type
  • you follow the CustomModel to override the CategoryMapper operator to correctly create the dictionary. Input needs to de Tensor, so you pack your string into inttensor and sample the dictionary

Support for tensor strings/converter is added as a task. Internally known as issue 109