pub struct DiverseBeamConfig {
pub beam_width: usize,
pub n_groups: usize,
pub max_steps: usize,
pub vocab_size: usize,
pub eos_id: usize,
pub diversity_strength: f32,
pub length_norm_alpha: f32,
}Expand description
Configuration for Diverse Beam Search (Vijayakumar et al. 2018).
Fields§
§beam_width: usizeTotal beam width B. Must be divisible by n_groups.
n_groups: usizeG: number of diversity groups. Each group gets beam_width / n_groups beams.
max_steps: usizeMaximum decoding steps.
vocab_size: usizeVocabulary size (number of tokens).
eos_id: usizeToken ID for end-of-sequence.
diversity_strength: f32λ: Hamming diversity penalty strength.
length_norm_alpha: f32GNMT-style length normalisation exponent. 0.0 = no normalisation.
Trait Implementations§
Source§impl Clone for DiverseBeamConfig
impl Clone for DiverseBeamConfig
Source§fn clone(&self) -> DiverseBeamConfig
fn clone(&self) -> DiverseBeamConfig
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 moreimpl Copy for DiverseBeamConfig
Auto Trait Implementations§
impl Freeze for DiverseBeamConfig
impl RefUnwindSafe for DiverseBeamConfig
impl Send for DiverseBeamConfig
impl Sync for DiverseBeamConfig
impl Unpin for DiverseBeamConfig
impl UnsafeUnpin for DiverseBeamConfig
impl UnwindSafe for DiverseBeamConfig
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