Learn R Programming

aifeducation (version 1.0.2)

AIFETransformerMaker: R6 class for transformer creation

Description

This class was developed to make the creation of transformers easier for users. Pass the transformer's type to the make method and get desired transformer. Now run the create or/and train methods of the new transformer.

The already created aife_transformer_maker object of this class can be used.

See p.3 Transformer Maker in Transformers for Developers for details.

See .AIFEBaseTransformer class for details.

Arguments

Methods


Method make()

Creates a new transformer with the passed type.

Usage

AIFETransformerMaker$make(type)

Arguments

type

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

Returns

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


Method clone()

The objects of this class are cloneable with this method.

Usage

AIFETransformerMaker$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

See Also

Other Transformer: AIFETrType, aife_transformer_maker

Examples

Run this code
# Create transformer maker
tr_maker <- AIFETransformerMaker$new()

# Use 'make' method of the 'tr_maker' object
# Pass string with the type of transformers
# Allowed types are "bert", "deberta_v2", "funnel", etc. See aifeducation::AIFETrType list
my_bert <- tr_maker$make("bert")

# Or use elements of the 'aifeducation::AIFETrType' list
my_longformer <- tr_maker$make(AIFETrType$longformer)

# Run 'create' or 'train' methods of the transformer in order to create a
# new transformer or train the newly created one, respectively
# my_bert$create(...)
# my_bert$train(...)

# my_longformer$create(...)
# my_longformer$train(...)

Run the code above in your browser using DataLab