pub enum ResidualsConfig {
Standard,
MultiGate {
n_stream: usize,
init_bias: f64,
per_virtual_layer: bool,
},
}Expand description
Configuration / factory for Residuals.
Variants§
Standard
Plain additive Pre-LN residual.
MultiGate
Multi-Gate Residuals over n_stream streams.
Fields
§
init_bias: f64Initial gate bias (see MultiGateResidualConfig::init_bias).
§
per_virtual_layer: booltrue ⇒ one MGR per virtual layer; false ⇒ one per real layer
(reused across virtual passes). See MultiGate::per_virtual.
Implementations§
Source§impl ResidualsConfig
impl ResidualsConfig
Sourcepub fn init(
&self,
d_model: usize,
n_real_layers: usize,
n_virtual_layers: usize,
device: &Device,
) -> Residuals
pub fn init( &self, d_model: usize, n_real_layers: usize, n_virtual_layers: usize, device: &Device, ) -> Residuals
Build the runtime Residuals for a stack of n_real_layers real weight
sets unrolled over n_virtual_layers (virtual) passes. The MGR module
count follows per_virtual_layer (one per virtual layer vs one per real
layer).
Trait Implementations§
Source§impl Clone for ResidualsConfig
impl Clone for ResidualsConfig
Source§impl Config for ResidualsConfig
impl Config for ResidualsConfig
§fn load_binary(data: &[u8]) -> Result<Self, ConfigError>
fn load_binary(data: &[u8]) -> Result<Self, ConfigError>
Loads the configuration from a binary buffer. Read more
Source§impl Debug for ResidualsConfig
impl Debug for ResidualsConfig
Source§impl<'de> Deserialize<'de> for ResidualsConfig
impl<'de> Deserialize<'de> for ResidualsConfig
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ResidualsConfig
impl Display for ResidualsConfig
Auto Trait Implementations§
impl Freeze for ResidualsConfig
impl RefUnwindSafe for ResidualsConfig
impl Send for ResidualsConfig
impl Sync for ResidualsConfig
impl Unpin for ResidualsConfig
impl UnsafeUnpin for ResidualsConfig
impl UnwindSafe for ResidualsConfig
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