Model file cannot be opened for loading!

1,645 views
Skip to first unread message

samm...@gmail.com

unread,
Jul 19, 2017, 11:57:36 PM7/19/17
to fastText library
I tried to load training file using 

    Fasttext jft =new Fasttext();
    jft.load("/the/path/to/file");

but got 

    Model file cannot be opened for loading!

I reviewed the core of code 

     void FastText::loadModel(const std::string& filename) {
     std::ifstream ifs(filename, std::ifstream::binary);
     if (!ifs.is_open()) {
    std::cerr << "Model file cannot be opened for loading!" << std::endl;
    exit(EXIT_FAILURE);

Although the path is true , it couldn't be recognized . what are the probabilities that make file not be open?

s.bak...@gmail.com

unread,
Apr 24, 2018, 11:42:29 AM4/24/18
to fastText library
Hello,
I have the same problem.
I can run the model with no problem for producing sentences embedding:
./fasttext print-sentence-vectors myModel ...

but the below code results to error:
./fasttext print-word-vectors myModel ...
ERROR:Model file cannot be opened for loading!

Is it possible to give a solution?
Thank you

s.bak...@gmail.com

unread,
Apr 25, 2018, 7:37:31 AM4/25/18
to fastText library
My problem is solved.
There was a problem in my script.
Thanks from dear Edouard Grave.
Best Regards,
Message has been deleted

Mohamed Helmi KLAI

unread,
Jul 15, 2020, 10:05:51 PM7/15/20
to fastText library
i had the same problem please how can i save it
Message has been deleted

Chaitanya Patil

unread,
Aug 12, 2021, 12:12:24 PM8/12/21
to fastText library
How did u guys fix it?

ERIC LIAO

unread,
Dec 22, 2021, 4:16:48 AM12/22/21
to fastText library
I am Chinese, and I met the same issue, although I use relative path, but the truely absolute path to the model's directorys name is included Chinese. 
So, if we make the absolute path's all directorys name to all English, and we can use it, isn't relevant to with relative path or absolute path, we can still use relative path. 

with some trying, the truth is simple !


Chaitanya Patil 在 2021年8月13日 星期五上午12:12:24 [UTC+8] 的信中寫道:
Reply all
Reply to author
Forward
0 new messages