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

Not working for me :S #1

Open
jcguarinpenaranda opened this issue Sep 10, 2017 · 1 comment
Open

Not working for me :S #1

jcguarinpenaranda opened this issue Sep 10, 2017 · 1 comment

Comments

@jcguarinpenaranda
Copy link

jcguarinpenaranda commented Sep 10, 2017

Today I started working with fasttext-node and I wrote the following script in Typescript:

import * as FastText from 'fasttext-node'

async function main() {
  const fastext = new FastText({ logs: true })
  try {
    const trainResult = await fastext.train(
      './train.txt',
      {
        epoch: 50,
        model: 'my-training-model'
      }
    )

    const result = await fastext.predict(['Custard Pudding tasting like raw eggs'],
      { labelCount: 10 }
    )
  } catch (err) {
    console.log('Training data err', err)
  }
}

// execute the code
main();

The train.txt file is the same from the examples, and I hosted it on my local folder.

Issue 1

When I change the path of train.txt to https://raw.githubusercontent.com/jazzyarchitects/fasttext-node/master/train.txt, I get the following error:

captura de pantalla 2017-09-10 a las 11 31 40 a m

Issue 2

When I execute the piece of code I wrote, I get the following error:
captura de pantalla 2017-09-10 a las 11 33 19 a m

I like the way the API has been implemented, and I would really like to use this library. Please help me get it working

@jazzyarchitects
Copy link
Owner

@jcguarinpenaranda Can you try running the code after pulling from the branch epipe-fix.

$ npm install --save https://github.com/jazzyarchitects/fasttext-node.git#epipe-fix

Also I would suggest you to terminate the process after the main function has returned. For that return any value from main function and the in the resolve section, exit the process.

  main()
  .then( () => process.exit(0));

When you provide a URL to the train function, it downloads the file and writes the data to data.txt file. Maybe you don't have permission to write to that location.

Let me know if this fixes the issue.

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

No branches or pull requests

2 participants