-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[WIP][Bug] Issue 934 #962
base: main
Are you sure you want to change the base?
[WIP][Bug] Issue 934 #962
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #962 +/- ##
==========================================
+ Coverage 58.00% 62.20% +4.19%
==========================================
Files 63 63
Lines 4848 4860 +12
==========================================
+ Hits 2812 3023 +211
+ Misses 2036 1837 -199 ☔ View full report in Codecov by Sentry. |
# and has a tendency to segfault. | ||
# To address this, shorten the bytes sent to the tokenizer to a valid | ||
# UTF-8 value | ||
# I hope this will not bite us with some subtle other bug in future |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not very optimistic about this. This 'fix' almost certainly breaks recode()
when said fix kicks in. And fundamentally, these bytes came from the LLM, so why on earth is its tokeniser refusing to have anything to do with them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for investigating this Richard. I agree, this feels like potentially buggy behavior directly in llama-cpp. Do we have a repro for 934 that directly uses the llama-cpp
(or maybe llama-cpp-python
if we need to) bindings? Instead of attempting to fix through this route, a lower level repo might mean we could/should raise an issue on llama-cpp?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And filed the LlamaCpp bug:
ggerganov/llama.cpp#8691
def test_with_multitokenchars(selected_model: guidance.models.Model): | ||
# Taken from https://github.com/guidance-ai/guidance/issues/934 | ||
lm = selected_model | ||
lm += "歪" + select(["打正着", "门邪道"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the record:
>>> a
'打'
>>> b
'门'
>>> a.encode()
b'\xe6\x89\x93'
>>> b.encode()
b'\xe9\x97\xa8'
So the two leading characters in the select()
do not share any common bytes here.
I have filed a bug on the HF Hub model: |
Digging into #934