Comments (4)
Actually, using the en_core_web_lg model instead of the sm model mitigates the problem to a great extent (it just parses the sentences better). May not be worth a pull just yet, but I had to fix the same issue during training by pre-processing the sentences.
from spanmarkerner.
Hello!
I don't think there's a workaround yet. Feel free to make a pull request and I'll try to have a look at it :)
- Tom Aarsen
from spanmarkerner.
Hi,
I have a one-line fix that should work for this as it keeps happening. spacy integration code that resolves this issue fairly nicely. I am not sure how to do the pull request, but the in the "spacy_integration.py" file I would propose the following change:
def __call__(self, doc: Doc) -> Doc:
"""Fill `doc.ents` and `span.label_` using the chosen SpanMarker model."""
sents = list(doc.sents)
inputs = [[token.text if not token.is_space else "" for token in sent] for sent in sents]
# Remove any sentences where the tokens are all empty strings or the sentence has 0 tokens.
inputs = [sentence for sentence in inputs if any(sentence) and len(sentence) > 0]
# use document-level context in the inference if the model was also trained that way
if self.model.config.trained_with_document_context:
inputs = self.convert_inputs_to_dataset(inputs)
I have updated the code and run a substantial amount of text through it. I did not however create any unit-tests but will be happy to do so you would consider this addition. It could be merged into the list comprehension above, but I wanted to show the logic clearly here.
from spanmarkerner.
The pipe()
function seems a bit difficult to fix, because if empty sentences are removed it will be tricky to calculate the offset value. Couldn't the tokenizer code somehow ignore empty sentences?
from spanmarkerner.
Related Issues (20)
- Cannot train BILOU scheme with no singletons HOT 1
- Hugging Face Space URL not working for FewNERD fine-tuned model HOT 2
- Confusing error thrown when tokens is empty
- should return same no. of list as of inputs HOT 6
- spaCy_integration `.pipe()` does not behave as expected HOT 1
- ValueError: Failed to concatenate on axis=1 because tables don't have the same number of rows HOT 4
- inference time cpu vs gpu HOT 3
- Error loading SpanMarkerTokenizer HOT 2
- SpanMarker library for document level context Gives Error. (RuntimeError: CUDA error: device-side assert triggered) HOT 3
- num_proc not specified in .map functions HOT 3
- Evaluation Metrics with Nervalute HOT 1
- Bert-based models crash HOT 3
- SpanMaker not working on custom dataset HOT 1
- Possible to load your own trained models with internet disabled? HOT 4
- implementing the relation identification part?
- is <start> <end> ever used? HOT 1
- deberta-v3 encoder error HOT 1
- UnicodeDecodeError when import span_marker HOT 1
- Stacking of embeddings
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spanmarkerner.