Skip to content

Commit 6f50477

Browse files
authored
Merge pull request #763 from yujonglee/swa
Add swa_full
2 parents b6daecb + c9fcbb8 commit 6f50477

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
@@ -514,6 +514,36 @@ impl LlamaContextParams {
514514
pub fn pooling_type(&self) -> LlamaPoolingType {
515515
LlamaPoolingType::from(self.context_params.pooling_type)
516516
}
517+
518+
/// Set whether to use full sliding window attention
519+
///
520+
/// # Examples
521+
///
522+
/// ```rust
523+
/// use llama_cpp_2::context::params::LlamaContextParams;
524+
/// let params = LlamaContextParams::default()
525+
/// .with_swa_full(false);
526+
/// assert_eq!(params.swa_full(), false);
527+
/// ```
528+
#[must_use]
529+
pub fn with_swa_full(mut self, enabled: bool) -> Self {
530+
self.context_params.swa_full = enabled;
531+
self
532+
}
533+
534+
/// Get whether full sliding window attention is enabled
535+
///
536+
/// # Examples
537+
///
538+
/// ```rust
539+
/// use llama_cpp_2::context::params::LlamaContextParams;
540+
/// let params = LlamaContextParams::default();
541+
/// assert_eq!(params.swa_full(), true);
542+
/// ```
543+
#[must_use]
544+
pub fn swa_full(&self) -> bool {
545+
self.context_params.swa_full
546+
}
517547
}
518548

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

0 commit comments

Comments
 (0)