pub struct TransformerEmbeddingsConfig { /* private fields */ }Expand description
Configuration for transformer embedding layer.
Implementations§
Source§impl TransformerEmbeddingsConfig
impl TransformerEmbeddingsConfig
Sourcepub fn embedding_dropout(self, embedding_dropout: Box<dyn BuildModule>) -> Self
pub fn embedding_dropout(self, embedding_dropout: Box<dyn BuildModule>) -> Self
Dropout to apply to the embeddings.
Default: Identity.
Sourcepub fn embedding_layer_norm(
self,
embedding_layer_norm: Box<dyn BuildModule>,
) -> Self
pub fn embedding_layer_norm( self, embedding_layer_norm: Box<dyn BuildModule>, ) -> Self
Layer normalization to apply to the embeddings.
Default: Identity.
Sourcepub fn embedding_width(self, embedding_width: usize) -> Self
pub fn embedding_width(self, embedding_width: usize) -> Self
Width of the embeddings.
Default: 768.
Width of the transformer.
The embedding layer will use a projection if the hidden width is not equal to the embedding width.
Default: 768.
Sourcepub fn n_positions(self, n_positions: Option<usize>) -> Self
pub fn n_positions(self, n_positions: Option<usize>) -> Self
Number of position embeddings.
Default: None.
Sourcepub fn n_pieces(self, n_pieces: usize) -> Self
pub fn n_pieces(self, n_pieces: usize) -> Self
Vocabulary size (number of embeddings).
Default: 30000.
Sourcepub fn n_types(self, n_types: Option<usize>) -> Self
pub fn n_types(self, n_types: Option<usize>) -> Self
Token type vocabulary size (number of token type embeddings).
Default: None.
Sourcepub fn projection_dropout(
self,
projection_dropout: Box<dyn BuildModule>,
) -> Self
pub fn projection_dropout( self, projection_dropout: Box<dyn BuildModule>, ) -> Self
Dropout to apply after embedding projection.
Default: Identity.
Sourcepub fn projection_layer_norm(
self,
projection_layer_norm: Box<dyn BuildModule>,
) -> Self
pub fn projection_layer_norm( self, projection_layer_norm: Box<dyn BuildModule>, ) -> Self
Layer normalization to apply to the projection layer.
Default: Identity.
Trait Implementations§
Source§impl BuildEmbeddings for TransformerEmbeddingsConfig
impl BuildEmbeddings for TransformerEmbeddingsConfig
fn build(&self, vb: VarBuilder<'_>) -> Result<Box<dyn Embeddings>, BoxedError>
Source§impl Debug for TransformerEmbeddingsConfig
impl Debug for TransformerEmbeddingsConfig
Auto Trait Implementations§
impl Freeze for TransformerEmbeddingsConfig
impl !RefUnwindSafe for TransformerEmbeddingsConfig
impl !Send for TransformerEmbeddingsConfig
impl !Sync for TransformerEmbeddingsConfig
impl Unpin for TransformerEmbeddingsConfig
impl !UnwindSafe for TransformerEmbeddingsConfig
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