Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses the basic text-generation example in #1803.
The example fails on a real GGUF at the first call to the removed
llama_evalAPI. It now loads the model vocabulary, decodes the prompt in batches, and samples from the last token's logits using the public sampler chain. Output is decoded incrementally so a UTF-8 character can span several tokens. The example's README includes the installation command and theMODELenvironment variable. The interactive chat example is tracked separately in #1817.Tested on Windows with the CPU backend and two GGUF models. The default prompt produced 20 new tokens with stories15M. A Chinese prompt produced 8 new tokens with Qwen3.5-0.8B. A 510-token prompt filled 22 batches and generated the two tokens that still fit in the context. I also checked rejection of full and oversized prompts, a four-piece UTF-8 character, a 128-byte token piece, EOG handling, and resource release. Black, Ruff and
git diff --checkpassed for the changed files.