You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 16, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 16, 2022. It is now read-only.
Semantic role labelling model returns all 'O' tags #4146
Describe the bug
Semantic role labelling model tags are all 'O'. No arguments are detected.
To Reproduce
from allennlp.predictors.predictor import Predictor
import allennlp_models.syntax.srl
predictor = Predictor.from_path("https://s3-us-west-2.amazonaws.com/allennlp/models/bert-base-srl-2019.06.17.tar.gz")
predictor.predict(
sentence="Did Uriah honestly think he could beat the game in under three hours?"
)
Output:
{'verb': 'beat',
'description': 'Did Uriah honestly think he could beat the game in under three hours ?',
'tags': ['O',
'O',
'O',
'O',
'O',
'O',
'O',
'O',
'O',
'O',
'O',
'O',
'O',
'O']}],
'words': ['Did',
'Uriah',
'honestly',
'think',
'he',
'could',
'beat',
'the',
'game',
'in',
'under',
'three',
'hours',
'?']}
Expected Output
{
"verbs":[
{
"description":"Did [ARG0: Uriah] [ARGM-MNR: honestly] [V: think] [ARG1: he could beat the game in under three hours] ?",
"tags":[
"O",
"B-ARG0",
"B-ARGM-MNR",
"B-V",
"B-ARG1",
"I-ARG1",
"I-ARG1",
"I-ARG1",
"I-ARG1",
"I-ARG1",
"I-ARG1",
"I-ARG1",
"I-ARG1",
"O"
],
"verb":"think"
},
{
"description":"Did Uriah honestly think he [V: could] beat the game in under three hours ?",
"tags":[
"O",
"O",
"O",
"O",
"O",
"B-V",
"O",
"O",
"O",
"O",
"O",
"O",
"O",
"O"
],
"verb":"could"
},
{
"description":"Did Uriah honestly think [ARG0: he] [ARGM-MOD: could] [V: beat] [ARG1: the game] in [ARGM-TMP: under three hours] ?",
"tags":[
"O",
"O",
"O",
"O",
"B-ARG0",
"B-ARGM-MOD",
"B-V",
"B-ARG1",
"I-ARG1",
"O",
"B-ARGM-TMP",
"I-ARGM-TMP",
"I-ARGM-TMP",
"O"
],
"verb":"beat"
}
],
"words":[
"Did",
"Uriah",
"honestly",
"think",
"he",
"could",
"beat",
"the",
"game",
"in",
"under",
"three",
"hours",
"?"
]
}
@iamsusiep apologies but we had the wrong model in the usage on the demo. It should work with the model that @epwalsh posted and we're fixing this in the demo. allenai/allennlp-demo#390
@schmmd
The last two working versions were AllenNLP version: allennlp==1.0.0rc1 allennlp-models==1.0.0rc1
Any later versions, e.g. those mentioned in Installing AllenNLP, i.e. allennlp==1.0.0rc5 allennlp-models==1.0.0rc5 lead to the following error:
>>> import allennlp_models.syntax.srl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'allennlp_models.syntax'
@schmmd your suggestion seems to have helped. Thanks!
I have another question. When I run predictor = Predictor.from_path() for the first time, it downloads Spacy's en_core_web_sm model. How can I make it use en_core_web_md instead? Is there a parameter that I could specify somewhere?
Activity
iamsusiep commentedon Apr 28, 2020
i'm encountering the same issue as well.
epwalsh commentedon May 1, 2020
Hi @RanganThaya, sorry for the late response. We're looking into this now.
epwalsh commentedon May 1, 2020
Could you try again with the master branch and this model: https://storage.googleapis.com/allennlp-public-models/bert-base-srl-2020.03.24.tar.gz
schmmd commentedon May 1, 2020
@iamsusiep apologies but we had the wrong model in the usage on the demo. It should work with the model that @epwalsh posted and we're fixing this in the demo. allenai/allennlp-demo#390
schmmd commentedon May 1, 2020
Let us know if you have more problems, but closing this for now!
krasi0 commentedon Jun 10, 2020
@schmmd
The last two working versions were
AllenNLP version: allennlp==1.0.0rc1 allennlp-models==1.0.0rc1Any later versions, e.g. those mentioned in
Installing AllenNLP, i.e.allennlp==1.0.0rc5 allennlp-models==1.0.0rc5lead to the following error:schmmd commentedon Jun 10, 2020
@krasi0 I think we reorganized some of those packages. Sorry for the churn. I think you want https://github.com/allenai/allennlp-models/tree/master/allennlp_models/structured_prediction (e.g.
import allennlp_models.structured_prediction).krasi0 commentedon Jun 10, 2020
@schmmd your suggestion seems to have helped. Thanks!
I have another question. When I run predictor = Predictor.from_path() for the first time, it downloads Spacy's
en_core_web_smmodel. How can I make it useen_core_web_mdinstead? Is there a parameter that I could specify somewhere?schmmd commentedon Jun 10, 2020
@krasi0 in the future please open new issues instead of following up on a closed issue.
I'm not sure, but my guess is that you would need to write a custom predictor. It looks like it's configurable on SpacyTokenizer.