Instructions to use 1112lee/kaggle with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use 1112lee/kaggle with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("openai-community/gpt2-medium") model = PeftModel.from_pretrained(base_model, "1112lee/kaggle") - Notebooks
- Google Colab
- Kaggle
Download working/peft/docs/source/package_reference/p_tuning.md from 1112lee/kaggle: direct link, hf CLI and curl.
- Browser
- Download file 2.2 kB
-
https://huggingface.co/1112lee/kaggle/resolve/main/working/peft/docs/source/package_reference/p_tuning.md
- Command line
-
hf download hf://1112lee/kaggle/working/peft/docs/source/package_reference/p_tuning.md
-
curl -L -o p_tuning.md https://huggingface.co/1112lee/kaggle/resolve/main/working/peft/docs/source/package_reference/p_tuning.md
P-tuning
P-tuning adds trainable prompt embeddings to the input that is optimized by a prompt encoder to find a better prompt, eliminating the need to manually design prompts. The prompt tokens can be added anywhere in the input sequence, and p-tuning also introduces anchor tokens for improving performance.
The abstract from the paper is:
While GPTs with traditional fine-tuning fail to achieve strong results on natural language understanding (NLU), we show that GPTs can be better than or comparable to similar-sized BERTs on NLU tasks with a novel method P-tuning -- which employs trainable continuous prompt embeddings. On the knowledge probing (LAMA) benchmark, the best GPT recovers 64% (P@1) of world knowledge without any additional text provided during test time, which substantially improves the previous best by 20+ percentage points. On the SuperGlue benchmark, GPTs achieve comparable and sometimes better performance to similar-sized BERTs in supervised learning. Importantly, we find that P-tuning also improves BERTs' performance in both few-shot and supervised settings while largely reducing the need for prompt engineering. Consequently, P-tuning outperforms the state-of-the-art approaches on the few-shot SuperGlue benchmark..
PromptEncoderConfig
[[autodoc]] tuners.p_tuning.config.PromptEncoderConfig
PromptEncoder
[[autodoc]] tuners.p_tuning.model.PromptEncoder