Skip to content

KeyError on Simple Training Loop #6485

Discussion options

You must be logged in to vote

It looks like your code boils down to:

nlp = spacy.load("en_core_web_sm")
nlp.add_pipe("textcat", config=config)
optimizer = nlp.resume_training()
with nlp.select_pipes(enable="textcat"):
    ....

I inially said

Calling nlp.initialize() basically wipes the internal weights of all the components in the pretrained model. Instead, you want to call resume_training if you want to further fine-tune an existing model.

But you have to consider the components you want to train. In your case, if I understand correctly, you're actually not interested in resuming training of any of the pretrained components of the pipeline, but you do want to train the new textcat. That means you do need to make s…

Replies: 9 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ines
Comment options

You must be logged in to vote
2 replies
@polm
Comment options

@wuye251
Comment options

Comment options

You must be logged in to vote
1 reply
@polm
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
training Training and updating models
5 participants
Converted from issue

This discussion was converted from issue #6485 on December 10, 2020 12:59.