Skip to contents

This function is designed to download and load a pre-trained transformer model using the transformers Python library via the reticulate package. It checks for the availability of the required Python package and then downloads the specified transformer model.

Usage

get_transformer_model(model_name = "jinaai/jina-embeddings-v2-base-en")

Arguments

model_name

The name of the transformer model to download. This should be in the format "username/modelname" as recognized by the transformers library. Default is "jinaai/jina-embeddings-v2-base-en".

Value

An object of the downloaded transformer model.

Note

Users of this function need to ensure that the Python environment is set up with the 'transformers' package installed. The function uses the 'reticulate' R package to interface with Python and the user may need to configure it accordingly.

Examples

if (FALSE) {
# To get the default transformer model:
get_transformer_model()

# To get a custom transformer model by specifying the model name:
get_transformer_model("bert-base-uncased")
}