Search code examples
savevowpalwabbit

How to save full Vowpal Wabbit python model (pyvw)?


I tried saving a Vowpal Wabbit model using model.save(<filepath>). But when I reload the model (using the -i <filepath> flag), model hyperparameters such as power_t and initial_t aren't the same (they get reinitialized). The saved file also seems to me a bit smaller in size that it should (not sure if it's compressed).

This is counter intuitive: why doesn't the .save() method save the full model? And are there alternative save methods to save the FULL model?


Solution

  • power_t and initial_t are only relevant for training. When just doing predictions they are not needed. By default when saving a model VW assumes it will be used for prediction only when loaded. If you intend to continue training from the loaded model then when you initialize VW you need to specify --save_resume so that the extra state is stored in the model. This includes power_t and initial_t (which is saved into a different variable t).