model_bert_pretrained | R Documentation |
Construct a BERT model (using model_bert()
) and load pretrained weights.
model_bert_pretrained(bert_type = "bert_tiny_uncased", redownload = FALSE)
bert_type |
Character; which flavor of BERT to use. See
|
redownload |
Logical; should the weights be downloaded fresh even if they're cached? |
The model with pretrained weights loaded.
initialize
Initialize this model. This method is called when the model is first created.
forward
Use this model. This method is called during training, and
also during prediction. x
is a list of torch::torch_tensor()
values for
token_ids
and token_type_ids
.
.get_tokenizer_metadata
Look up the tokenizer metadata for this
model. This method is called automatically when
luz_callback_bert_tokenize()
validates that a dataset is tokenized
properly for this model.
.load_weights
Load the pretrained weights for this model. This method is called automatically during initialization of this model.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.