-
-
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
Getting KeyError #4095
Comments
Hi |
hi @AbhayGodbole there might be an issue with your data. please check your data so i mean text ===> the entire text and
to check the exact record where you are facing issue. and do you have
where you add the entities to your we can be of better help if you paste the entire code here. |
Thanks Gautham, Regards |
I dont think
this is the format u have to send-in for spacy (as far as i know .) Your data should be similar to the one present in this page [Training Data section]( https://timkuhn.github.io/TextMining/spacy/ner/2018/01/24/spaCy_NER_Training.html ) Or send the data in BILUO format. Thanks |
Hi Guatham, Regarding the Data. I have .json shared is in the same format that you have mentioned. I have converted this json to spacy required format with script attached. |
Hi Guatham, But issue is its forgetting the previously trained entities like "India". |
Forget entities is normal if you train a model a lot for different entities without including some examples for "already known" entities (e.g. India). Moreover you have to make sure to include enough examples of your new entities and representive ones, with different positions inside the sentences. |
Thanks BB. I got it. |
@AbhayGodbole can you tell how you solved the issue |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I am getting error while executing “spacy_ner_custom_entities.py”
Loaded model 'en'
KeyError Traceback (most recent call last)
in
----> 1 main(model="en",output_dir="../Data/Out")
C:\Abhay\AI\Spacy-NER\Notebooks\spacy_ner_custom_entities.py in main(model, new_model_name, output_dir, n_iter)
68 texts, annotations = zip(*batch)
69 nlp.update(texts, annotations, sgd=optimizer, drop=0.35,
---> 70 losses=losses)
71 print('Losses', losses)
72
c:\abhay\ai\spacy-ner\vir-spacy\lib\site-packages\spacy\language.py in update(self, docs, golds, drop, sgd, losses, component_cfg)
450 kwargs = component_cfg.get(name, {})
451 kwargs.setdefault("drop", drop)
--> 452 proc.update(docs, golds, sgd=get_grads, losses=losses, **kwargs)
453 for key, (W, dW) in grads.items():
454 sgd(W, dW, key=key)
nn_parser.pyx in spacy.syntax.nn_parser.Parser.update()
nn_parser.pyx in spacy.syntax.nn_parser.Parser._init_gold_batch()
ner.pyx in spacy.syntax.ner.BiluoPushDown.preprocess_gold()
ner.pyx in spacy.syntax.ner.BiluoPushDown.lookup_transition()
KeyError: "[E022] Could not find a transition with the name 'U-Tag' in the NER model."
I am using following custom lables:
LABEL = [‘B-NewNom’,’I-NewNom’,’B-OldNom’,’I-OldNom’]
NewNom = New Nominee
OldNom = Old Nominee
I am using latest Sapcy:
===== Info about spaCy =========
spaCy version 2.1.0
Platform Windows-10–10.0.16299-SP0
Python version 3.7.1
Models en
Environment
The text was updated successfully, but these errors were encountered: