allenai / allennlp

An open-source NLP research library, built on PyTorch.
http://www.allennlp.org
Apache License 2.0
11.73k stars 2.24k forks source link

different SRL output between the demo and the model https://s3-us-west-2.amazonaws.com/allennlp/models/bert-base-srl-2019.06.17.tar.gz #4010

Closed igormis closed 4 years ago

igormis commented 4 years ago

System:

Question

def predict(text): results = predictor.predict( sentence=text ) return results

However when i use the following text as an input:
`text = "Facebook reports robust profit, revenue gains; stock rises"`
the results is:
`{'verbs': [], 'words': ['Facebook', 'reports', 'robust', 'profit', ',', 'revenue', 'gains', ';', 'stock', 'rises']}
`
However when I use the [demo](https://demo.allennlp.org/semantic-role-labeling/MTY0MzI0Nw==) for the same text I get the expected results, i.e:

reports: [ARG0: Facebook] [V: reports] [ARG1: robust profit , revenue gains ;] stock rises rises: Facebook reports robust profit , revenue gains ; [ARG1: stock] [V: rises]


I have noticed this behaviour (better results are given using the demo) on more examples. could you tell me what is the cause? Is it different model? Or some pre-processing that you are doing before inference?
Troied commented 4 years ago

@igormis , the demo is using the following version :

AllenNLP : commit:17c2ff1ce2cb5e84ab9a0f524e6c01362c242cae (https://github.com/allenai/allennlp/tree/17c2ff1ce2cb5e84ab9a0f524e6c01362c242cae)

I'm also using SRL with current master and model "openie-model.2020.03.26.tar" .This works like a charm 👍

Note : use spacy 2.2.3

igormis commented 4 years ago

@datix-vishu I was more looking for the model that is used in the demo... On the other hand, can u send me the link for openie-model.2020.03.26.tar

igormis commented 4 years ago

And I was also trying to load the following model https://s3-us-west-2.amazonaws.com/allennlp/models/bert-base-srl-2020.02.10.tar.gz but it throws an error, like the model is no longer available

igormis commented 4 years ago

The model you have suggested predictor = Predictor.from_path("https://s3-us-west-2.amazonaws.com/allennlp/models/openie-model.2020.03.26.tar.gz") again throws an error, could u please send me the link. Thank u in advance

dirkgr commented 4 years ago

The link I have is this: https://storage.googleapis.com/allennlp-public-models/openie-model.2020.03.26.tar.gz. It should be the same model you have there, just hosted somewhere else. I just ran this and it loads up fine. You can see it running at https://demo.allennlp.org/open-information-extraction.