-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Add SpanMarker for NER to spaCy universe #12730
Conversation
Or at least, attempt to
Following #12737, I also implemented the |
Hi @tomaarsen! Thanks so much for doing that and your contribution! I'm working on reviewing the PR and will get back to you soon. |
Hi again @tomaarsen, Unfortunately, I cannot seem to get the example code to run without importing Also, it also might make sense to exclude or disable the default Besides those two things, everything runs as expected and the website looks good on my end! Thanks again for your contribution. |
I'm experiencing the same thing in the Colab session I just tested in. It exclusively works locally it seems. I probably installed it slightly differently there. I'll chase this down and release an update. I'll also consider disabling the NER pipeline outright as opposed to loading it and then removing it when adding the I'll be in touch soon! |
I've found & fixed the issue (an incorrect build system in the pyproject.toml). A new version (1.2.2) has been released, which should fix the importing issue. Beyond that, I've updated my documentation and the code example to use
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested the example code and everything works as expected. Also ran the website locally and all looks great. LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for your contribution! We'll get this merged and published on the Universe page 🎉
* Add SpanMarker for NER to spaCy universe * Escape the newlines in the text in the code example Or at least, attempt to * Remove now unnecessary import * Disable NER pipeline component in code example
Hello!
Pull Request overview
Description
I've added my recent SpanMarker module for NER to the spaCy universe list. SpanMarker performs competitively on various NER benchmarks, and the integration with spaCy seems like a no-brainer to me. spaCy is just extremely convenient, and so I've tried to adopt that design direction for the integration. In particular, the integration is designed as a drop-in replacement of the default spaCy NER solution:
import spacy nlp = spacy.load("en_core_web_sm") + nlp.add_pipe("span_marker", config={"model": "tomaarsen/span-marker-roberta-large-ontonotes5"}) text = '''Cleopatra VII, also known as Cleopatra the Great, was the last active ruler of the Ptolemaic Kingdom of Egypt. She was born in 69 BCE and ruled Egypt from 51 BCE until her death in 30 BCE.''' doc = nlp(text)
After which all normal spaCy behaviour should work as intended, i.e. visualization and processing of entities. This allows users to very quickly transition from using pure spaCy to various different SpanMarker models hosted on the Hugging Face Hub.
The above script, but then copy-paste ready for your convenience
The visualization results in:
I hope I've formatted the description and code example correctly - I haven't tried to generate the website locally.
Types of change
Documentation.
Checklist
Good job on getting spaCy to where it is today, lots of respect.