Struct llama_cpp_2::context::sample::Sampler
source · pub struct Sampler<'grammar> { /* private fields */ }
👎Deprecated since 0.1.32: this does not scale well with many params and does not allow for changing of orders.
Expand description
struct to hold params for sampling
Implementations§
source§impl<'grammar> Sampler<'grammar>
impl<'grammar> Sampler<'grammar>
sourcepub fn new(llama_token_data_array: LlamaTokenDataArray) -> Self
👎Deprecated since 0.1.32: this does not scale well with many params and does not allow for changing of orders.
pub fn new(llama_token_data_array: LlamaTokenDataArray) -> Self
Create a new sampler.
sourcepub fn with_grammar(self, grammar: &'grammar mut LlamaGrammar) -> Self
👎Deprecated since 0.1.32: this does not scale well with many params and does not allow for changing of orders.
pub fn with_grammar(self, grammar: &'grammar mut LlamaGrammar) -> Self
Set the grammar for sampling.
sourcepub fn with_temperature(self, temperature: f32) -> Self
👎Deprecated since 0.1.32: this does not scale well with many params and does not allow for changing of orders.
pub fn with_temperature(self, temperature: f32) -> Self
Set the temperature for sampling.
let _sampler = Sampler::new(LlamaTokenDataArray::new(vec![LlamaTokenData::new(LlamaToken(0), 0.0, 0.0)], false))
.with_temperature(0.5);
Trait Implementations§
Auto Trait Implementations§
impl<'grammar> RefUnwindSafe for Sampler<'grammar>
impl<'grammar> Send for Sampler<'grammar>
impl<'grammar> Sync for Sampler<'grammar>
impl<'grammar> Unpin for Sampler<'grammar>
impl<'grammar> !UnwindSafe for Sampler<'grammar>
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