8000 Document Sampler · masmullin2000/llama_cpp-rs@261f397 · GitHub
[go: up one dir, main page]

Skip to content

Commit 261f397

Browse files
committed
Document Sampler
1 parent d71582d commit 261f397

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

crates/llama_cpp/src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,13 @@ pub struct Token(pub i32);
112112
#[error("an internal assertion failed in llama.cpp; check `tracing` output.")]
113113
pub struct LlamaInternalError;
114114

115-
/// This needs to be documented!
115+
/// Something which selects a [`Token`] from the distribution output by a
116+
/// [`LlamaModel`].
116117
pub trait Sampler {
117-
/// This needs to be documented!
118+
/// Given a [`llama_context`], the tokens in context (to allow for
119+
/// repetition penalities), and a [`llama_token_data_array`] (which contains
120+
/// the distribution over the next token as output by the model), selects a
121+
/// token.
118122
fn sample(
119123
&mut self,
120124
context: *mut llama_context,

0 commit comments

Comments
 (0)
0