Skip to content

Conversation

martindevans
Copy link
Member

Added a better system for checking antiprompts which does much less work per-token, does not allocate anything and has test coverage.

  • TokensEndsWithAnyString extension for IReadOnlyList<int> which efficiently checks if a set of tokens ends with one of a set of strings.
    • Minimal amount of characters converted
    • Allocation free
  • Added TokensToSpan to SafeLlamaModelHandle which converts as many tokens as possible into a character span
    • Allocation free

… which efficiently checks if a set of tokens ends with one of a set of strings.

   - Minimal amount of characters converted
   - Allocation free
 - Added `TokensToSpan` to `SafeLlamaModelHandle` which converts as many tokens as possible into a character span
   - Allocation free
@martindevans martindevans self-assigned this Sep 6, 2023
@martindevans martindevans merged commit 6cb0342 into SciSharp:master Sep 6, 2023
@martindevans martindevans deleted the better_antiprompt_checking branch September 6, 2023 20:38
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

Successfully merging this pull request may close these issues.

1 participant