Open brittlewis12 opened 1 day ago
whoops, thought https://github.com/brittlewis12/llama-cpp-rs/pull/1 was a PR, didn't mean to review your fork!
no problem 😆 will open it up properly on your end
re: https://github.com/brittlewis12/llama-cpp-rs/pull/1#pullrequestreview-2323689876
would removing “last” from the names, so get_logits
& just candidates
, be more in line with your preferred naming conventions?
yeah, that matches what I've done elsewhere more closely.
Today, llama-cpp-2 exposes
llama_get_logits_ith
-basedcandidates_ith
.In working with the underlying library, I have leaned on the slightly different
llama_get_logits
. It seems that while the underlying library accepts-1
as input to the-ith
variant to accomplish the same asllama_get_logits
, the current implementation of safely ensuring logits are initialized for the givenllama_pos
disallows-1
as input as a side effect.Honestly, the existing implementation is sound as is, and I'd prefer to use the other, slightly simpler seam either way.
I took a quick stab at what this could look like, based on the existing pattern of a lower-level
unsafe
call and a higher level wrapper that returns an unsortedLlamaTokenData
iter for you.I tweaked the existing
simple
example to use this method without issue:Thank you as ever for your maintenance efforts here @MarcusDunn!
a little more background via llama.cpp: