-
Notifications
You must be signed in to change notification settings - Fork 717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zero-Shot NER gives wrong entities with labels #14159
Comments
Can someone please help me with this issue? |
@maziyarpanahi, @josejuanmartinez : I have tried the example in https://sparknlp.org/2023/02/08/zero_shot_ner_roberta_en.html . It still gives me the same issue. It picks the next entity and gives it the label. The labels are right, but the entities are wrong. |
There seems to be an issue with
But it failed to put them together via NerConverter. Seems to be a bug, we'll take a look and fix it for the next release. |
@maziyarpanahi : Thank you very much for your reply. Would you be able to give me a tentative date when this could be resolved? Or is there any other NER models that I could use meanwhile to detected entities based on Question Answer Model? |
You are very welcome. We have many NER models both based on our own architecture or all-in-one from Hugging Face. (trained by us) They are not however zero-shot, meaning the labels are pre-defined. You can have a look for the meantime while we fix this small part:
|
@maziyarpanahi : Thank you for the suggestions. I was hoping to get a question answer type of NER. Even though I am capturing pre-defined entities, I need to capture answers to specific questions in the text. I think Zero-shot would help better. I didn't come across any other model that does that. |
Hello @maziyarpanahi : Could you please tell me when can I expect a resolution of this bug? |
Hi, we are still investigating this issue. I'll update here once we have a fix for it |
@maziyarpanahi : Thank you so much for your response. I will wait for the resolution then. |
Hello @maziyarpanahi : Thank you for looking into this issue. Is the model good to use now in python environment? Do I need to change my Spark NLP version for this to work? |
You are welcome. You must have Spark NLP 5.3.0 and everything would work without any change. |
Works perfectly well now. Thank you once again 👍 |
Is there an existing issue for this?
Who can help?
@marz @josejuanmartinez
What are you working on?
I was trying out the official example: https://github.com/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/Certification_Trainings/Healthcare/1.6.ZeroShot_Clinical_NER.ipynb. However, the results do not match with what I see in my notebook.
Seems like the row number of each entity is pushed by +1.
Current Behavior
The only difference that I have with the official documentation is that I am using the Roberta model without the clinical.
zero_shot_ner = ZeroShotNerModel.pretrained("zero_shot_ner_roberta", "en")
.setEntityDefinitions(
{
"PROBLEM": ["What is the disease?", "What is his symptom?", "What is her disease?", "What is his disease?",
"What is the problem?" ,"What does a patient suffer", 'What was the reason that the patient is admitted to the clinic?'],
"DRUG": ["Which drug?", "Which is the drug?", "What is the drug?", "Which drug does he use?", "Which drug does she use?", "Which drug do I use?", "Which drug is prescribed for a symptom?"],
"ADMISSION_DATE": ["When did patient admitted to a clinic?"],
"PATIENT_AGE": ["How old is the patient?",'What is the gae of the patient?']
})
.setInputCols(["sentence", "token"])
.setOutputCol("zero_shot_ner")
.setPredictionThreshold(0.1) # default 0.01
Expected Behavior
I would like to see the same results as given in the official documentation
Steps To Reproduce
https://github.com/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/Certification_Trainings/Healthcare/1.6.ZeroShot_Clinical_NER.ipynb
Spark NLP version and Apache Spark
Spark NLP version: 5.2.3
Apache Spark version: 3.4.1
Type of Spark Application
Python Application
Java Version
No response
Java Home Directory
No response
Setup and installation
No response
Operating System and Version
No response
Link to your project (if available)
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: