Skip to content

Commit e2accc4

Browse files
authored
Merge pull request #816 from darjus/main
Add with_n_seq_max and n_seq_max to LlamaContextParams
2 parents aa42d89 + c4256da commit e2accc4

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

llama-cpp-2/src/context/params.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,36 @@ impl LlamaContextParams {
544544
pub fn swa_full(&self) -> bool {
545545
self.context_params.swa_full
546546
}
547+
548+
/// Set the max number of sequences (i.e. distinct states for recurrent models)
549+
///
550+
/// # Examples
551+
///
552+
/// ```rust
553+
/// use llama_cpp_2::context::params::LlamaContextParams;
554+
/// let params = LlamaContextParams::default()
555+
/// .with_n_seq_max(64);
556+
/// assert_eq!(params.n_seq_max(), 64);
557+
/// ```
558+
#[must_use]
559+
pub fn with_n_seq_max(mut self, n_seq_max: u32) -> Self {
560+
self.context_params.n_seq_max = n_seq_max;
561+
self
562+
}
563+
564+
/// Get the max number of sequences (i.e. distinct states for recurrent models)
565+
///
566+
/// # Examples
567+
///
568+
/// ```rust
569+
/// use llama_cpp_2::context::params::LlamaContextParams;
570+
/// let params = LlamaContextParams::default();
571+
/// assert_eq!(params.n_seq_max(), 1);
572+
/// ```
573+
#[must_use]
574+
pub fn n_seq_max(&self) -> u32 {
575+
self.context_params.n_seq_max
576+
}
547577
}
548578

549579
/// Default parameters for `LlamaContext`. (as defined in llama.cpp by `llama_context_default_params`)

0 commit comments

Comments
 (0)