Skip to content

Disable special tokens in ollama completion when counting tokens - #3170

Merged
2 commits merged into
BerriAI:mainfrom
rick-github:ollama-special-symbol
Apr 20, 2024
Merged

Disable special tokens in ollama completion when counting tokens#3170
2 commits merged into
BerriAI:mainfrom
rick-github:ollama-special-symbol

Conversation

@rick-github

Copy link
Copy Markdown
Contributor

Some(?) models (eg, codegemma) don't return a prompt_eval_count field, so ollama.py tries to compute the value based on encoding of the prompt. Unfortunately FIM symbols used in the prompt (eg, "<|fim_prefix|>") cause the encoder to throw an exception, so we disable special processing.

Some(?) models (eg, codegemma) don't return a prompt_eval_count field, so ollama.py tries to compute the value based on encoding of the prompt.  Unfortunately FIM symbols used in the prompt (eg, "<|fim_prefix|>") cause the encoder to throw an exception, so we disable special processing.
@vercel

vercel Bot commented Apr 19, 2024

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 19, 2024 10:51pm

@ghost
ghost merged commit 78579d4 into BerriAI:main Apr 20, 2024
@ghost

ghost commented Apr 20, 2024

Copy link
Copy Markdown

lgtm!

This pull request was closed.
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