Is it possible to generate a config.cfg for a spaCy v2 model? #7054
-
Since I've updated from spaCy v2 to v3, I can't load my (self-trained) v2 models anymore because they don't have a config.cfg file. As the CLI is able to convert 'old' traindata from .json to .spacy, I was wondering if there was some tool to automatically infer a config file for a v2 model. After searching for some time, I couldn't find a way to do this. Is there a way to create a config-file from a v2 model? Is there perhaps another way to load my v2 models using spaCy v3? Or am I forced to use an older version of spaCy for these models? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi! The problem here goes a bit deeper: the model implementations and various other aspects of the internals have changed between v2 and v3, in order to support more accurate pipelines, shared embeddings (including transformers) and so on. So even if you generated a config file, the weights trained with v2 wouldn't be compatible with the v3 components, so your pipeline wouldn't be able to make meaningful predictions. So the best solution for your situation would be to retrain your models using spaCy v3. You can use |
Beta Was this translation helpful? Give feedback.
Hi! The problem here goes a bit deeper: the model implementations and various other aspects of the internals have changed between v2 and v3, in order to support more accurate pipelines, shared embeddings (including transformers) and so on. So even if you generated a config file, the weights trained with v2 wouldn't be compatible with the v3 components, so your pipeline wouldn't be able to make meaningful predictions.
So the best solution for your situation would be to retrain your models using spaCy v3. You can use
spacy init config
to auto-generate a config file for the components you're using,spacy convert
to convert your data andspacy train
to train your pipeline.