Expand description
Ties kimi_tokenizer::KimiTokenizer, kimi_decoder::kimi_forward_token,
and sampling::Sampler into a real text-in/text-out generation loop
for Kimi K3 – the piece that turns “a decoder that can run one
forward pass given weights and a token id” into something a CLI or
server can actually use for a prompt. Mirrors the shape of
ferrox-server::generate’s loop (encode prompt, decode incrementally,
sample each step, stop at max tokens or EOS, decode the output ids)
but against kimi_decoder’s separate per-token state/forward-pass
API rather than ferrox_core::cache::KvCache.
Functions§
- kimi_
generate - Encodes
prompt, runs it through the decoder to primeKimiDecodeState, then samples up tomax_new_tokensfurther tokens (greedy ifsampling.temperature <= 0.0, matchingSampler::sample’s convention), stopping early ifeos_idis produced. Returns the newly generated text (not including the prompt) and the raw generated token ids, since a caller may want both (e.g. to reportfinish_reason/token counts the wayferrox-serverdoes for its GGUF path).