Nishk23 / spaCy-Custom-NER-creation

28 stars 28 forks source link

Can not training for spacy 3.0 #1

Open meimei96tq opened 3 years ago

meimei96tq commented 3 years ago

Could you please update for space version 3.0?

Kasun-Imesha commented 1 year ago

Two significant changes should be made for spacy3.x.

  1. The first change is creating and adding the ner component, which can be done using the add_pipeline method as follows.

In spacy2.x: ner = nlp.create_pipe('ner') nlp.add_pipe(ner, last=True)

In 3.x it should be updated to,

ner = nlp.add_pipe('ner', last=True)

  1. And the update method should be updated as follows according to the documentation,

In spacy2.x: nlp.update( [text], [annotations], drop=0.5, sgd=optimizer, losses=losses)

In 3.x it should be updated to,

example = Example.from_dict(self.nlp.make_doc(text), annotations) nlp.update( [example], drop=0.5, sgd=optimizer, losses=losses) Example class can be found under from spacy.training import Example

Hope this will be helpful for somebody if a late reply

ron4u1998 commented 4 months ago

@Kasun-Imesha Thanks a lot.....