1
$\begingroup$

I have been looking at the NER example with Trax in this notebook: https://github.com/google/trax/blob/master/trax/examples/NER_using_Reformer.ipynb

However the notebook only gives an example as far as training the model. I can't find any examples of how to use this model to extract entities from a new string of text.

I've tried the following:

  • Instantiate the model in 'predict' mode. When trying this I get the same error reported in https://github.com/google/trax/issues/556 AssertionError: In call to configurable 'SelfAttention' (<class 'trax.layers.research.efficient_attention.SelfAttention'>)
  • Instantiate the model in 'eval' mode and then running model(sentence) as I would with other models. In this case the instantiation works but I get the following error when running the model: TypeError: Serial.forward input must be a tuple or list; instead got <class 'numpy.ndarray'>. Presumably this is because in 'eval' mode the model needs 2 entries passed in rather than one sentence

How can I use this Reformer to extract entities from a new sentence?

$\endgroup$
1
  • $\begingroup$ @saurav-maheshkar this is code you contributed to the trax repo. Are you able to help? $\endgroup$ Dec 30 '20 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.