n-waves / multifit

The code to reproduce results from paper "MultiFiT: Efficient Multi-lingual Language Model Fine-tuning" https://arxiv.org/abs/1909.04761
MIT License
284 stars 56 forks source link

Multifit inference problem #64

Open javithe7 opened 4 years ago

javithe7 commented 4 years ago

Hi everyone. Maybe you can help me with something. Once the multifit model is trained with my own dataset, I export it to a .pkl file, in order to use it later to make predictions. The problem comes when I load the model from a different machine than the one that trained the multifit. The model is loaded with load_learner(), but when I try to make a prediction an error related to SentencePiece appears, followed by this error message :

OSError: Not found: "/home/.fastai/data/.../tmp/spm.model": No such file or directory

Maybe I need to save the model in another way in order to load it and make predictions correctly?

tpietruszka commented 4 years ago

spm.model and spm.vocab in the same directory - the next thing your code will complain about - are files containing a SentencePiece tokenization model, trained on a specific dataset.

I believe they are generally stored separately from the model itself, so you will need to copy them to the other machine and adjust paths accordingly

Hope that helps and good luck!

javithe7 commented 4 years ago

Thanks for your answer Tomasz, it seems to be exactly what you say. I've found the directory where those files are, in my case was : /home/javithe7/.fastai/models/es_multifit_paper_version/ , i will copy it into the other machine to check if everything works fine.