Problem loading "decomposable-attention-elmo" with `Predictor.from_path`

189 views Asked by At

I'm trying to load the decomposable attention model proposed in this paper The decomposable attention model (Parikh et al, 2017) combined with ELMo embeddings trained on SNLI., and used the code suggested as the demo website described:

predictor = Predictor.from_path("https://storage.googleapis.com/allennlp-public-models/decomposable-attention-elmo-2020.04.09.tar.gz", "textual_entailment")
predictor.predict(
  hypothesis="Two women are sitting on a blanket near some rocks talking about politics.",
  premise="Two women are wandering along the shore drinking iced tea."
)

I found this from log:

Did not use initialization regex that was passed: .*token_embedder_tokens\._projection.*weight

and the prediction was also different from what I got on the demo website (which I intended to see). Did I miss anything here?

Also, I tried the two other versions of the pretrained model, decomposable-attention-elmo-2018.02.19.tar.gz and decomposable-attention-elmo-2020.02.10.tar.gz. Neither of them works and I got this error:

ConfigurationError: key "token_embedders" is required at location "model.text_field_embedder."

What do I need to do to get the exact output as presented in the demo website?

1

There are 1 answers

0
Dirk Groeneveld On

ELMo is a bit difficult in this way in that it keeps state, and you don't get the same output if you call it twice. It depends on what you processed beforehand. In general, ELMo should be warmed up with a few queries before using it seriously.

If you're still seeing large discrepancies in the output, let us know and we'll look into it.

The old versions of the model don't work with the new code. That's why we published the new model versions.