pub struct BeamSearchConfig {
pub beam_width: usize,
pub max_length: usize,
pub eos_token_id: Option<usize>,
pub length_penalty: f64,
pub min_length: usize,
pub vocab_size: usize,
pub temperature: f64,
pub top_k_filter: Option<usize>,
}Expand description
Configuration for beam search decoding.
Fields§
§beam_width: usizeNumber of beams to keep at each step.
max_length: usizeMaximum sequence length (inclusive).
eos_token_id: Option<usize>Optional end-of-sequence token ID. When a beam generates this token it is
moved to the completed list (subject to min_length).
length_penalty: f64Length penalty exponent α: score = log_prob / length^α.
1.0 gives simple length normalisation; 0.0 disables it.
min_length: usizeMinimum sequence length before EOS is allowed to terminate a beam.
vocab_size: usizeNumber of tokens in the vocabulary.
temperature: f64Temperature for logit scaling before softmax. 1.0 = no change.
top_k_filter: Option<usize>Optional top-k filter: only the top-k logits are kept per step.
Trait Implementations§
Source§impl Clone for BeamSearchConfig
impl Clone for BeamSearchConfig
Source§fn clone(&self) -> BeamSearchConfig
fn clone(&self) -> BeamSearchConfig
Returns a duplicate of the value. Read more
1.0.0 · 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 BeamSearchConfig
impl Debug for BeamSearchConfig
Auto Trait Implementations§
impl Freeze for BeamSearchConfig
impl RefUnwindSafe for BeamSearchConfig
impl Send for BeamSearchConfig
impl Sync for BeamSearchConfig
impl Unpin for BeamSearchConfig
impl UnsafeUnpin for BeamSearchConfig
impl UnwindSafe for BeamSearchConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more