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

SentencePieceProcessor vs C [Enhancement] #9

Closed
kris-jusiak opened this issue Jul 23, 2023 · 2 comments
Closed

SentencePieceProcessor vs C [Enhancement] #9

kris-jusiak opened this issue Jul 23, 2023 · 2 comments

Comments

@kris-jusiak
Copy link

To do the inference with just c and without sentence piece processor one easy way would be to save the id to token in the model.bin?

tokenizer = SentencePieceProcessor(tokenizer_model)
vocab = [tokenizer.id_to_piece(id) for id in range(tokenizer.get_piece_size())]

and then just an array to get the proper token from id

auto decode(auto id) {
  return vocab[id];
}

That would allow not to use the run_wrap.py and it would be in pure C (kinda).

@trholding
Copy link
Contributor

@karpathy
Copy link
Owner

Closing old issue. This has been implemented in run.c for a while with ASCII, and UTF-8 support is about to merge soon in #226 .

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