pub struct ModelOptions { /* private fields */ }
Implementations§
Source§impl ModelOptions
impl ModelOptions
Sourcepub fn mirostat(self, mirostat: u8) -> Self
pub fn mirostat(self, mirostat: u8) -> Self
Enable Mirostat sampling for controlling perplexity. (default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)
Sourcepub fn mirostat_eta(self, mirostat_eta: f32) -> Self
pub fn mirostat_eta(self, mirostat_eta: f32) -> Self
Influences how quickly the algorithm responds to feedback from the generated text. A lower learning rate will result in slower adjustments, while a higher learning rate will make the algorithm more responsive. (Default: 0.1)
Sourcepub fn mirostat_tau(self, mirostat_tau: f32) -> Self
pub fn mirostat_tau(self, mirostat_tau: f32) -> Self
Controls the balance between coherence and diversity of the output. A lower value will result in more focused and coherent text. (Default: 5.0)
Sourcepub fn num_ctx(self, num_ctx: u64) -> Self
pub fn num_ctx(self, num_ctx: u64) -> Self
Sets the size of the context window used to generate the next token. (Default: 2048)
Sourcepub fn num_gqa(self, num_gqa: u32) -> Self
pub fn num_gqa(self, num_gqa: u32) -> Self
The number of GQA groups in the transformer layer. Required for some models, for example it is 8 for llama2:70b
Sourcepub fn num_gpu(self, num_gpu: u32) -> Self
pub fn num_gpu(self, num_gpu: u32) -> Self
The number of layers to send to the GPU(s). On macOS it defaults to 1 to enable metal support, 0 to disable.
Sourcepub fn num_thread(self, num_thread: u32) -> Self
pub fn num_thread(self, num_thread: u32) -> Self
Sets the number of threads to use during computation. By default, Ollama will detect this for optimal performance. It is recommended to set this value to the number of physical CPU cores your system has (as opposed to the logical number of cores).
Sourcepub fn repeat_last_n(self, repeat_last_n: i32) -> Self
pub fn repeat_last_n(self, repeat_last_n: i32) -> Self
Sets how far back for the model to look back to prevent repetition. (Default: 64, 0 = disabled, -1 = num_ctx)
Sourcepub fn repeat_penalty(self, repeat_penalty: f32) -> Self
pub fn repeat_penalty(self, repeat_penalty: f32) -> Self
Sets how strongly to penalize repetitions. A higher value (e.g., 1.5) will penalize repetitions more strongly, while a lower value (e.g., 0.9) will be more lenient. (Default: 1.1)
Sourcepub fn temperature(self, temperature: f32) -> Self
pub fn temperature(self, temperature: f32) -> Self
The temperature of the model. Increasing the temperature will make the model answer more creatively. (Default: 0.8)
Sourcepub fn seed(self, seed: i32) -> Self
pub fn seed(self, seed: i32) -> Self
Sets the random number seed to use for generation. Setting this to a specific number will make the model generate the same text for the same prompt. (Default: 0)
Sourcepub fn stop(self, stop: Vec<String>) -> Self
pub fn stop(self, stop: Vec<String>) -> Self
Sets the stop sequences to use. When this pattern is encountered the LLM will stop generating text and return. Multiple stop patterns may be set by specifying multiple separate stop
parameters in a modelfile.
Sourcepub fn tfs_z(self, tfs_z: f32) -> Self
pub fn tfs_z(self, tfs_z: f32) -> Self
Tail free sampling is used to reduce the impact of less probable tokens from the output. A higher value (e.g., 2.0) will reduce the impact more, while a value of 1.0 disables this setting. (default: 1)
Sourcepub fn num_predict(self, num_predict: i32) -> Self
pub fn num_predict(self, num_predict: i32) -> Self
Maximum number of tokens to predict when generating text. (Default: 128, -1 = infinite generation, -2 = fill context)
Trait Implementations§
Source§impl Clone for ModelOptions
impl Clone for ModelOptions
Source§fn clone(&self) -> ModelOptions
fn clone(&self) -> ModelOptions
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ModelOptions
impl Debug for ModelOptions
Source§impl Default for ModelOptions
impl Default for ModelOptions
Source§fn default() -> ModelOptions
fn default() -> ModelOptions
Source§impl<'de> Deserialize<'de> for ModelOptions
impl<'de> Deserialize<'de> for ModelOptions
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ModelOptions
impl RefUnwindSafe for ModelOptions
impl Send for ModelOptions
impl Sync for ModelOptions
impl Unpin for ModelOptions
impl UnwindSafe for ModelOptions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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