# Using Reformer model to do NER in Trax

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?

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