Skip to content

Prompt Provider

class
ruprompts.prompt_provider.TensorPromptProvider
(init: typing_extensions.Literal['random', 'vocab'] = 'vocab')

Directly stores prompt embeddings as a tensor.

Parameters:

Name Type Description Default
init typing_extensions.Literal['random', 'vocab']

Initialization mode. Initializes embbeddings from random embeddings from vocabulary when set to vocab, randomly otherwise.

'vocab'

class
ruprompts.prompt_provider.LSTMPromptProvider
(hidden_dim: int = -1, input_dim: int = -1, num_lstm_layers: int = 2)

Generates prompt embeddings from LSTM and MLP.

Parameters:

Name Type Description Default
hidden_dim int

Hidden dim of LSTM. Defaults to embedding dim of backbone when set to -1.

-1
input_dim int

Input dim of LSTM. Defaults to embedding dim of backbone when set to -1.

-1
num_lstm_layers int

Number of LSTM layers.

2

class
ruprompts.prompt_provider.BasePromptProvider

Base class for all prompt providers.