Skip to contents

Loads a model for a transformer with the passed type.

Usage

aife_transformer.load_model(
  type,
  model_dir,
  from_tf,
  load_safe,
  add_pooler = FALSE
)

Arguments

type

string A type of the transformer. Allowed types are bert, roberta, funnel, longformer, mpnet, modernbert. See AIFETrType list.

model_dir

string Path to the directory where the original model is stored. Allowed values: any

from_tf

bool Whether to load the model weights from a TensorFlow checkpoint save file.

load_safe

bool Whether or not to use safetensors checkpoints.

add_pooler

bool Whether to add a pooling layer, FALSE by default.

Value

If success - a transformer model, otherwise - an error (passed type is invalid).