0
fasttext_model.save("fasttext.model")
fast_text = FastText.load("fasttext.model")

click this to see the error

I can't load my trained fasttext model:( How will i resolve this issue? please help!

Cole Torres
  • 49
  • 1
  • 3
  • Please show us the folder of your project (how files are structured?) – Amin Gheibi Nov 09 '20 at 08:07
  • The fasttext model and the jupyter ntbk are saved under a same folder and they're in the same directory – Cole Torres Nov 09 '20 at 08:32
  • "File not found" nearly always means that the file you tried to open does not exist. Very often beginners are confused about which directory code will run in. Perhaps see also https://stackoverflow.com/questions/31435921/difference-between-and – tripleee Nov 09 '20 at 08:39
  • 1
    Did you try `fast_text = FastText.load("fasttext (1).model")`? – Stefano Fiorucci - anakin87 Nov 09 '20 at 08:47
  • I just transferred my code to jupyter ntbk but it was originally in google collab, i wonder if there should be other files that should be saved other than the fasttext.model i trained – Cole Torres Nov 09 '20 at 09:10
  • Please, note that in the error the file searched is .wv.vectors_ngrams.npy not .model. This suffix is added automatically and I do not the reason – Marie Jun 04 '21 at 06:04

1 Answers1

0

Your screenshot does not show the .save() line of code, and in fact includes some output that is suggestive that another filename – fasttext (1).model – may have been used.

Is your code example a verbatim expression of exactly what was done, all in the same interpreter/working-directory/notebook, to reliably reproduce the error?

You can generally trust a FileNotFoundError that the intended file does not exist where your code has requested it.

In this case, the filename is one of the subsidiary files, which is saved alongside the main model file. If you move the main file, these subsidiary files must be moved also, to remain alongside the main file in the same directory.

gojomo
  • 52,260
  • 14
  • 86
  • 115