Skip to content

llama-diffusion-cli: read n_ctx back after making llama_context so the cli doesn't reject all input without -c - #21939

Merged
am17an merged 1 commit into
ggml-org:masterfrom
smashedpumpkin:master
Apr 15, 2026
Merged

am17an merged 1 commit into
ggml-org:masterfrom
smashedpumpkin:master

Conversation

@smashedpumpkin

Copy link
Copy Markdown
Contributor

Overview

Read back via llama_n_ctx the context window size that llama_init_from_model determines, as mentioned in comments for llama_n_ctx. The prevents the cli from rejecting all inputs because it thinks the context window is 0 length.

Additional information

I ran into the issue described in #20407 myself and the fix seemed straightforward, so I did it. @am17an - sorry for the random PR, it's very minor.

Tested on a mac like so:

./build/bin/llama-diffusion-cli -m Dream-v0-Instruct-7B-Q4_K_M.gguf -p "Why did the chicken cross the road?" --temp 0.2 --diffusion-algorithm 0 --diffusion-alg-temp 0.2 -ngl 99 --top_p 0.95 --diffusion-steps 128 --diffusion-eps 0.001

Before:
error: input too long (27 tokens), max context is 0

After:
To get to the other side.

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: NO, I somehow typed all 20 chars of it by myself.

@am17an am17an left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@CISC CISC linked an issue Apr 15, 2026 that may be closed by this pull request
@am17an
am17an merged commit e39eba2 into ggml-org:master Apr 15, 2026
8 of 50 checks passed
@smashedpumpkin

Copy link
Copy Markdown
Contributor Author

thanks @am17an & @CISC, I appreciate the no-hassles merge. take care!

mengqin pushed a commit to mengqin/llama.cpp that referenced this pull request Apr 20, 2026
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
fukuro-kun pushed a commit to fukuro-kun/fukuro-llama-cpp-turboquant that referenced this pull request Jul 5, 2026
MrLordCat referenced this pull request in MrLordCat/llama.cpp-rdna-lab Jul 16, 2026
zommiommy pushed a commit to zommiommy/llama.cpp that referenced this pull request Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Eval bug: Cannot run Dream 7B diffusion model

3 participants