Skip to content Skip to sidebar Skip to footer

Load Up Previously Saved Ner Models In Spacy V1.1.2

So whenever I try to load up a previously saved model for SpaCy NER, I get a core dump. if os.path.isfile( model_path ): ner.model.load( model_path ) for itn in range( 5 ):

Solution 1:

Edit: Turns out I don't need to load the model in order to update it, all I need to do is remove

ifos.path.isfile( model_path ):
    ner.model.load( model_path )

And add

ner.model.dump( model_path )

to the end like so:

for itn in range( 5 ):
random.shuffle( TRAIN_DATA )
for raw_text, entity_offsets in TRAIN_DATA:
    doc = nlp.make_doc( raw_text )
    gold = GoldParse( doc, entities=entity_offsets )
    ner.update( doc, gold ) 
ner.model.dump( model_path )

in order for it to append to the previously saved data. All good!

Solution 2:

Hmm. There's probably still a bug here, though. Obviously you should be able to write to a pre-loaded model!

Post a Comment for "Load Up Previously Saved Ner Models In Spacy V1.1.2"