pub struct GenerationConfig {
pub max_new_tokens: usize,
pub eos_token_id: Option<u32>,
}Expand description
Generation limits and stop conditions for generate.
Fields§
§max_new_tokens: usizeHard cap on how many new tokens to produce, regardless of whether an end-of-sequence token is ever sampled. Prevents an unbounded loop when a model or prompt never naturally reaches its EOS token.
eos_token_id: Option<u32>A token id that ends generation immediately when sampled — the
sampled token itself is not appended to the output or passed to
on_token, matching the usual convention that EOS is control
metadata, not part of the visible completion. Typically
tokenizer.ggml.eos_token_id from the model’s GGUF metadata.
Trait Implementations§
Source§impl Clone for GenerationConfig
impl Clone for GenerationConfig
Source§fn clone(&self) -> GenerationConfig
fn clone(&self) -> GenerationConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GenerationConfig
impl Debug for GenerationConfig
Auto Trait Implementations§
impl Freeze for GenerationConfig
impl RefUnwindSafe for GenerationConfig
impl Send for GenerationConfig
impl Sync for GenerationConfig
impl Unpin for GenerationConfig
impl UnsafeUnpin for GenerationConfig
impl UnwindSafe for GenerationConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more