Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to load .ftz model and getting "wrong file format" #36

Open
jenyashvartsman opened this issue Apr 23, 2018 · 6 comments
Open

Trying to load .ftz model and getting "wrong file format" #36

jenyashvartsman opened this issue Apr 23, 2018 · 6 comments

Comments

@jenyashvartsman
Copy link

@lidalei can you please advise

import com.github.jfasttext.JFastText;

public class ApiExample {
public static void main(String[] args) {
JFastText jft = new JFastText();

    jft.loadModel("nlpData/model.ftz");

    // Do label prediction
    String text = "What is the most popular game in the US ?";
    JFastText.ProbLabel probLabel = jft.predictProba(text);
    System.out.printf("\nThe label of '%s' is '%s' with probability %f\n",
            text, probLabel.label, Math.exp(probLabel.logProb));
}

}

Output:
Model file has wrong file format!
Process finished with exit code 1

@lidalei
Copy link

lidalei commented Apr 23, 2018

Which version of fastText do you use to load this model? And which version did you use to train the model?

@jenyashvartsman
Copy link
Author

version 0.3

com.github.vinhkhuc
jfasttext
0.3

the model itself i didnt trained wit JFastText with but with fasttext. i checked the model on fasttext and it is working ok but for some resone it cant be loaded on JFastText. the only thing i can think on is that this model is very large (693 MB), might be an issue with loading this size?

@jenyashvartsman
Copy link
Author

fasttext version fastText-0.1.0

@lidalei
Copy link

lidalei commented Apr 24, 2018

Could you try to use https://github.com/lidalei/JFastText? If it did not work, I am afraid you have to re-train your model.

@Aurelius84
Copy link

what's the difference between 0.3.0 and this version (https://github.com/lidalei/JFastText) ?
I just met "wrong file format" when I train model with fasttext from Facebook command and load model using JFastText==0.3.0 (Maven)??

Best Regards

@lidalei
Copy link

lidalei commented Jun 12, 2018

https://github.com/lidalei/JFastText uses the newest version fastText. So if you encounter this error, you should upgrade your fastText and re-train your models.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants