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

new GPTTokens() sometime fails with RuntimeError: unreachable #5

Closed
takahser opened this issue May 9, 2023 · 2 comments
Closed

new GPTTokens() sometime fails with RuntimeError: unreachable #5

takahser opened this issue May 9, 2023 · 2 comments

Comments

@takahser
Copy link

takahser commented May 9, 2023

When using this package, sometimes there are runtime errors in the downstream @dqbd/tiktoken dependency.

Code snippet:

new GPTTokens({
  model: 'gpt-3.5-turbo',
  messages: [
    {
      role: 'user',
      content: JSON.stringify(query),
    },
  ],
});

Error:

/Users/xxx/repos/gpt-pr-comment-summary/crawler/node_modules/@dqbd/tiktoken/tiktoken_bg.cjs:262
            wasm.tiktoken_encode(retptr, this.ptr, ptr0, len0, addHeapObject(allowed_special), addHeapObject(disallowed_special));
                 ^
RuntimeError: unreachable
    at wasm://wasm/00b5f812:wasm-function[563]:0x6a72a
    at wasm://wasm/00b5f812:wasm-function[665]:0x6fd7a
    at wasm://wasm/00b5f812:wasm-function[756]:0x70f7f
    at wasm://wasm/00b5f812:wasm-function[237]:0x5c43a
    at wasm://wasm/00b5f812:wasm-function[200]:0x4db89
    at wasm://wasm/00b5f812:wasm-function[34]:0x1f78a
    at wasm://wasm/00b5f812:wasm-function[159]:0x48dc3
    at Tiktoken.encode (/Users/xxx/repos/gpt-pr-comment-summary/crawler/node_modules/@dqbd/tiktoken/tiktoken_bg.cjs:262:18)
    at GPTTokens.num_tokens_from_messages (/Users/xxx/repos/gpt-pr-comment-summary/crawler/node_modules/gpt-tokens/index.js:162:40)
    at GPTTokens.num_tokens_from_messages (/Users/xxx/repos/gpt-pr-comment-summary/crawler/node_modules/gpt-tokens/index.js:126:25)
@RuslanMikailov
Copy link

+1

@Cainier
Copy link
Owner

Cainier commented May 11, 2023

Looks like a memory leak issue, I fixed this bug in v1.0.7

#6

@Cainier Cainier closed this as completed May 13, 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

3 participants