pub struct TokenBias(/* private fields */);
Expand description
A list of tokens to bias during the process of inferencing.
When a biased token is encountered, the bias will be used instead of the inferred logit during the sampling process.
This can be used to disable the generation of responses with specific tokens by setting their corresponding bias to -1.0.
Implementations§
Trait Implementations§
Source§impl FromStr for TokenBias
impl FromStr for TokenBias
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
A comma separated list of token biases. The list should be in the format “TID=BIAS,TID=BIAS” where TID is an integer token ID and BIAS is a floating point number. For example, “1=-1.0,2=-1.0” sets the bias for token IDs 1 (start of document) and 2 (end of document) to -1.0 which effectively disables the model from generating responses containing those token IDs.
impl StructuralPartialEq for TokenBias
Auto Trait Implementations§
impl Freeze for TokenBias
impl RefUnwindSafe for TokenBias
impl Send for TokenBias
impl Sync for TokenBias
impl Unpin for TokenBias
impl UnwindSafe for TokenBias
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