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

TypeError: bpe(...).split is not a function #8

Open
bramses opened this issue Dec 30, 2021 · 3 comments
Open

TypeError: bpe(...).split is not a function #8

bramses opened this issue Dec 30, 2021 · 3 comments

Comments

@bramses
Copy link

bramses commented Dec 30, 2021

if token == toString the encoder errors out with this error.

https://github.com/latitudegames/GPT-3-Encoder/blob/master/Encoder.js#L163

Suggested fix: Cast token to string:

(toString).split(' ')
VM236:1 Uncaught TypeError: toString.split is not a function
    at <anonymous>:1:12
('toString').split(' ')
['toString']

EDIT:

same issue occured with constructor. The encoder may struggle with all reserved JS keywords :/

@NickHeiner
Copy link

I have the same issue with this:

var gpt3Encoder = require("gpt-3-encoder")

gpt3Encoder.encode(`foo.valueOf()`);

With some console logging, I can see that the bpe function returns [Function: valueOf] rather than a string.

@NickHeiner
Copy link

This is fixed in my fork: https://www.npmjs.com/package/@nick.heiner/gpt-3-encoder.

@jdan
Copy link

jdan commented Feb 23, 2023

Fixed with an upgrade to 1.1.4

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