Skip to content

Commit d83319c

Browse files
authored
Merge branch 'main' into feat/expose-ggml-kv-types
2 parents 615ab2e + e2accc4 commit d83319c

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

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

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,11 +669,36 @@ impl LlamaContextParams {
669669
self.context_params.swa_full
670670
}
671671

672-
/// Set the KV cache data type for K
672+
/// Set the max number of sequences (i.e. distinct states for recurrent models)
673+
///
674+
/// # Examples
675+
///
676+
/// ```rust
677+
/// use llama_cpp_2::context::params::LlamaContextParams;
678+
/// let params = LlamaContextParams::default()
679+
/// .with_n_seq_max(64);
680+
/// assert_eq!(params.n_seq_max(), 64);
681+
/// ```
682+
#[must_use]
683+
pub fn with_n_seq_max(mut self, n_seq_max: u32) -> Self {
684+
self.context_params.n_seq_max = n_seq_max;
685+
self
686+
}
687+
688+
/// Get the max number of sequences (i.e. distinct states for recurrent models)
673689
///
674690
/// # Examples
675691
///
676692
/// ```rust
693+
/// use llama_cpp_2::context::params::LlamaContextParams;
694+
/// let params = LlamaContextParams::default();
695+
/// assert_eq!(params.n_seq_max(), 1);
696+
/// ```
697+
#[must_use]
698+
pub fn n_seq_max(&self) -> u32 {
699+
self.context_params.n_seq_max
700+
}
701+
/// Set the KV cache data type for K
677702
/// use llama_cpp_2::context::params::{LlamaContextParams, KvCacheType};
678703
/// let params = LlamaContextParams::default().with_type_k(KvCacheType::Q4_0);
679704
/// assert_eq!(params.type_k(), KvCacheType::Q4_0);

0 commit comments

Comments
 (0)