pub struct RetNetConfig {Show 31 fields
pub vocab_size: usize,
pub hidden_size: usize,
pub num_hidden_layers: usize,
pub num_heads: usize,
pub intermediate_size: usize,
pub hidden_act: String,
pub hidden_dropout_prob: f32,
pub attention_dropout_prob: f32,
pub max_position_embeddings: usize,
pub initializer_range: f32,
pub layer_norm_eps: f32,
pub pad_token_id: u32,
pub bos_token_id: u32,
pub eos_token_id: u32,
pub use_bias: bool,
pub use_glu: bool,
pub use_norm_bias: bool,
pub deepnorm: bool,
pub dropout_module: String,
pub activation_dropout: f32,
pub attention_dropout: f32,
pub retention_heads: usize,
pub value_factor: f32,
pub gate_fn: String,
pub tensor_parallel_degree: usize,
pub sequence_parallel: bool,
pub fuse_norm: bool,
pub no_output_layer: bool,
pub layernorm_embedding: bool,
pub chunking: bool,
pub chunk_size: usize,
}Expand description
RetNet model configuration Reference: “Retentive Network: A Successor to Transformer for Large Language Models”
Fields§
§vocab_size: usize§num_heads: usize§intermediate_size: usize§attention_dropout_prob: f32§max_position_embeddings: usize§initializer_range: f32§layer_norm_eps: f32§pad_token_id: u32§bos_token_id: u32§eos_token_id: u32§use_bias: bool§use_glu: bool§use_norm_bias: bool§deepnorm: bool§dropout_module: String§activation_dropout: f32§attention_dropout: f32§retention_heads: usize§value_factor: f32§gate_fn: String§tensor_parallel_degree: usize§sequence_parallel: bool§fuse_norm: bool§no_output_layer: bool§layernorm_embedding: bool§chunking: bool§chunk_size: usizeImplementations§
Source§impl RetNetConfig
impl RetNetConfig
Sourcepub fn retnet_small() -> Self
pub fn retnet_small() -> Self
RetNet-Small configuration (1.3B parameters)
Sourcepub fn retnet_medium() -> Self
pub fn retnet_medium() -> Self
RetNet-Medium configuration (2.7B parameters)
Sourcepub fn retnet_large() -> Self
pub fn retnet_large() -> Self
RetNet-Large configuration (6.7B parameters)
Sourcepub fn retnet_long() -> Self
pub fn retnet_long() -> Self
Long-context RetNet for extended sequences
Sourcepub fn retention_head_dim(&self) -> usize
pub fn retention_head_dim(&self) -> usize
Get the retention head dimension
Sourcepub fn retention_dim(&self) -> usize
pub fn retention_dim(&self) -> usize
Get the effective head dimension for retention
Sourcepub fn uses_chunking(&self) -> bool
pub fn uses_chunking(&self) -> bool
Check if using efficient chunked processing
Sourcepub fn memory_advantage(&self) -> f32
pub fn memory_advantage(&self) -> f32
Get memory complexity advantage over attention
Sourcepub fn supports_long_sequences(&self) -> bool
pub fn supports_long_sequences(&self) -> bool
Check if configuration supports very long sequences
Sourcepub fn deepnorm_alpha(&self) -> f32
pub fn deepnorm_alpha(&self) -> f32
Get the deepnorm scaling factor
Sourcepub fn deepnorm_beta(&self) -> f32
pub fn deepnorm_beta(&self) -> f32
Get the deepnorm beta factor
Trait Implementations§
Source§impl Clone for RetNetConfig
impl Clone for RetNetConfig
Source§fn clone(&self) -> RetNetConfig
fn clone(&self) -> RetNetConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Config for RetNetConfig
impl Config for RetNetConfig
Source§impl Debug for RetNetConfig
impl Debug for RetNetConfig
Source§impl Default for RetNetConfig
impl Default for RetNetConfig
Source§impl<'de> Deserialize<'de> for RetNetConfig
impl<'de> Deserialize<'de> for RetNetConfig
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
Auto Trait Implementations§
impl Freeze for RetNetConfig
impl RefUnwindSafe for RetNetConfig
impl Send for RetNetConfig
impl Sync for RetNetConfig
impl Unpin for RetNetConfig
impl UnsafeUnpin for RetNetConfig
impl UnwindSafe for RetNetConfig
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ConfigSerializable for Twhere
T: Serialize + for<'de> Deserialize<'de>,
impl<T> ConfigSerializable for Twhere
T: Serialize + for<'de> Deserialize<'de>,
Source§fn save_to_file(&self, path: &Path) -> Result<(), TrustformersError>
fn save_to_file(&self, path: &Path) -> Result<(), TrustformersError>
Save to file
Source§fn load_from_file(path: &Path) -> Result<Self, TrustformersError>where
Self: Sized,
fn load_from_file(path: &Path) -> Result<Self, TrustformersError>where
Self: Sized,
Load from file
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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