pub struct Lfm2Block {
pub operator_norm: RMSNorm,
pub op: Lfm2LayerOp,
pub ffn_norm: RMSNorm,
pub mlp: MLP,
}Expand description
LFM2 block: x + op(norm(x)) then h + mlp(norm(h)).
Fields§
§operator_norm: RMSNormNorm before the operator.
op: Lfm2LayerOpConvolution or attention.
ffn_norm: RMSNormNorm before the MLP.
mlp: MLPFeed-forward.
Implementations§
Source§impl Lfm2Block
impl Lfm2Block
Sourcepub fn forward(
&self,
engine: &ComputeEngine,
x: &Tensor,
pos: usize,
cache: Option<&KVCacheLayer>,
mask: Option<&UnifiedTensor>,
) -> Tensor
pub fn forward( &self, engine: &ComputeEngine, x: &Tensor, pos: usize, cache: Option<&KVCacheLayer>, mask: Option<&UnifiedTensor>, ) -> Tensor
Runs the block; pos, cache and mask are used by attention layers.
Sourcepub fn lora_params(&self) -> Vec<Tensor>
pub fn lora_params(&self) -> Vec<Tensor>
Only the LoRA adapter tensors (what LoRA fine-tuning updates).
Auto Trait Implementations§
impl !RefUnwindSafe for Lfm2Block
impl !Send for Lfm2Block
impl !Sync for Lfm2Block
impl !UnwindSafe for Lfm2Block
impl Freeze for Lfm2Block
impl Unpin for Lfm2Block
impl UnsafeUnpin for Lfm2Block
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
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> ⓘ
Converts
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> ⓘ
Converts
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