zhongkaifu / Seq2SeqSharp

Seq2SeqSharp is a tensor based fast & flexible deep neural network framework written by .NET (C#). It has many highlighted features, such as automatic differentiation, different network types (Transformer, LSTM, BiLSTM and so on), multi-GPUs supported, cross-platforms (Windows, Linux, x86, x64, ARM), multimodal model for text and images and so on.
Other
193 stars 38 forks source link

SeqLabel model backward compatibility is broken by latest update #76

Closed zsogitbe closed 7 months ago

zsogitbe commented 8 months ago

Description: The last update and the removal of ClsVocabs everywhere (for example, in SeqLabelModel code) is preventing formerly trained models to load. The problem is the target vocabulary which is now not being set by reading ClsVocabs.

Model backward compatibility is extremely important. The models we train nowadays are trained for several days with a lot of resources and time. We cannot afford to loose all of this because the library is improving.

Expected behavior Removing clsVocabs to normalize the code and using tgtVocab everywhere is a good improvement, but this should be done in a way that formerly trained models can still be converted or loaded. Solution: add back the clsVocabs serialization and convert old models automatically or provide a console application to convert old models to the new version.

zhongkaifu commented 8 months ago

Hi @zsogitbe

Here is the way to convert your existing trained model to newer format:

  1. Load the existing trained model by your modified code.
  2. Save the model by calling SaveModel(...) method.

Then you should be able to load the updated model by new code. Let me know if it works.

Thanks Zhongkai Fu

zsogitbe commented 8 months ago

Yes, thank you, I could manage to convert my model (I have also deleted clsVocabs from the model).

I have added this issue for other users who do not know how to modify the code well and need an other long term solution for model backward compatibility.

zsogitbe commented 7 months ago

The code has been updated to support old models automatically.