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

Error: mathematics con #34

Closed
jianghumu opened this issue May 2, 2023 · 2 comments
Closed

Error: mathematics con #34

jianghumu opened this issue May 2, 2023 · 2 comments

Comments

@jianghumu
Copy link

Error: mathematics con
0|app | at module.exports.__wbindgen_error_new (/home/chatgpt-serve/node_modules/@dqbd/tiktoken/tiktoken_bg.cjs:410:17)
0|app | at null. (wasm://wasm/00b5f812:1:168780)
0|app | at module.exports.encoding_for_model (/home/chatgpt-serve/node_modules/@dqbd/tiktoken/tiktoken_bg.cjs:177:14)

Is it because the lack of calling enc.free(); to release it?

@dqbd
Copy link
Owner

dqbd commented May 4, 2023

Hello, @jianghumu!

I believe that is the case, afaict WASM becomes unreliable after saturating the available memory. Will address the issue with memory leaks in the future, see #35, but in the meantime, consider freeing the encoder after doing the work.

@dqbd
Copy link
Owner

dqbd commented Jun 2, 2023

This should be addressed with never versions (although it does have some issues with lost support in other environments #46). It is still recommended to manually call free() when the encoder is not needed anymore, as FinalizationRegistry is not a bullet-proof and memory leaks might still happen (eg. when instantiating in a loop within a single event loop).

Closing for now! Feel free to reopen if needed :)

@dqbd dqbd closed this as completed Jun 2, 2023
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

2 participants