From 5d7395e1b55a9b4b308ab0a4b0df818152148514 Mon Sep 17 00:00:00 2001 From: Alexander Borzunov Date: Tue, 24 Jan 2023 10:01:31 +0400 Subject: [PATCH] Prompt-tuning notebooks: suggest to use a smaller model for faster prototyping (#234) --- README.md | 4 ++-- examples/prompt-tuning-personachat.ipynb | 16 +++++++++++++--- examples/prompt-tuning-sst2.ipynb | 16 +++++++++++++--- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 7988473..0341fe5 100644 --- a/README.md +++ b/README.md @@ -61,8 +61,8 @@ You can also host [BLOOMZ](https://huggingface.co/bigscience/bloomz), a version Basic tutorials: - Getting started: [tutorial](https://colab.research.google.com/drive/1Ervk6HPNS6AYVr3xVdQnY5a-TjjmLCdQ?usp=sharing) -- Fine-tune BLOOM to be a personified chatbot: [tutorial](https://colab.research.google.com/github/bigscience-workshop/petals/blob/main/examples/prompt-tuning-personachat.ipynb) -- Fine-tune BLOOM for text semantic classification: [tutorial](https://colab.research.google.com/github/bigscience-workshop/petals/blob/main/examples/prompt-tuning-sst2.ipynb) +- Prompt-tune BLOOM to create a personified chatbot: [tutorial](https://colab.research.google.com/github/bigscience-workshop/petals/blob/main/examples/prompt-tuning-personachat.ipynb) +- Prompt-tune BLOOM for text semantic classification: [tutorial](https://colab.research.google.com/github/bigscience-workshop/petals/blob/main/examples/prompt-tuning-sst2.ipynb) Example apps built with Petals: diff --git a/examples/prompt-tuning-personachat.ipynb b/examples/prompt-tuning-personachat.ipynb index 943bb61..bd4d2ae 100644 --- a/examples/prompt-tuning-personachat.ipynb +++ b/examples/prompt-tuning-personachat.ipynb @@ -75,7 +75,18 @@ "metadata": {}, "outputs": [], "source": [ - "MODEL_NAME = \"bigscience/bloom-petals\" # select model you like\n", + "# Choose a model you'd like to prompt-tune. We recommend starting with\n", + "# the smaller 7.1B version of BLOOM (bigscience/bloom-7b1-petals) for faster prototyping.\n", + "# Once your code is ready, you can switch to full-scale\n", + "# 176B-parameter BLOOM (bigscience/bloom-petals) or BLOOMZ (bigscience/bloomz-petals).\n", + "MODEL_NAME = \"bigscience/bloom-7b1-petals\"\n", + "\n", + "# Choose a prompt-tuning mode ('ptune' or 'deep_ptune').\n", + "# The latter fine-tunes separate prefixes for each transformer block,\n", + "# so prompt-tuning will take more time but yield better results.\n", + "# See this paper for details of how it works: https://arxiv.org/pdf/2110.07602.pdf\n", + "TUNING_MODE = 'ptune'\n", + "\n", "NUM_PREFIX_TOKENS = 16\n", "DEVICE = 'cuda'\n", "BATCH_SIZE = 8\n", @@ -83,8 +94,7 @@ "WEIGHT_DECAY = 0.0\n", "NUM_SAMPLES = 1000\n", "SEED = 42\n", - "MODEL_MAX_LENGTH = 256\n", - "TUNING_MODE = 'ptune' # choose between ['ptune', 'deep_ptune'] " + "MODEL_MAX_LENGTH = 256" ] }, { diff --git a/examples/prompt-tuning-sst2.ipynb b/examples/prompt-tuning-sst2.ipynb index 5bcb0c9..05938b0 100644 --- a/examples/prompt-tuning-sst2.ipynb +++ b/examples/prompt-tuning-sst2.ipynb @@ -77,7 +77,18 @@ "metadata": {}, "outputs": [], "source": [ - "MODEL_NAME = \"bigscience/bloom-petals\" # select model you like\n", + "# Choose a model you'd like to prompt-tune. We recommend starting with\n", + "# the smaller 7.1B version of BLOOM (bigscience/bloom-7b1-petals) for faster prototyping.\n", + "# Once your code is ready, you can switch to full-scale\n", + "# 176B-parameter BLOOM (bigscience/bloom-petals) or BLOOMZ (bigscience/bloomz-petals).\n", + "MODEL_NAME = \"bigscience/bloom-7b1-petals\"\n", + "\n", + "# Choose a prompt-tuning mode ('ptune' or 'deep_ptune').\n", + "# The latter fine-tunes separate prefixes for each transformer block,\n", + "# so prompt-tuning will take more time but yield better results.\n", + "# See this paper for details of how it works: https://arxiv.org/pdf/2110.07602.pdf\n", + "TUNING_MODE = 'ptune'\n", + "\n", "NUM_PREFIX_TOKENS = 16\n", "DEVICE = 'cuda'\n", "BATCH_SIZE = 16\n", @@ -85,8 +96,7 @@ "WEIGHT_DECAY = 0.0\n", "NUM_EPOCHS = 3\n", "SEED = 42\n", - "MODEL_MAX_LENGTH = 64\n", - "TUNING_MODE = 'ptune' # choose between ['ptune', 'deep_ptune'] " + "MODEL_MAX_LENGTH = 64" ] }, {