pub struct AlbertEncoderConfig { /* private fields */ }Expand description
ALBERT encoder configuration.
Configuration for AlbertEncoder. ALBERT differs from an encoder like BERT in two ways:
- The embedding size can be different from the hidden size. A projection matrix is used when the sizes differ.
- A group of layers can share parameters. For instance, if the number of
layers (
n_hidden_layers) is 12 and the number of groups (n_hidden_groups) is 4, then layers 0..3, 3..6, 6..9, and 9..12 will share parameters.
Implementations§
Source§impl AlbertEncoderConfig
impl AlbertEncoderConfig
Sourcepub fn embeddings(self, embeddings: Box<dyn BuildEmbeddings>) -> Self
pub fn embeddings(self, embeddings: Box<dyn BuildEmbeddings>) -> Self
Encoder embeddings.
Default: TransformerEmbeddingsConfig::default()
Sourcepub fn layer_group(self, layer_group: Box<dyn BuildEncoderLayer>) -> Self
pub fn layer_group(self, layer_group: Box<dyn BuildEncoderLayer>) -> Self
Number of layers within a group.
Default: AlbertLayerGroupConfig::default()
Number of hidden groups.
Default: 1
Number of hidden layers.
Default: 12
Trait Implementations§
Source§impl BuildArchitecture for AlbertEncoderConfig
impl BuildArchitecture for AlbertEncoderConfig
Source§type Architecture = AlbertEncoder
type Architecture = AlbertEncoder
The architecture to build.
Source§fn build(&self, vb: VarBuilder<'_>) -> Result<Self::Architecture, BoxedError>
fn build(&self, vb: VarBuilder<'_>) -> Result<Self::Architecture, BoxedError>
Build the architecture.
Source§impl Debug for AlbertEncoderConfig
impl Debug for AlbertEncoderConfig
Auto Trait Implementations§
impl Freeze for AlbertEncoderConfig
impl !RefUnwindSafe for AlbertEncoderConfig
impl !Send for AlbertEncoderConfig
impl !Sync for AlbertEncoderConfig
impl Unpin for AlbertEncoderConfig
impl !UnwindSafe for AlbertEncoderConfig
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<D> BuildEncoder for D
impl<D> BuildEncoder for D
Source§type Encoder = <D as BuildArchitecture>::Architecture
type Encoder = <D as BuildArchitecture>::Architecture
Encoder type.
Source§fn build(
&self,
vb: VarBuilderArgs<'_, Box<dyn SimpleBackend + '_>>,
) -> Result<<D as BuildEncoder>::Encoder, Box<dyn Error + Sync + Send>>
fn build( &self, vb: VarBuilderArgs<'_, Box<dyn SimpleBackend + '_>>, ) -> Result<<D as BuildEncoder>::Encoder, Box<dyn Error + Sync + Send>>
Build an encoder.
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