Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

API footgun: infer_next_token still works after end of text #44

Closed
Tracked by #81
philpax opened this issue Mar 19, 2023 · 3 comments
Closed
Tracked by #81

API footgun: infer_next_token still works after end of text #44

philpax opened this issue Mar 19, 2023 · 3 comments
Assignees
Labels
issue:bug Something isn't working

Comments

@philpax
Copy link
Collaborator

philpax commented Mar 19, 2023

In llamacord, I have some logic that calls infer_next_token in a loop. Unfortunately, I didn't check for EOT - so the code would keep generating tokens and producing (fascinatingly well-structured) garbage. I think we should probably check if the last token is EOT and return an error? If you feed it a prompt, the EOT would no longer be the last token, and you should be able to infer without issues. (I wonder if A[EOT]B infers differently to AB...)

@setzer22
Copy link
Collaborator

I'd say being able to infer beyond eot is a feature some might want, even if it's just to run some experiment to see what would happen. But I'm OK with making the API harder to misuse, as long as it's still possible to request inference for a new token after EOT.

Returning some sort of "EOT" error in infer_next_token sounds like it might be what we want?

I wonder if A[EOT]B infers differently to AB...

Yes, for sure. EOT is an important token and the transformer will interpret both strings completely differently 👍

@philpax
Copy link
Collaborator Author

philpax commented Mar 20, 2023

Yeah, that's what I was thinking. It wouldn't allow your use-case, though: if you returned an EOT error, you wouldn't be able to get the inferred token back.

@philpax philpax added the issue:bug Something isn't working label Mar 24, 2023
@philpax
Copy link
Collaborator Author

philpax commented Mar 26, 2023

Discussed this on the Discord - it makes much more sense to return the EOT token itself as an error, and then let users continue inferring if they want.

@philpax philpax mentioned this issue Mar 26, 2023
7 tasks
@philpax philpax self-assigned this Mar 27, 2023
@philpax philpax closed this as completed in c8bdf01 Apr 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants