"Cannot deserialize model" error when loading retrained transformer model

Hi, I first trained a transformer model with the following, which successfully finished training.

prodigy train prodigy/model/model_100_fulltext --ner train_set_full_text --base-model en_core_web_trf --eval-split 0.2

When I load the retrained model, I got the following error.

My spacy version is 3.1.3. prodigy version is 1.11.4.

Hi, I think this is the same issue as a known bug related to spacy-transformers: PyTorchWrapper causes error on deserializing · Issue #8319 · explosion/spaCy · GitHub

We're working on a fix in spacy-transformers. If you are very adventurous, you can try out the current dev version: pip install spacy-transformers==1.1.0.dev3. We should be pretty close to the final release, but want to do a bit more testing first. If you do try it out, let us know how it goes!

Just a note that you can upgrade to a stable release now (currently v1.1.1):

pip install -U spacy-transformers

Hi, thanks for the update. I got some dependency issue when installing the new version. Any suggestions?

en-core-web-trf 3.1.0 requires spacy-transformers<1.1.0,>=1.0.3, but you have spacy-transformers 1.1.1 which is incompatible.

The original en_core_web_trf v3.1.0 model is officially only compatible with spacy-transformers>=1.0.3,<1.1.0. v1.0.3 is the spacy-transformers version it was trained and tested with.

That said, we tried to make things as backwards compatible as possible and you should be able to load en_core_web_trf v3.1.0 with spacy-transformers>=1.1.1 (or >=1.1.2 for windows). You'll see a warning each time it's loaded, but it should still load and run normally. (If it doesn't, let us know!)

If you want to avoid the warning, you'd have to uninstall en_core_web_trf and load this model from a new path or package instead. nlp.to_disk() will save the converted model in the v1.1 format.

Thanks. I will try that. Is it possible to train the en_core_web_trf in the PyTorch framework which I am more familiar? Is there any documentation on that?