Skip to contents

Represents models based on DistilBERT.

Value

Does return a new object of this class.

References

Asnh, V., Debut, L., Chaumond, J. & Wolf, T. (2019). DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter. doi:10.48550/arXiv.1910.01108

Super classes

AIFEMaster -> AIFEBaseModel -> BaseModelCore -> BaseModelDistilBERT

Methods

Inherited methods


BaseModelDistilBERT$configure()

Configures a new object of this class. Please ensure that your chosen configuration comply with the following guidelines:

  • hidden_dim is a multiple of n_heads

Usage

BaseModelDistilBERT$configure(
  tokenizer,
  max_position_embeddings = 512L,
  dim = 768L,
  n_layers = 12L,
  n_heads = 12L,
  hidden_dim = 3072L,
  activation = "GELU",
  dropout = 0.1,
  attention_dropout = 0.1
)

Arguments

tokenizer

TokenizerBase Tokenizer for the model.

max_position_embeddings

int Number of maximum position embeddings. This parameter also determines the maximum length of a sequence which can be processed with the model. Allowed values:

\(10 <= x <= 4048\)

dim

int Number of neurons in each layer. This parameter determines the dimensionality of the resulting text embedding. Allowed values:

\(1 <= x <= 2048\)

n_layers

int Number of hidden layers. Allowed values:

\(1 <= x \)

n_heads

int determining the number of attention heads for a self-attention layer. Only relevant if attention_type='MultiHead' Allowed values:

\(0 <= x \)

hidden_dim

int determining the size of the projection layer within a each transformer encoder. Allowed values:

\(1 <= x \)

activation

string Name of the activation function. Allowed values:

  • 'GELU'

  • 'relu'

  • 'silu'

  • 'gelu_new'

dropout

double Ratio of dropout. Allowed values:

\(0 <= x <= 0.6\)

attention_dropout

double Ratio of dropout for attention probabilities. Allowed values:

\(0 <= x <= 0.6\)

Returns

Does nothing return.


BaseModelDistilBERT$get_n_layers()

Number of layers.

Usage

BaseModelDistilBERT$get_n_layers()

Returns

Returns an int describing the number of layers available for embedding.


BaseModelDistilBERT$get_final_size()

Size of the final layer.

Usage

BaseModelDistilBERT$get_final_size()

Returns

Returns an int describing the number of dimensions of the last hidden layer.


BaseModelDistilBERT$clone()

The objects of this class are cloneable with this method.

Usage

BaseModelDistilBERT$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.