-
Notifications
You must be signed in to change notification settings - Fork 192
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
Does not work on front-end in Next.js projects #32
Comments
Yes, this is a node module. You can get around that fairly easily. const bpe_file = fs.readFileSync(path.join(__dirname, './vocab.bpe'), 'utf-8');
fs.writeFileSync('./vocab_bpe.json', JSON.stringify(bpe_file)) Then the two jsons can be loaded directly. //const fs = require('fs')
//const path = require('path');
//const encoder = JSON.parse(fs.readFileSync(path.join(__dirname, './encoder.json')));
//const bpe_file = fs.readFileSync(path.join(__dirname, './vocab.bpe'), 'utf-8');
const encoder = require('./encoder.json')
const bpe_file = require('./vocab_bpe.json') Modifying the module itself didn't work for me. I get errors around Zip with both jsons and modified code. There are actually two pull requests that address this issue: #33 and #30. I think this issue can be closed and one of the two should be merged. |
If interested, a temporary fix would be to use https://www.npmjs.com/package/@nem035/gpt-3-encoder until the maintainers merge #33
|
YOu can probably use the browser version from my 1.4 release. This removed all node dependencies by including data as js files. THis can be used directly or in the browserified version. I have just pushed a new update it should be getting pretty stable. let me know if it works for you |
You can also use my fork |
@syonfox - getting this in a frontend svelte project with the latest release - 1.1.4.
|
is that not built in node if your in the browser environment you will need just include this as a regular file and use also |
Even after adding fs via
yarn add fs
, I still get this error. ):Screenshot:
The text was updated successfully, but these errors were encountered: