pub struct SparseMaskBuilder { /* private fields */ }Expand description
Builder for creating sparse masks
Implementations§
Source§impl SparseMaskBuilder
impl SparseMaskBuilder
pub fn new(n: usize) -> Self
Sourcepub fn with_local_window(self, window_size: usize) -> Self
pub fn with_local_window(self, window_size: usize) -> Self
Add local window pattern
Sourcepub fn with_global_tokens(self, global_indices: &[usize]) -> Self
pub fn with_global_tokens(self, global_indices: &[usize]) -> Self
Add global tokens (all positions attend to these)
Sourcepub fn with_causal(self) -> Self
pub fn with_causal(self) -> Self
Add causal masking
Sourcepub fn build(self) -> AttentionMask
pub fn build(self) -> AttentionMask
Build the mask
Auto Trait Implementations§
impl Freeze for SparseMaskBuilder
impl RefUnwindSafe for SparseMaskBuilder
impl Send for SparseMaskBuilder
impl Sync for SparseMaskBuilder
impl Unpin for SparseMaskBuilder
impl UnwindSafe for SparseMaskBuilder
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