Prompt Tuning
4 memberslucid.peft.tuners.prompt_tuninglucid.peft.tuners.prompt_tuning — prompt tuning: learned embeddings in front of the input.
Prompt tuning (Lester et al., 2021, arXiv:2104.08691) freezes the model and learns
num_virtual_tokens embedding vectors that are put in front of the input embeddings. The only
trained parameters are num_virtual_tokens * token_dim numbers, so a task is a file of that size.
The prompt starts from text, from sampled vocabulary rows or at random (PromptTuningInit).
Pick it for the smallest per-task files on a large model; it adds no layer, and trains one prompt at
a time.
The prompt is applied by hooks on the model's own call. Here: PromptEmbedding (what is
learned) and PromptTuningModel (the tuner). PromptTuningConfig and PromptTuningInit are
here too and exported from lucid.peft.
Lester, Brian, et al. "The Power of Scale for Parameter-Efficient Prompt Tuning." [arXiv:2104.08691](https://arxiv.org/abs/2104.08691), 2021.
Prompt tuning (Lester et al., 2021, arXiv:2104.08691) freezes the model and
learns num_virtual_tokens embedding vectors that are put in front of
the input embeddings: the only trained parameters are
num_virtual_tokens * token_dim numbers, and a task is a file of that size.
An encoder-decoder model gets them in front of the encoder's input.
Classes
PromptTuningConfigHow lucid.peft.get_peft_model adapts a model with prompt tuning.
PromptTuningInit3 methodsHow the prompt's rows start: from TEXT, SAMPLE_VOCAB tokens, or RANDOM.
PromptEmbedding10 methodsThe prompt of prompt tuning: one learned embedding per virtual token.
PromptTuningModel11 methodsThe tuner of prompt tuning: a PromptEmbedding per adapter, put in front of the input.