Compare commits

..

7 Commits

Author SHA1 Message Date
Kyle Corbitt
db69b8e496 clean up example 2023-09-12 00:47:22 +00:00
Kyle Corbitt
38e28fa30a benchmark comparison to gpt-3.5 and gpt-3.5 finetuned 2023-08-28 03:55:50 +00:00
Kyle Corbitt
b4cb931f6c first version of example ready 2023-08-25 06:37:06 +00:00
Kyle Corbitt
40638a7848 more work 2023-08-24 23:49:44 +00:00
Kyle Corbitt
14eae45d18 more benchmarking 2023-08-24 19:52:31 +00:00
Kyle Corbitt
13bac46e0b generate-data and some eval 2023-08-24 18:43:42 +00:00
Kyle Corbitt
12d01cd3d5 initial example work 2023-08-24 07:05:28 +00:00
14 changed files with 2894 additions and 62 deletions

View File

@@ -1,52 +1,14 @@
<p align="center"> # OpenPipe
<a href="https://openpipe.ai">
<img height="70" src="https://github.com/openpipe/openpipe/assets/41524992/70af25fb-1f90-42d9-8a20-3606e3b5aaba" alt="logo">
</a>
</p>
<h1 align="center">
OpenPipe
</h1>
<p align="center"> OpenPipe is a flexible playground for comparing and optimizing LLM prompts. It lets you quickly generate, test and compare candidate prompts, and can automatically [translate](#-translate-between-model-apis) those prompts between models.
<i>Turn expensive prompts into cheap fine-tuned models.</i>
</p>
<p align="center"> <img src="https://github.com/openpipe/openpipe/assets/41524992/66bb1843-cb72-4130-a369-eec2df3b8201" alt="demo">
<a href="/LICENSE"><img alt="License Apache-2.0" src="https://img.shields.io/github/license/openpipe/openpipe?style=flat-square"></a>
<a href='http://makeapullrequest.com'><img alt='PRs Welcome' src='https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square'/></a>
<a href="https://github.com/openpipe/openpipe/graphs/commit-activity"><img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/openpipe/openpipe?style=flat-square"/></a>
<a href="https://github.com/openpipe/openpipe/issues"><img alt="GitHub closed issues" src="https://img.shields.io/github/issues-closed/openpipe/openpipe?style=flat-square"/></a>
</p>
<p align="center">
<a href="https://app.openpipe.ai/">Hosted App</a> - <a href="#running-locally">Running Locally</a> - <a href="#sample-experiments">Experiments</a>
</p>
<br>
Use powerful but expensive LLMs to fine-tune smaller and cheaper models suited to your exact needs. Evaluate model and prompt combinations in the playground. Query your past requests and export optimized training data.
<br>
## 🪛 Features
* <b>Fine-Tune</b>
* Easy integration with OpenPipe's SDK in both Python and JS.
* Swiftly query logs using intuitive built-in filters.
* Export data in multiple training formats, including Alpaca and ChatGPT, with deduplication.
* <b>Experiment</b>
* Bulk-test wide-reaching scenarios using code templating.
* Seamlessly translate prompts across different model APIs.
* Tap into autogenerated scenarios for fresh test perspectives.
<img src="https://github.com/openpipe/openpipe/assets/41524992/eaa8b92d-4536-4f63-bbef-4b0b1a60f6b5" alt="fine-tune demo">
<!-- <img height="400px" src="https://github.com/openpipe/openpipe/assets/41524992/66bb1843-cb72-4130-a369-eec2df3b8201" alt="playground demo"> -->
You can use our hosted version of OpenPipe at https://openpipe.ai. You can also clone this repository and [run it locally](#running-locally).
## Sample Experiments ## Sample Experiments
These are sample experiments users have created that show how OpenPipe works. Feel free to fork them and start experimenting yourself. These are simple experiments users have created that show how OpenPipe works. Feel free to fork them and start experimenting yourself.
- [Twitter Sentiment Analysis](https://app.openpipe.ai/experiments/62c20a73-2012-4a64-973c-4b665ad46a57) - [Twitter Sentiment Analysis](https://app.openpipe.ai/experiments/62c20a73-2012-4a64-973c-4b665ad46a57)
- [Reddit User Needs](https://app.openpipe.ai/experiments/22222222-2222-2222-2222-222222222222) - [Reddit User Needs](https://app.openpipe.ai/experiments/22222222-2222-2222-2222-222222222222)
@@ -55,25 +17,37 @@ These are sample experiments users have created that show how OpenPipe works. Fe
## Supported Models ## Supported Models
#### OpenAI - All models available through the OpenAI [chat completion API](https://platform.openai.com/docs/guides/gpt/chat-completions-api)
- [GPT 3.5 Turbo](https://platform.openai.com/docs/guides/gpt/chat-completions-api) - Llama2 [7b chat](https://replicate.com/a16z-infra/llama7b-v2-chat), [13b chat](https://replicate.com/a16z-infra/llama13b-v2-chat), [70b chat](https://replicate.com/replicate/llama70b-v2-chat).
- [GPT 3.5 Turbo 16k](https://platform.openai.com/docs/guides/gpt/chat-completions-api) - Anthropic's [Claude 1 Instant](https://www.anthropic.com/index/introducing-claude) and [Claude 2](https://www.anthropic.com/index/claude-2)
- [GPT 4](https://openai.com/gpt-4)
#### Llama2 ## Features
- [7b chat](https://replicate.com/a16z-infra/llama7b-v2-chat)
- [13b chat](https://replicate.com/a16z-infra/llama13b-v2-chat) ### 🔍 Visualize Responses
- [70b chat](https://replicate.com/replicate/llama70b-v2-chat)
#### Llama2 Fine-Tunes Inspect prompt completions side-by-side.
- [Open-Orca/OpenOrcaxOpenChat-Preview2-13B](https://huggingface.co/Open-Orca/OpenOrcaxOpenChat-Preview2-13B)
- [Open-Orca/OpenOrca-Platypus2-13B](https://huggingface.co/Open-Orca/OpenOrca-Platypus2-13B) ### 🧪 Bulk-Test
- [NousResearch/Nous-Hermes-Llama2-13b](https://huggingface.co/NousResearch/Nous-Hermes-Llama2-13b)
- [jondurbin/airoboros-l2-13b-gpt4-2.0](https://huggingface.co/jondurbin/airoboros-l2-13b-gpt4-2.0) OpenPipe lets you _template_ a prompt. Use the templating feature to run the prompts you're testing against many potential inputs for broad coverage of your problem space.
- [lmsys/vicuna-13b-v1.5](https://huggingface.co/lmsys/vicuna-13b-v1.5)
- [Gryphe/MythoMax-L2-13b](https://huggingface.co/Gryphe/MythoMax-L2-13b) ### 📟 Translate between Model APIs
- [NousResearch/Nous-Hermes-llama-2-7b](https://huggingface.co/NousResearch/Nous-Hermes-llama-2-7b)
#### Anthropic Write your prompt in one format and automatically convert it to work with any other model.
- [Claude 1 Instant](https://www.anthropic.com/index/introducing-claude)
- [Claude 2](https://www.anthropic.com/index/claude-2) <!-- <img width="480" alt="Screenshot 2023-08-01 at 11 55 38 PM" src="https://github.com/OpenPipe/OpenPipe/assets/41524992/1e19ccf2-96b6-4e93-a3a5-1449710d1b5b" alt="translate between models"> -->
### 🛠️ Refine Your Prompts Automatically
Use a growing database of best-practice refinements to improve your prompts automatically.
<!-- <img width="480" alt="Screenshot 2023-08-01 at 11 55 38 PM" src="https://github.com/OpenPipe/OpenPipe/assets/41524992/87a27fe7-daef-445c-a5e2-1c82b23f9f99" alt="add function call"> -->
### 🪄 Auto-generate Test Scenarios
OpenPipe includes a tool to generate new test scenarios based on your existing prompts and scenarios. Just click "Autogenerate Scenario" to try it out!
<!-- <img width="600" src="https://github.com/openpipe/openpipe/assets/41524992/219a844e-3f4e-4f6b-8066-41348b42977b" alt="auto-generate"> -->
## Running Locally ## Running Locally

6
examples/.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
axolotl/
models/
data/
wandb/
cache/
.ipynb_checkpoints/

View File

@@ -0,0 +1,7 @@
OPENAI_API_KEY="[your OpenAI API key]"
OPENPIPE_API_KEY="[your OpenPipe API key from https://app.openpipe.ai/project/settings]"
# You'll need this to download the Llama 2 weights from Hugging Face
HUGGING_FACE_HUB_TOKEN="[Your Hugging Face Hub token]"
WANDB_API_KEY="[Optionally, you can set a Weights & Biases API key to track your training run. Create it at https://wandb.ai/settings]"

View File

@@ -0,0 +1,317 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In this notebook I'm using the OpenPipe client to capture a set of calls to the OpenAI API.\n",
"\n",
"For this example I'll blithely throw engineering best practices to the wind and use the notebook itself to manage dependencies. 😁\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%%capture\n",
"%pip install openpipe==3.0.3 python-dotenv==1.0.0 datasets==2.14.4"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"When working with remote datasets (or any data, really), it's a good idea to visually inspect some samples to make sure it looks like you expect. I'll print a recipe.\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Recipe dataset shape:\n",
"------------------\n"
]
},
{
"data": {
"text/plain": [
"Dataset({\n",
" features: ['recipe'],\n",
" num_rows: 5000\n",
"})"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"First recipe:\n",
"------------------ Shrimp Creole\n",
"\n",
"Ingredients:\n",
"- 20 shrimp (8 oz.)\n",
"- 2 c. (16 oz. can) tomato sauce\n",
"- 1 small onion, chopped\n",
"- 1 celery stalk, chopped\n",
"- 1/4 green bell pepper, diced\n",
"- 1/4 c. sliced mushrooms\n",
"- 3 Tbsp. parsley\n",
"- 1/2 tsp. pepper\n",
"- 1 to 1-1/2 c. brown rice, prepared according to pkg. directions (not included in exchanges)\n",
"\n",
"Directions:\n",
"- Peel, devein and wash shrimp; set aside.\n",
"- (If shrimp are frozen, let thaw first in the refrigerator.)\n",
"- Simmer tomato sauce, onion, celery, green pepper, mushrooms, parsley and pepper in skillet for 30 minutes.\n",
"- Add shrimp and cook 10 to 15 minutes more, until shrimp are tender.\n",
"- Serve over brown rice.\n",
"- Serves 2.\n"
]
}
],
"source": [
"from datasets import load_dataset\n",
"\n",
"recipes = load_dataset(\"corbt/unlabeled-recipes\")[\"train\"]\n",
"print(\"Recipe dataset shape:\\n------------------\")\n",
"display(recipes)\n",
"print(\"First recipe:\\n------------------\", recipes[\"recipe\"][0])\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Mm, delicious. Anyway, we need to generate a training dataset. We'll call GPT-4 on each of our examples.\n",
"\n",
"In this case, I'll ask GPT-4 to classify each recipe along 5 dimensions:\n",
"\n",
"- has_non_fish_meat\n",
"- requires_oven\n",
"- requires_stove\n",
"- cook_time_over_30_mins\n",
"- main_dish\n",
"\n",
"That looks like a pretty random list, but there's actually an important unifying thread: I'm looking for meals that my pescatarian brother/co-founder can make in his kitchen-less, near-window-less basement apartment in San Francisco! (If you haven't tried to get an apartment in SF you probably think I'm joking 😂.)\n",
"\n",
"I'll use [OpenPipe](https://github.com/openpipe/openpipe) to track the API calls and form a training dataset. To follow along you'll need to create a free OpenPipe account, then copy your API key from https://app.openpipe.ai/project/settings into a file called `.env`. You can see an example in [./.env.example](./.env.example).\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Classifying first recipe:\n",
"------------------\n",
"{'has_non_fish_meat': False, 'requires_oven': False, 'requires_stove': True, 'cook_time_over_30_mins': True, 'main_dish': True}\n"
]
}
],
"source": [
"from openpipe import openai, configure_openpipe\n",
"import json\n",
"import os\n",
"import dotenv\n",
"\n",
"# Use `dotenv` to load the contents of the `.env` file into the environment\n",
"dotenv.load_dotenv()\n",
"\n",
"# Configure OpenPipe using the API key from the environment\n",
"configure_openpipe(api_key=os.environ[\"OPENPIPE_API_KEY\"])\n",
"\n",
"# Configure OpenAI using the API key from the environment\n",
"openai.api_key = os.environ[\"OPENAI_API_KEY\"]\n",
"\n",
"\n",
"def classify_recipe(recipe: str):\n",
" completion = openai.ChatCompletion.create(\n",
" model=\"gpt-4\",\n",
" messages=[\n",
" {\n",
" \"role\": \"system\",\n",
" \"content\": \"Your goal is to classify a recipe along several dimensions.Pay attention to the instructions.\",\n",
" },\n",
" {\n",
" \"role\": \"user\",\n",
" \"content\": recipe,\n",
" },\n",
" ],\n",
" functions=[\n",
" {\n",
" \"name\": \"classify\",\n",
" \"parameters\": {\n",
" \"type\": \"object\",\n",
" \"properties\": {\n",
" \"has_non_fish_meat\": {\n",
" \"type\": \"boolean\",\n",
" \"description\": \"True if the recipe contains any meat or meat products (eg. chicken broth) besides fish\",\n",
" },\n",
" \"requires_oven\": {\n",
" \"type\": \"boolean\",\n",
" \"description\": \"True if the recipe requires an oven\",\n",
" },\n",
" \"requires_stove\": {\n",
" \"type\": \"boolean\",\n",
" \"description\": \"True if the recipe requires a stove\",\n",
" },\n",
" \"cook_time_over_30_mins\": {\n",
" \"type\": \"boolean\",\n",
" \"description\": \"True if the recipe takes over 30 minutes to prepare and cook, including waiting time\",\n",
" },\n",
" \"main_dish\": {\n",
" \"type\": \"boolean\",\n",
" \"description\": \"True if the recipe can be served as a main dish\",\n",
" },\n",
" },\n",
" \"required\": [\n",
" \"has_non_fish_meat\",\n",
" \"requires_oven\",\n",
" \"requires_stove\",\n",
" \"cook_time_over_30_mins\",\n",
" \"main_dish\",\n",
" ],\n",
" },\n",
" }\n",
" ],\n",
" function_call={\n",
" \"name\": \"classify\",\n",
" },\n",
" openpipe={\"tags\": {\"prompt_id\": \"classify-recipe\"}, \"cache\": True},\n",
" )\n",
" return json.loads(completion.choices[0].message.function_call.arguments)\n",
"\n",
"\n",
"print(\"Classifying first recipe:\\n------------------\")\n",
"print(classify_recipe(recipes[\"recipe\"][0]))\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"That's working, so I'll go ahead and classify all 5000 recipes with GPT-4. Using GPT-4 for this is slowwww and costs about $40. The model I'm fine-tuning will be much faster -- we'll see if we can make it as good!\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Classifying recipe 0/5000: Shrimp Creole\n",
"Classifying recipe 100/5000: Spoon Bread\n",
"Classifying recipe 200/5000: Quadrangle Grille'S Pumpkin-Walnut Cheesecake\n",
"Classifying recipe 300/5000: Broccoli Casserole\n",
"Classifying recipe 400/5000: Paal Payasam (3-Ingredient Rice Pudding)\n",
"Classifying recipe 500/5000: Dirt Dessert\n",
"Classifying recipe 600/5000: Dolma, Stuffed Dried Peppers And Eggplants\n",
"Classifying recipe 700/5000: Party Pecan Pies\n",
"Classifying recipe 800/5000: Pie Crust\n",
"Classifying recipe 900/5000: Russian Dressing(Salad Dressing) \n",
"Classifying recipe 1000/5000: O'Brien Potatoes\n",
"Classifying recipe 1100/5000: Monster Cookies\n",
"Classifying recipe 1200/5000: Striped Fruit Pops\n",
"Classifying recipe 1300/5000: Cute Heart-Shaped Fried Egg\n",
"Classifying recipe 1400/5000: Steak Marinade\n",
"Classifying recipe 1500/5000: Bbq Sauce For Fish Recipe\n",
"Classifying recipe 1600/5000: Barbecue Ranch Salad\n",
"Classifying recipe 1700/5000: White Fudge\n",
"Classifying recipe 1800/5000: Seaton Chocolate Chip Cookies\n",
"Classifying recipe 1900/5000: Beef Stroganoff\n",
"Classifying recipe 2000/5000: Lemon Delight\n",
"Classifying recipe 2100/5000: Cream Cheese Chicken Chili\n",
"Classifying recipe 2200/5000: Bean Salad\n",
"Classifying recipe 2300/5000: Green Beans Almondine\n",
"Classifying recipe 2400/5000: Radish-And-Avocado Salad\n",
"Classifying recipe 2500/5000: Salsa Rojo\n",
"Classifying recipe 2600/5000: Pepperoni Bread\n",
"Classifying recipe 2700/5000: Sabzi Polow\n",
"Classifying recipe 2800/5000: Italian Vegetable Pizzas\n",
"Classifying recipe 2900/5000: Hot Fudge Sauce, Soda Shop Style\n",
"Classifying recipe 3000/5000: Meatball Soup With Vegetables And Brown Rice\n",
"Classifying recipe 3100/5000: Herbed Potatoes And Onions\n",
"Classifying recipe 3200/5000: Apple Crunch Pie (2 Extra Servings)\n",
"Classifying recipe 3300/5000: Pineapple-Orange Punch\n",
"Classifying recipe 3400/5000: Turkey Veggie Burgers With Avocado Mayo\n",
"Classifying recipe 3500/5000: Pear & Goat Cheese Salad\n",
"Classifying recipe 3600/5000: Triple Chocolate Cookies\n",
"Classifying recipe 3700/5000: Strawberry Banana Yogurt Pops\n",
"Classifying recipe 3800/5000: Chicken Croquettes\n",
"Classifying recipe 3900/5000: Mushroom Casserole\n",
"Classifying recipe 4000/5000: Vegetarian Summer Roll\n",
"Classifying recipe 4100/5000: Prune Cake\n",
"Classifying recipe 4200/5000: Strawberry Sorbet\n",
"Classifying recipe 4300/5000: Lemonade Chicken\n",
"Classifying recipe 4400/5000: Crock-Pot Vegetarian Chili\n",
"Classifying recipe 4500/5000: Grandma Dickrell'S Molasses Cake - 1936\n",
"Classifying recipe 4600/5000: Creamed Corn Casserole\n",
"Classifying recipe 4700/5000: Homemade Croutons\n",
"Classifying recipe 4800/5000: Potatoes With Leeks And Gruyere\n",
"Classifying recipe 4900/5000: Chocolate Oatmeal Cookie\n"
]
}
],
"source": [
"for i, recipe in enumerate(recipes[\"recipe\"]):\n",
" if i % 100 == 0:\n",
" recipe_title = recipe.split(\"\\n\")[0]\n",
" print(f\"Classifying recipe {i}/{len(recipes)}: {recipe_title}\")\n",
" try:\n",
" classify_recipe(recipe)\n",
" except Exception as e:\n",
" print(f\"Error classifying recipe {i}: {e}\")\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Ok, now that my recipes are classified I'll download the training data.\n",
"\n",
"Next up I'll train the model -- check out [./train.ipynb](./train.ipynb) for details! Just go to https://app.openpipe.ai/request-logs, select all the logs you created, and click \"Export\". The default 10% testing split is fine for this dataset size.\n",
"\n",
"I got two files from that: `train.jsonl` and `test.jsonl`. I moved both of them into this repository under `./data/`.\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}

View File

@@ -0,0 +1,947 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now let's get to the fun part -- training a model. I'll start by installing the dependencies.\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%%capture\n",
"%pip install peft==0.5.0 python-dotenv==2.0.0\n",
"\n",
"!git clone https://github.com/OpenAccess-AI-Collective/axolotl\n",
"%pip install -e \"./axolotl[flash-attn]\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Note to the reader: since we'll be basing our fine-tuned model on Meta's Llama 2, you need to apply for access to the weights (which will be automatically granted). Follow the steps on [HuggingFace](https://huggingface.co/meta-llama/Llama-2-7b-hf), then create a read-only access token [here](https://huggingface.co/settings/tokens) and copy it into your .env file.\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Hugging Face token set: True\n"
]
}
],
"source": [
"import dotenv\n",
"import os\n",
"\n",
"dotenv.load_dotenv()\n",
"\n",
"has_token = os.getenv(\"HUGGING_FACE_HUB_TOKEN\") is not None\n",
"\n",
"print(f\"Hugging Face token set: {has_token}\")\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"I'll use the [axolotl](https://github.com/OpenAccess-AI-Collective/axolotl) library to manage this training run. It includes a lot of neat tricks that speed up training without sacrificing quality.\n",
"\n",
"In this case I'm using 8-bit training to use less GPU RAM, and sample packing to maximize GPU utilization. You can read more about the available options at https://github.com/OpenAccess-AI-Collective/axolotl.\n",
"\n",
"The training run options are defined in [training-config.yaml](./training-config.yaml).\n"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The following values were not passed to `accelerate launch` and had defaults used instead:\n",
"\t`--num_processes` was set to a value of `1`\n",
"\t`--num_machines` was set to a value of `1`\n",
"\t`--mixed_precision` was set to a value of `'no'`\n",
"\t`--dynamo_backend` was set to a value of `'no'`\n",
"To avoid this warning pass in values for each of the problematic parameters or run `accelerate config`.\n",
"\n",
" dP dP dP\n",
" 88 88 88\n",
".d8888b. dP. .dP .d8888b. 88 .d8888b. d8888P 88\n",
"88' `88 `8bd8' 88' `88 88 88' `88 88 88\n",
"88. .88 .d88b. 88. .88 88 88. .88 88 88\n",
"`88888P8 dP' `dP `88888P' dP `88888P' dP dP\n",
"\n",
"[2023-08-24 20:18:54,867] [INFO] [axolotl.normalize_config:72] [PID:125016] GPU memory usage baseline: 0.000GB (+0.674GB misc)\u001b[39m\n",
"[2023-08-24 20:18:54,867] [INFO] [axolotl.scripts.train:189] [PID:125016] loading tokenizer... meta-llama/Llama-2-7b-hf\u001b[39m\n",
"[2023-08-24 20:18:55,078] [DEBUG] [axolotl.load_tokenizer:64] [PID:125016] EOS: 2 / </s>\u001b[39m\n",
"[2023-08-24 20:18:55,078] [DEBUG] [axolotl.load_tokenizer:65] [PID:125016] BOS: 1 / <s>\u001b[39m\n",
"[2023-08-24 20:18:55,078] [DEBUG] [axolotl.load_tokenizer:66] [PID:125016] PAD: 0 / [PAD]\u001b[39m\n",
"[2023-08-24 20:18:55,078] [DEBUG] [axolotl.load_tokenizer:67] [PID:125016] UNK: 0 / <unk>\u001b[39m\n",
"[2023-08-24 20:18:55,079] [INFO] [axolotl.load_tokenized_prepared_datasets:126] [PID:125016] Unable to find prepared dataset in data/last_run_prepared/82cd9d58e34e0db98296199248c92d0d\u001b[39m\n",
"[2023-08-24 20:18:55,079] [INFO] [axolotl.load_tokenized_prepared_datasets:127] [PID:125016] Loading raw datasets...\u001b[39m\n",
"[2023-08-24 20:18:55,079] [INFO] [axolotl.load_tokenized_prepared_datasets:132] [PID:125016] No seed provided, using default seed of 42\u001b[39m\n",
"/usr/local/lib/python3.10/dist-packages/datasets/load.py:2072: FutureWarning: 'use_auth_token' was deprecated in favor of 'token' in version 2.14.0 and will be removed in 3.0.0.\n",
"You can remove this warning by passing 'token=None' instead.\n",
" warnings.warn(\n",
"Downloading data files: 100%|███████████████████| 1/1 [00:00<00:00, 1909.97it/s]\n",
"Extracting data files: 100%|█████████████████████| 1/1 [00:00<00:00, 130.16it/s]\n",
"Generating train split: 4501 examples [00:00, 72594.78 examples/s]\n",
"Map (num_proc=64): 100%|███████████| 4501/4501 [00:01<00:00, 3465.17 examples/s]\n",
"[2023-08-24 20:18:58,085] [INFO] [axolotl.load_tokenized_prepared_datasets:330] [PID:125016] merging datasets\u001b[39m\n",
"[2023-08-24 20:18:58,092] [INFO] [axolotl.load_tokenized_prepared_datasets:337] [PID:125016] Saving merged prepared dataset to disk... data/last_run_prepared/82cd9d58e34e0db98296199248c92d0d\u001b[39m\n",
"Saving the dataset (1/1 shards): 100%|█| 4501/4501 [00:00<00:00, 63380.02 exampl\n",
"Filter (num_proc=255): 100%|███████| 4275/4275 [00:01<00:00, 3385.29 examples/s]\n",
"Filter (num_proc=226): 100%|██████████| 226/226 [00:01<00:00, 196.38 examples/s]\n",
"Map (num_proc=255): 100%|██████████| 4275/4275 [00:02<00:00, 1480.29 examples/s]\n",
"Map (num_proc=226): 100%|██████████████| 226/226 [00:05<00:00, 44.33 examples/s]\n",
"[2023-08-24 20:19:33,527] [INFO] [axolotl.calculate_total_num_steps:346] [PID:125016] calculating total_num_tokens\u001b[39m\n",
"[2023-08-24 20:19:33,536] [INFO] [axolotl.calculate_total_num_steps:353] [PID:125016] 📝 UPDATE CONFIG WITH: `total_num_tokens: 1514815`\u001b[39m\n",
"[2023-08-24 20:19:33,552] [INFO] [axolotl.utils.dataloader.generate_batches:181] [PID:125016] generating packed batches\u001b[39m\n",
"[2023-08-24 20:19:33,590] [INFO] [axolotl.utils.dataloader.generate_batches:187] [PID:125016] 2ae1e19cb9bd6022bcc024ba552b1341f4c424a75595ff3419969cc2f838c2ba\u001b[39m\n",
"[2023-08-24 20:19:40,094] [INFO] [axolotl.utils.dataloader.len_w_stats:293] [PID:125016] packing_efficiency_estimate: 1.0 actual packing efficiency: 0.9732312654194079\u001b[39m\n",
"[2023-08-24 20:19:40,094] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 1.0 total_num_tokens per device: 1514815\u001b[39m\n",
"[2023-08-24 20:19:40,094] [INFO] [axolotl.calculate_total_num_steps:393] [PID:125016] data_loader_len: 182\u001b[39m\n",
"[2023-08-24 20:19:40,094] [INFO] [axolotl.calculate_total_num_steps:402] [PID:125016] 📝 UPDATE CONFIG WITH: `sample_packing_eff_est: 0.98`\u001b[39m\n",
"[2023-08-24 20:19:40,094] [INFO] [axolotl.calculate_total_num_steps:410] [PID:125016] total_num_steps: 227\u001b[39m\n",
"[2023-08-24 20:19:40,094] [INFO] [axolotl.scripts.train:211] [PID:125016] loading model and (optionally) peft_config...\u001b[39m\n",
"[2023-08-24 20:19:40,114] [INFO] [axolotl.load_model:106] [PID:125016] patching with flash attention\u001b[39m\n",
"[2023-08-24 20:19:40,117] [INFO] [axolotl.load_model:147] [PID:125016] patching _expand_mask\u001b[39m\n",
"Loading checkpoint shards: 100%|██████████████████| 2/2 [00:17<00:00, 8.60s/it]\n",
"\u001b[33m[2023-08-24 20:19:58,136] [WARNING] [axolotl.load_model:337] [PID:125016] increasing model.config.max_position_embeddings to 4096\u001b[39m\n",
"[2023-08-24 20:19:58,136] [INFO] [axolotl.load_model:343] [PID:125016] GPU memory usage after model load: 6.681GB (+0.364GB cache, +1.159GB misc)\u001b[39m\n",
"[2023-08-24 20:19:58,136] [INFO] [axolotl.load_model:349] [PID:125016] converting PEFT model w/ prepare_model_for_kbit_training\u001b[39m\n",
"[2023-08-24 20:19:58,146] [INFO] [axolotl.load_lora:473] [PID:125016] found linear modules: ['k_proj', 'q_proj', 'o_proj', 'up_proj', 'down_proj', 'gate_proj', 'v_proj']\u001b[39m\n",
"trainable params: 79,953,920 || all params: 6,818,369,536 || trainable%: 1.172625208678628\n",
"[2023-08-24 20:20:53,348] [INFO] [axolotl.load_model:394] [PID:125016] GPU memory usage after adapters: 6.830GB (+1.365GB cache, +1.159GB misc)\u001b[39m\n",
"[2023-08-24 20:20:53,380] [INFO] [axolotl.scripts.train:267] [PID:125016] Compiling torch model\u001b[39m\n",
"[2023-08-24 20:20:53,544] [INFO] [axolotl.scripts.train:272] [PID:125016] Pre-saving adapter config to ./models/run1\u001b[39m\n",
"[2023-08-24 20:20:53,548] [INFO] [axolotl.scripts.train:288] [PID:125016] Starting trainer...\u001b[39m\n",
"[2023-08-24 20:20:53,747] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 1514815\u001b[39m\n",
"[2023-08-24 20:20:53,747] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 1514815\u001b[39m\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: Currently logged in as: \u001b[33mopenpipe\u001b[0m (\u001b[33mopenpipe-team\u001b[0m). Use \u001b[1m`wandb login --relogin`\u001b[0m to force relogin\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: Tracking run with wandb version 0.15.8\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: Run data is saved locally in \u001b[35m\u001b[1m/workspace/OpenPipe/examples/classify-recipes/wandb/run-20230824_202055-run1\u001b[0m\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: Run \u001b[1m`wandb offline`\u001b[0m to turn off syncing.\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: Syncing run \u001b[33mrun1\u001b[0m\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: ⭐️ View project at \u001b[34m\u001b[4mhttps://wandb.ai/openpipe-team/classify-recipes\u001b[0m\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: 🚀 View run at \u001b[34m\u001b[4mhttps://wandb.ai/openpipe-team/classify-recipes/runs/run1\u001b[0m\n",
" 0%| | 0/230 [00:00<?, ?it/s][2023-08-24 20:20:56,099] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 1514815\u001b[39m\n",
"[2023-08-24 20:20:56,099] [INFO] [axolotl.utils.dataloader.generate_batches:181] [PID:125016] generating packed batches\u001b[39m\n",
"[2023-08-24 20:20:56,102] [INFO] [axolotl.utils.dataloader.generate_batches:187] [PID:125016] ac74b20cc92d80020bfc11a9bed8f0bf75dfc745b23630320c27a53a549d7cae\u001b[39m\n",
"[2023-08-24 20:20:56,106] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 1514815\u001b[39m\n",
"/usr/local/lib/python3.10/dist-packages/bitsandbytes/autograd/_functions.py:322: UserWarning: MatMul8bitLt: inputs will be cast from torch.bfloat16 to float16 during quantization\n",
" warnings.warn(f\"MatMul8bitLt: inputs will be cast from {A.dtype} to float16 during quantization\")\n",
"{'loss': 1.7489, 'learning_rate': 2e-05, 'epoch': 0.02} \n",
" 0%|▏ | 1/230 [00:19<1:13:24, 19.24s/it][2023-08-24 20:21:34,307] [INFO] [axolotl.callbacks.on_step_end:96] [PID:125016] GPU memory usage while training: 7.107GB (+10.436GB cache, +1.190GB misc)\u001b[39m\n",
"{'loss': 1.7393, 'learning_rate': 4e-05, 'epoch': 0.04} \n",
"{'loss': 1.7469, 'learning_rate': 6e-05, 'epoch': 0.06} \n",
"{'loss': 1.7368, 'learning_rate': 8e-05, 'epoch': 0.09} \n",
"{'loss': 1.6956, 'learning_rate': 0.0001, 'epoch': 0.11} \n",
"{'loss': 1.6289, 'learning_rate': 0.00012, 'epoch': 0.13} \n",
"{'loss': 1.4673, 'learning_rate': 0.00014, 'epoch': 0.15} \n",
"{'loss': 1.2552, 'learning_rate': 0.00016, 'epoch': 0.17} \n",
"{'loss': 0.9807, 'learning_rate': 0.00018, 'epoch': 0.19} \n",
"{'loss': 0.7046, 'learning_rate': 0.0002, 'epoch': 0.22} \n",
"{'loss': 0.4783, 'learning_rate': 0.00019998952044849376, 'epoch': 0.24} \n",
"{'loss': 0.3099, 'learning_rate': 0.00019995808399039496, 'epoch': 0.26} \n",
"{'loss': 0.2095, 'learning_rate': 0.00019990569721450326, 'epoch': 0.28} \n",
"{'loss': 0.0851, 'learning_rate': 0.00019983237110061697, 'epoch': 0.3} \n",
"{'loss': 0.0949, 'learning_rate': 0.00019973812101723188, 'epoch': 0.32} \n",
"{'loss': 0.0496, 'learning_rate': 0.00019962296671832003, 'epoch': 0.35} \n",
"{'loss': 0.0415, 'learning_rate': 0.00019948693233918952, 'epoch': 0.37} \n",
"{'loss': 0.0405, 'learning_rate': 0.00019933004639142605, 'epoch': 0.39} \n",
"{'loss': 0.0451, 'learning_rate': 0.000199152341756917, 'epoch': 0.41} \n",
"{'loss': 0.0326, 'learning_rate': 0.00019895385568095982, 'epoch': 0.43} \n",
" 9%|███▍ | 20/230 [06:15<1:05:47, 18.80s/it][2023-08-24 20:27:11,801] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"[2023-08-24 20:27:11,810] [INFO] [axolotl.utils.dataloader.generate_batches:181] [PID:125016] generating packed batches\u001b[39m\n",
"[2023-08-24 20:27:11,810] [INFO] [axolotl.utils.dataloader.generate_batches:187] [PID:125016] c0ef04db402ba917eb072daff58b8c0ef38c662600f92eee3292e60918d59b78\u001b[39m\n",
"[2023-08-24 20:27:11,810] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"/usr/local/lib/python3.10/dist-packages/bitsandbytes/autograd/_functions.py:322: UserWarning: MatMul8bitLt: inputs will be cast from torch.bfloat16 to float16 during quantization\n",
" warnings.warn(f\"MatMul8bitLt: inputs will be cast from {A.dtype} to float16 during quantization\")\n",
"[2023-08-24 20:27:13,176] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:27:13,176] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"[2023-08-24 20:27:13,177] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 0%| | 0/8 [00:00<?, ?it/s]\u001b[A[2023-08-24 20:27:14,581] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:27:14,582] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 25%|███████████▎ | 2/8 [00:01<00:04, 1.42it/s]\u001b[A[2023-08-24 20:27:16,012] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:27:16,013] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 38%|████████████████▉ | 3/8 [00:02<00:05, 1.01s/it]\u001b[A[2023-08-24 20:27:17,381] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:27:17,381] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 50%|██████████████████████▌ | 4/8 [00:04<00:04, 1.14s/it]\u001b[A[2023-08-24 20:27:18,789] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:27:18,789] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 62%|████████████████████████████▏ | 5/8 [00:05<00:03, 1.23s/it]\u001b[A[2023-08-24 20:27:20,178] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:27:20,178] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 75%|█████████████████████████████████▊ | 6/8 [00:07<00:02, 1.29s/it]\u001b[A[2023-08-24 20:27:21,602] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:27:21,602] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 88%|███████████████████████████████████████▍ | 7/8 [00:08<00:01, 1.33s/it]\u001b[A[2023-08-24 20:27:22,986] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:27:22,986] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" \u001b[A\n",
"\u001b[A{'eval_loss': 0.03450942039489746, 'eval_runtime': 11.2098, 'eval_samples_per_second': 20.161, 'eval_steps_per_second': 10.08, 'epoch': 0.43}\n",
" 9%|███▍ | 20/230 [06:26<1:05:47, 18.80s/it]\n",
"100%|█████████████████████████████████████████████| 8/8 [00:09<00:00, 1.35s/it]\u001b[A\n",
"{'loss': 0.0336, 'learning_rate': 0.00019873462976445553, 'epoch': 0.45} \u001b[A\n",
"{'loss': 0.0329, 'learning_rate': 0.00019849470995518992, 'epoch': 0.48} \n",
"{'loss': 0.0317, 'learning_rate': 0.0001982341465382029, 'epoch': 0.5} \n",
"{'loss': 0.0319, 'learning_rate': 0.00019795299412524945, 'epoch': 0.52} \n",
"{'loss': 0.0258, 'learning_rate': 0.00019765131164335345, 'epoch': 0.54} \n",
"{'loss': 0.024, 'learning_rate': 0.000197329162322457, 'epoch': 0.56} \n",
"{'loss': 0.0251, 'learning_rate': 0.00019698661368216817, 'epoch': 0.58} \n",
"{'loss': 0.025, 'learning_rate': 0.00019662373751760934, 'epoch': 0.61} \n",
"{'loss': 0.0258, 'learning_rate': 0.00019624060988436966, 'epoch': 0.63} \n",
"{'loss': 0.0225, 'learning_rate': 0.0001958373110825644, 'epoch': 0.65} \n",
"{'loss': 0.0252, 'learning_rate': 0.00019541392564000488, 'epoch': 0.67} \n",
"{'loss': 0.0233, 'learning_rate': 0.00019497054229448223, 'epoch': 0.69} \n",
"{'loss': 0.0231, 'learning_rate': 0.0001945072539751685, 'epoch': 0.71} \n",
"{'loss': 0.0208, 'learning_rate': 0.00019402415778313977, 'epoch': 0.74} \n",
"{'loss': 0.0221, 'learning_rate': 0.00019352135497102463, 'epoch': 0.76} \n",
"{'loss': 0.0251, 'learning_rate': 0.0001929989509217824, 'epoch': 0.78} \n",
"{'loss': 0.0192, 'learning_rate': 0.0001924570551266159, 'epoch': 0.8} \n",
"{'loss': 0.021, 'learning_rate': 0.00019189578116202307, 'epoch': 0.82} \n",
"{'loss': 0.017, 'learning_rate': 0.00019131524666599233, 'epoch': 0.84} \n",
"{'loss': 0.0235, 'learning_rate': 0.00019071557331334669, 'epoch': 0.86} \n",
" 17%|███████▎ | 40/230 [12:42<59:13, 18.70s/it][2023-08-24 20:33:38,317] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"[2023-08-24 20:33:38,326] [INFO] [axolotl.utils.dataloader.generate_batches:181] [PID:125016] generating packed batches\u001b[39m\n",
"[2023-08-24 20:33:38,326] [INFO] [axolotl.utils.dataloader.generate_batches:187] [PID:125016] c0ef04db402ba917eb072daff58b8c0ef38c662600f92eee3292e60918d59b78\u001b[39m\n",
"[2023-08-24 20:33:38,327] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"/usr/local/lib/python3.10/dist-packages/bitsandbytes/autograd/_functions.py:322: UserWarning: MatMul8bitLt: inputs will be cast from torch.bfloat16 to float16 during quantization\n",
" warnings.warn(f\"MatMul8bitLt: inputs will be cast from {A.dtype} to float16 during quantization\")\n",
"[2023-08-24 20:33:39,687] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:33:39,688] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"[2023-08-24 20:33:39,688] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 0%| | 0/8 [00:00<?, ?it/s]\u001b[A[2023-08-24 20:33:41,085] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:33:41,085] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 25%|███████████▎ | 2/8 [00:01<00:04, 1.43it/s]\u001b[A[2023-08-24 20:33:42,510] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:33:42,511] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 38%|████████████████▉ | 3/8 [00:02<00:05, 1.00s/it]\u001b[A[2023-08-24 20:33:43,870] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:33:43,870] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 50%|██████████████████████▌ | 4/8 [00:04<00:04, 1.13s/it]\u001b[A[2023-08-24 20:33:45,268] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:33:45,268] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 62%|████████████████████████████▏ | 5/8 [00:05<00:03, 1.23s/it]\u001b[A[2023-08-24 20:33:46,650] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:33:46,650] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 75%|█████████████████████████████████▊ | 6/8 [00:06<00:02, 1.28s/it]\u001b[A[2023-08-24 20:33:48,071] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:33:48,072] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 88%|███████████████████████████████████████▍ | 7/8 [00:08<00:01, 1.32s/it]\u001b[A[2023-08-24 20:33:49,455] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:33:49,455] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" \u001b[A\n",
"\u001b[A{'eval_loss': 0.018499867990612984, 'eval_runtime': 11.1626, 'eval_samples_per_second': 20.246, 'eval_steps_per_second': 10.123, 'epoch': 0.86}\n",
" 17%|███████▎ | 40/230 [12:53<59:13, 18.70s/it]\n",
"100%|█████████████████████████████████████████████| 8/8 [00:09<00:00, 1.34s/it]\u001b[A\n",
"{'loss': 0.0207, 'learning_rate': 0.0001900968867902419, 'epoch': 0.89} \u001b[A\n",
"{'loss': 0.0188, 'learning_rate': 0.00018945931676782373, 'epoch': 0.91} \n",
"{'loss': 0.0169, 'learning_rate': 0.0001888029968750498, 'epoch': 0.93} \n",
"{'loss': 0.0176, 'learning_rate': 0.00018812806467068268, 'epoch': 0.95} \n",
"{'loss': 0.0162, 'learning_rate': 0.00018743466161445823, 'epoch': 0.97} \n",
"{'loss': 0.0204, 'learning_rate': 0.00018672293303743738, 'epoch': 0.99} \n",
" 20%|████████▍ | 46/230 [14:46<59:16, 19.33s/it][2023-08-24 20:35:47,036] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 1514815\u001b[39m\n",
"[2023-08-24 20:35:47,036] [INFO] [axolotl.utils.dataloader.generate_batches:181] [PID:125016] generating packed batches\u001b[39m\n",
"[2023-08-24 20:35:47,038] [INFO] [axolotl.utils.dataloader.generate_batches:187] [PID:125016] 6076f9186c2a908489c30feee8b4739eb4ac652346e4a07ad9ea9efc2cefc22f\u001b[39m\n",
"[2023-08-24 20:35:47,040] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 1514815\u001b[39m\n",
"{'loss': 0.0158, 'learning_rate': 0.00018599302811154572, 'epoch': 1.02} \n",
"{'loss': 0.0182, 'learning_rate': 0.00018524509981830852, 'epoch': 1.04} \n",
"{'loss': 0.0185, 'learning_rate': 0.00018447930491678733, 'epoch': 1.06} \n",
"{'loss': 0.0169, 'learning_rate': 0.00018369580391072433, 'epoch': 1.08} \n",
"{'loss': 0.0167, 'learning_rate': 0.00018289476101490256, 'epoch': 1.1} \n",
"{'loss': 0.0177, 'learning_rate': 0.00018207634412072764, 'epoch': 1.12} \n",
"{'loss': 0.0196, 'learning_rate': 0.00018124072476103956, 'epoch': 1.15} \n",
"{'loss': 0.0165, 'learning_rate': 0.00018038807807416068, 'epoch': 1.17} \n",
"{'loss': 0.0148, 'learning_rate': 0.00017951858276718844, 'epoch': 1.19} \n",
"{'loss': 0.0149, 'learning_rate': 0.00017863242107853995, 'epoch': 1.21} \n",
"{'loss': 0.0161, 'learning_rate': 0.0001777297787397563, 'epoch': 1.23} \n",
"{'loss': 0.0165, 'learning_rate': 0.00017681084493657525, 'epoch': 1.25} \n",
"{'loss': 0.0169, 'learning_rate': 0.0001758758122692791, 'epoch': 1.28} \n",
"{'loss': 0.0183, 'learning_rate': 0.00017492487671232784, 'epoch': 1.3} \n",
" 26%|██████████▉ | 60/230 [19:07<52:41, 18.59s/it][2023-08-24 20:40:03,988] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"[2023-08-24 20:40:03,996] [INFO] [axolotl.utils.dataloader.generate_batches:181] [PID:125016] generating packed batches\u001b[39m\n",
"[2023-08-24 20:40:03,996] [INFO] [axolotl.utils.dataloader.generate_batches:187] [PID:125016] c0ef04db402ba917eb072daff58b8c0ef38c662600f92eee3292e60918d59b78\u001b[39m\n",
"[2023-08-24 20:40:03,996] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"/usr/local/lib/python3.10/dist-packages/bitsandbytes/autograd/_functions.py:322: UserWarning: MatMul8bitLt: inputs will be cast from torch.bfloat16 to float16 during quantization\n",
" warnings.warn(f\"MatMul8bitLt: inputs will be cast from {A.dtype} to float16 during quantization\")\n",
"[2023-08-24 20:40:05,357] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:40:05,357] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"[2023-08-24 20:40:05,357] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 0%| | 0/8 [00:00<?, ?it/s]\u001b[A[2023-08-24 20:40:06,753] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:40:06,753] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 25%|███████████▎ | 2/8 [00:01<00:04, 1.43it/s]\u001b[A[2023-08-24 20:40:08,176] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:40:08,177] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 38%|████████████████▉ | 3/8 [00:02<00:05, 1.00s/it]\u001b[A[2023-08-24 20:40:09,534] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:40:09,534] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 50%|██████████████████████▌ | 4/8 [00:04<00:04, 1.13s/it]\u001b[A[2023-08-24 20:40:10,931] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:40:10,931] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 62%|████████████████████████████▏ | 5/8 [00:05<00:03, 1.23s/it]\u001b[A[2023-08-24 20:40:12,312] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:40:12,312] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 75%|█████████████████████████████████▊ | 6/8 [00:06<00:02, 1.28s/it]\u001b[A[2023-08-24 20:40:13,734] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:40:13,735] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 88%|███████████████████████████████████████▍ | 7/8 [00:08<00:01, 1.32s/it]\u001b[A[2023-08-24 20:40:15,118] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:40:15,118] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" \u001b[A\n",
"\u001b[A{'eval_loss': 0.016062971204519272, 'eval_runtime': 11.1551, 'eval_samples_per_second': 20.26, 'eval_steps_per_second': 10.13, 'epoch': 1.3}\n",
" 26%|██████████▉ | 60/230 [19:19<52:41, 18.59s/it]\n",
"100%|█████████████████████████████████████████████| 8/8 [00:09<00:00, 1.34s/it]\u001b[A\n",
" \u001b[A/usr/local/lib/python3.10/dist-packages/bitsandbytes/autograd/_functions.py:322: UserWarning: MatMul8bitLt: inputs will be cast from torch.bfloat16 to float16 during quantization\n",
" warnings.warn(f\"MatMul8bitLt: inputs will be cast from {A.dtype} to float16 during quantization\")\n",
"{'loss': 0.0161, 'learning_rate': 0.00017395823757328444, 'epoch': 1.32} \n",
"{'loss': 0.0153, 'learning_rate': 0.00017297609745104184, 'epoch': 1.34} \n",
"{'loss': 0.018, 'learning_rate': 0.0001719786621933599, 'epoch': 1.36} \n",
"{'loss': 0.0128, 'learning_rate': 0.00017096614085372185, 'epoch': 1.38} \n",
"{'loss': 0.0156, 'learning_rate': 0.00016993874564751822, 'epoch': 1.41} \n",
"{'loss': 0.0139, 'learning_rate': 0.00016889669190756868, 'epoch': 1.43} \n",
"{'loss': 0.0205, 'learning_rate': 0.00016784019803899, 'epoch': 1.45} \n",
"{'loss': 0.0151, 'learning_rate': 0.0001667694854734204, 'epoch': 1.47} \n",
"{'loss': 0.0148, 'learning_rate': 0.0001656847786226095, 'epoch': 1.49} \n",
"{'loss': 0.0142, 'learning_rate': 0.00016458630483138356, 'epoch': 1.51} \n",
"{'loss': 0.0159, 'learning_rate': 0.00016347429432999602, 'epoch': 1.54} \n",
"{'loss': 0.018, 'learning_rate': 0.00016234898018587337, 'epoch': 1.56} \n",
"{'loss': 0.0149, 'learning_rate': 0.0001612105982547663, 'epoch': 1.58} \n",
"{'loss': 0.0147, 'learning_rate': 0.00016005938713131642, 'epoch': 1.6} \n",
"{'loss': 0.0138, 'learning_rate': 0.00015889558809904902, 'epoch': 1.62} \n",
"{'loss': 0.0146, 'learning_rate': 0.00015771944507980207, 'epoch': 1.64} \n",
"{'loss': 0.0156, 'learning_rate': 0.00015653120458260263, 'epoch': 1.66} \n",
"{'loss': 0.0159, 'learning_rate': 0.00015533111565200044, 'epoch': 1.69} \n",
"{'loss': 0.0152, 'learning_rate': 0.0001541194298158708, 'epoch': 1.71} \n",
"{'loss': 0.0179, 'learning_rate': 0.00015289640103269625, 'epoch': 1.73} \n",
" 35%|██████████████▌ | 80/230 [25:36<46:59, 18.80s/it][2023-08-24 20:46:32,302] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"[2023-08-24 20:46:32,310] [INFO] [axolotl.utils.dataloader.generate_batches:181] [PID:125016] generating packed batches\u001b[39m\n",
"[2023-08-24 20:46:32,311] [INFO] [axolotl.utils.dataloader.generate_batches:187] [PID:125016] c0ef04db402ba917eb072daff58b8c0ef38c662600f92eee3292e60918d59b78\u001b[39m\n",
"[2023-08-24 20:46:32,311] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"/usr/local/lib/python3.10/dist-packages/bitsandbytes/autograd/_functions.py:322: UserWarning: MatMul8bitLt: inputs will be cast from torch.bfloat16 to float16 during quantization\n",
" warnings.warn(f\"MatMul8bitLt: inputs will be cast from {A.dtype} to float16 during quantization\")\n",
"[2023-08-24 20:46:33,670] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:46:33,670] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"[2023-08-24 20:46:33,670] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 0%| | 0/8 [00:00<?, ?it/s]\u001b[A[2023-08-24 20:46:35,068] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:46:35,068] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 25%|███████████▎ | 2/8 [00:01<00:04, 1.43it/s]\u001b[A[2023-08-24 20:46:36,491] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:46:36,491] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 38%|████████████████▉ | 3/8 [00:02<00:05, 1.00s/it]\u001b[A[2023-08-24 20:46:37,849] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:46:37,849] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 50%|██████████████████████▌ | 4/8 [00:04<00:04, 1.13s/it]\u001b[A[2023-08-24 20:46:39,247] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:46:39,247] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 62%|████████████████████████████▏ | 5/8 [00:05<00:03, 1.23s/it]\u001b[A[2023-08-24 20:46:40,629] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:46:40,629] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 75%|█████████████████████████████████▊ | 6/8 [00:06<00:02, 1.28s/it]\u001b[A[2023-08-24 20:46:42,051] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:46:42,051] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 88%|███████████████████████████████████████▍ | 7/8 [00:08<00:01, 1.32s/it]\u001b[A[2023-08-24 20:46:43,434] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:46:43,435] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" \u001b[A\n",
"\u001b[A{'eval_loss': 0.015303226187825203, 'eval_runtime': 11.157, 'eval_samples_per_second': 20.256, 'eval_steps_per_second': 10.128, 'epoch': 1.73}\n",
" 35%|██████████████▌ | 80/230 [25:47<46:59, 18.80s/it]\n",
"100%|█████████████████████████████████████████████| 8/8 [00:09<00:00, 1.34s/it]\u001b[A\n",
"{'loss': 0.016, 'learning_rate': 0.00015166228563833934, 'epoch': 1.75} \u001b[A\n",
"{'loss': 0.0149, 'learning_rate': 0.00015041734229231688, 'epoch': 1.77} \n",
"{'loss': 0.0159, 'learning_rate': 0.00014916183192358718, 'epoch': 1.79} \n",
"{'loss': 0.0181, 'learning_rate': 0.00014789601767586173, 'epoch': 1.82} \n",
"{'loss': 0.0126, 'learning_rate': 0.00014662016485245274, 'epoch': 1.84} \n",
"{'loss': 0.0195, 'learning_rate': 0.00014533454086066772, 'epoch': 1.86} \n",
"{'loss': 0.0134, 'learning_rate': 0.00014403941515576344, 'epoch': 1.88} \n",
"{'loss': 0.0131, 'learning_rate': 0.00014273505918447054, 'epoch': 1.9} \n",
"{'loss': 0.0126, 'learning_rate': 0.00014142174632810072, 'epoch': 1.92} \n",
"{'loss': 0.013, 'learning_rate': 0.0001400997518452484, 'epoch': 1.95} \n",
"{'loss': 0.0177, 'learning_rate': 0.00013876935281409907, 'epoch': 1.97} \n",
"{'loss': 0.0148, 'learning_rate': 0.00013743082807435615, 'epoch': 1.99} \n",
" 40%|████████████████▊ | 92/230 [29:32<43:20, 18.85s/it][2023-08-24 20:50:38,268] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 1514815\u001b[39m\n",
"[2023-08-24 20:50:38,269] [INFO] [axolotl.utils.dataloader.generate_batches:181] [PID:125016] generating packed batches\u001b[39m\n",
"[2023-08-24 20:50:38,271] [INFO] [axolotl.utils.dataloader.generate_batches:187] [PID:125016] 066d0afd59aa1c812e1335cead6076c131869d6997468e47f96e2f7244232bfe\u001b[39m\n",
"[2023-08-24 20:50:38,273] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 1514815\u001b[39m\n",
"{'loss': 0.0145, 'learning_rate': 0.00013608445816879866, 'epoch': 2.01} \n",
"{'loss': 0.0151, 'learning_rate': 0.00013473052528448201, 'epoch': 2.03} \n",
"{'loss': 0.0128, 'learning_rate': 0.00013336931319359426, 'epoch': 2.05} \n",
"{'loss': 0.0163, 'learning_rate': 0.00013200110719397968, 'epoch': 2.08} \n",
"{'loss': 0.016, 'learning_rate': 0.00013062619404934317, 'epoch': 2.1} \n",
"{'loss': 0.015, 'learning_rate': 0.00012924486192914705, 'epoch': 2.12} \n",
"{'loss': 0.0124, 'learning_rate': 0.00012785740034821329, 'epoch': 2.14} \n",
"{'loss': 0.0134, 'learning_rate': 0.00012646410010604397, 'epoch': 2.16} \n",
" 43%|█████████████████▊ | 100/230 [32:02<40:34, 18.73s/it][2023-08-24 20:52:58,789] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"[2023-08-24 20:52:58,797] [INFO] [axolotl.utils.dataloader.generate_batches:181] [PID:125016] generating packed batches\u001b[39m\n",
"[2023-08-24 20:52:58,797] [INFO] [axolotl.utils.dataloader.generate_batches:187] [PID:125016] c0ef04db402ba917eb072daff58b8c0ef38c662600f92eee3292e60918d59b78\u001b[39m\n",
"[2023-08-24 20:52:58,798] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"/usr/local/lib/python3.10/dist-packages/bitsandbytes/autograd/_functions.py:322: UserWarning: MatMul8bitLt: inputs will be cast from torch.bfloat16 to float16 during quantization\n",
" warnings.warn(f\"MatMul8bitLt: inputs will be cast from {A.dtype} to float16 during quantization\")\n",
"[2023-08-24 20:53:00,162] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:53:00,163] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"[2023-08-24 20:53:00,163] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 0%| | 0/8 [00:00<?, ?it/s]\u001b[A[2023-08-24 20:53:01,560] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:53:01,561] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 25%|███████████▎ | 2/8 [00:01<00:04, 1.43it/s]\u001b[A[2023-08-24 20:53:02,985] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:53:02,985] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 38%|████████████████▉ | 3/8 [00:02<00:05, 1.00s/it]\u001b[A[2023-08-24 20:53:04,343] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:53:04,344] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 50%|██████████████████████▌ | 4/8 [00:04<00:04, 1.13s/it]\u001b[A[2023-08-24 20:53:05,742] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:53:05,742] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 62%|████████████████████████████▏ | 5/8 [00:05<00:03, 1.23s/it]\u001b[A[2023-08-24 20:53:07,122] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:53:07,123] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 75%|█████████████████████████████████▊ | 6/8 [00:06<00:02, 1.28s/it]\u001b[A[2023-08-24 20:53:08,545] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:53:08,545] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 88%|███████████████████████████████████████▍ | 7/8 [00:08<00:01, 1.32s/it]\u001b[A[2023-08-24 20:53:09,929] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:53:09,929] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" \u001b[A\n",
"\u001b[A{'eval_loss': 0.01423712819814682, 'eval_runtime': 11.165, 'eval_samples_per_second': 20.242, 'eval_steps_per_second': 10.121, 'epoch': 2.16}\n",
" 43%|█████████████████▊ | 100/230 [32:13<40:34, 18.73s/it]\n",
"100%|█████████████████████████████████████████████| 8/8 [00:09<00:00, 1.34s/it]\u001b[A\n",
"{'loss': 0.0148, 'learning_rate': 0.00012506525322587207, 'epoch': 2.18} \u001b[A\n",
"{'loss': 0.0163, 'learning_rate': 0.0001236611528934562, 'epoch': 2.21} \n",
"{'loss': 0.0145, 'learning_rate': 0.00012225209339563145, 'epoch': 2.23} \n",
"{'loss': 0.0166, 'learning_rate': 0.00012083837005862946, 'epoch': 2.25} \n",
"{'loss': 0.0115, 'learning_rate': 0.00011942027918618074, 'epoch': 2.27} \n",
"{'loss': 0.0107, 'learning_rate': 0.0001179981179974121, 'epoch': 2.29} \n",
"{'loss': 0.012, 'learning_rate': 0.00011657218456455206, 'epoch': 2.31} \n",
"{'loss': 0.0129, 'learning_rate': 0.00011514277775045768, 'epoch': 2.34} \n",
"{'loss': 0.0118, 'learning_rate': 0.00011371019714597562, 'epoch': 2.36} \n",
"{'loss': 0.0138, 'learning_rate': 0.00011227474300715055, 'epoch': 2.38} \n",
"{'loss': 0.013, 'learning_rate': 0.00011083671619229408, 'epoch': 2.4} \n",
"{'loss': 0.0119, 'learning_rate': 0.00010939641809892767, 'epoch': 2.42} \n",
"{'loss': 0.0139, 'learning_rate': 0.00010795415060061243, 'epoch': 2.44} \n",
"{'loss': 0.0159, 'learning_rate': 0.00010651021598367906, 'epoch': 2.46} \n",
"{'loss': 0.0143, 'learning_rate': 0.00010506491688387127, 'epoch': 2.49} \n",
"{'loss': 0.0154, 'learning_rate': 0.00010361855622291637, 'epoch': 2.51} \n",
"{'loss': 0.0131, 'learning_rate': 0.00010217143714503508, 'epoch': 2.53} \n",
"{'loss': 0.0124, 'learning_rate': 0.00010072386295340572, 'epoch': 2.55} \n",
"{'loss': 0.0127, 'learning_rate': 9.927613704659429e-05, 'epoch': 2.57} \n",
"{'loss': 0.0141, 'learning_rate': 9.782856285496495e-05, 'epoch': 2.59} \n",
" 52%|█████████████████████▍ | 120/230 [38:28<34:16, 18.69s/it][2023-08-24 20:59:24,312] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"[2023-08-24 20:59:24,320] [INFO] [axolotl.utils.dataloader.generate_batches:181] [PID:125016] generating packed batches\u001b[39m\n",
"[2023-08-24 20:59:24,320] [INFO] [axolotl.utils.dataloader.generate_batches:187] [PID:125016] c0ef04db402ba917eb072daff58b8c0ef38c662600f92eee3292e60918d59b78\u001b[39m\n",
"[2023-08-24 20:59:24,320] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"/usr/local/lib/python3.10/dist-packages/bitsandbytes/autograd/_functions.py:322: UserWarning: MatMul8bitLt: inputs will be cast from torch.bfloat16 to float16 during quantization\n",
" warnings.warn(f\"MatMul8bitLt: inputs will be cast from {A.dtype} to float16 during quantization\")\n",
"[2023-08-24 20:59:25,678] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:59:25,679] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"[2023-08-24 20:59:25,679] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 0%| | 0/8 [00:00<?, ?it/s]\u001b[A[2023-08-24 20:59:27,076] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:59:27,076] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 25%|███████████▎ | 2/8 [00:01<00:04, 1.43it/s]\u001b[A[2023-08-24 20:59:28,499] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:59:28,499] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 38%|████████████████▉ | 3/8 [00:02<00:05, 1.00s/it]\u001b[A[2023-08-24 20:59:29,857] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:59:29,857] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 50%|██████████████████████▌ | 4/8 [00:04<00:04, 1.13s/it]\u001b[A[2023-08-24 20:59:31,255] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:59:31,255] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 62%|████████████████████████████▏ | 5/8 [00:05<00:03, 1.23s/it]\u001b[A[2023-08-24 20:59:32,636] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:59:32,636] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 75%|█████████████████████████████████▊ | 6/8 [00:06<00:02, 1.28s/it]\u001b[A[2023-08-24 20:59:34,057] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:59:34,057] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 88%|███████████████████████████████████████▍ | 7/8 [00:08<00:01, 1.32s/it]\u001b[A[2023-08-24 20:59:35,441] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 20:59:35,441] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" \u001b[A\n",
"\u001b[A{'eval_loss': 0.01440380234271288, 'eval_runtime': 11.1537, 'eval_samples_per_second': 20.262, 'eval_steps_per_second': 10.131, 'epoch': 2.59}\n",
" 52%|█████████████████████▍ | 120/230 [38:39<34:16, 18.69s/it]\n",
"100%|█████████████████████████████████████████████| 8/8 [00:09<00:00, 1.34s/it]\u001b[A\n",
" \u001b[A/usr/local/lib/python3.10/dist-packages/bitsandbytes/autograd/_functions.py:322: UserWarning: MatMul8bitLt: inputs will be cast from torch.bfloat16 to float16 during quantization\n",
" warnings.warn(f\"MatMul8bitLt: inputs will be cast from {A.dtype} to float16 during quantization\")\n",
"{'loss': 0.0133, 'learning_rate': 9.638144377708367e-05, 'epoch': 2.62} \n",
"{'loss': 0.0151, 'learning_rate': 9.493508311612874e-05, 'epoch': 2.64} \n",
"{'loss': 0.0136, 'learning_rate': 9.348978401632101e-05, 'epoch': 2.66} \n",
"{'loss': 0.0129, 'learning_rate': 9.204584939938762e-05, 'epoch': 2.68} \n",
"{'loss': 0.0141, 'learning_rate': 9.060358190107234e-05, 'epoch': 2.7} \n",
"{'loss': 0.0131, 'learning_rate': 8.916328380770595e-05, 'epoch': 2.72} \n",
"{'loss': 0.0154, 'learning_rate': 8.772525699284946e-05, 'epoch': 2.75} \n",
"{'loss': 0.0119, 'learning_rate': 8.628980285402439e-05, 'epoch': 2.77} \n",
"{'loss': 0.0104, 'learning_rate': 8.485722224954237e-05, 'epoch': 2.79} \n",
"{'loss': 0.013, 'learning_rate': 8.342781543544798e-05, 'epoch': 2.81} \n",
"{'loss': 0.0112, 'learning_rate': 8.200188200258791e-05, 'epoch': 2.83} \n",
"{'loss': 0.0112, 'learning_rate': 8.057972081381927e-05, 'epoch': 2.85} \n",
"{'loss': 0.0127, 'learning_rate': 7.916162994137056e-05, 'epoch': 2.88} \n",
"{'loss': 0.0149, 'learning_rate': 7.774790660436858e-05, 'epoch': 2.9} \n",
"{'loss': 0.0178, 'learning_rate': 7.633884710654383e-05, 'epoch': 2.92} \n",
"{'loss': 0.0119, 'learning_rate': 7.493474677412794e-05, 'epoch': 2.94} \n",
"{'loss': 0.0137, 'learning_rate': 7.353589989395604e-05, 'epoch': 2.96} \n",
"{'loss': 0.0145, 'learning_rate': 7.214259965178674e-05, 'epoch': 2.98} \n",
" 60%|████████████████████████▌ | 138/230 [44:18<28:53, 18.84s/it][2023-08-24 21:05:28,422] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 1514815\u001b[39m\n",
"[2023-08-24 21:05:28,423] [INFO] [axolotl.utils.dataloader.generate_batches:181] [PID:125016] generating packed batches\u001b[39m\n",
"[2023-08-24 21:05:28,424] [INFO] [axolotl.utils.dataloader.generate_batches:187] [PID:125016] b60ca8a353f86b08d0005489b946fc3b062142d53d2ef59949adfba0b078763f\u001b[39m\n",
"[2023-08-24 21:05:28,427] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 1514815\u001b[39m\n",
"{'loss': 0.0133, 'learning_rate': 7.075513807085299e-05, 'epoch': 3.01} \n",
"{'loss': 0.0128, 'learning_rate': 6.937380595065685e-05, 'epoch': 3.03} \n",
" 61%|████████████████████████▉ | 140/230 [44:55<28:12, 18.81s/it][2023-08-24 21:05:51,811] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"[2023-08-24 21:05:51,819] [INFO] [axolotl.utils.dataloader.generate_batches:181] [PID:125016] generating packed batches\u001b[39m\n",
"[2023-08-24 21:05:51,820] [INFO] [axolotl.utils.dataloader.generate_batches:187] [PID:125016] c0ef04db402ba917eb072daff58b8c0ef38c662600f92eee3292e60918d59b78\u001b[39m\n",
"[2023-08-24 21:05:51,820] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"/usr/local/lib/python3.10/dist-packages/bitsandbytes/autograd/_functions.py:322: UserWarning: MatMul8bitLt: inputs will be cast from torch.bfloat16 to float16 during quantization\n",
" warnings.warn(f\"MatMul8bitLt: inputs will be cast from {A.dtype} to float16 during quantization\")\n",
"[2023-08-24 21:05:53,181] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:05:53,181] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"[2023-08-24 21:05:53,181] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 0%| | 0/8 [00:00<?, ?it/s]\u001b[A[2023-08-24 21:05:54,578] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:05:54,578] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 25%|███████████▎ | 2/8 [00:01<00:04, 1.43it/s]\u001b[A[2023-08-24 21:05:56,002] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:05:56,002] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 38%|████████████████▉ | 3/8 [00:02<00:05, 1.00s/it]\u001b[A[2023-08-24 21:05:57,363] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:05:57,363] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 50%|██████████████████████▌ | 4/8 [00:04<00:04, 1.14s/it]\u001b[A[2023-08-24 21:05:58,762] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:05:58,762] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 62%|████████████████████████████▏ | 5/8 [00:05<00:03, 1.23s/it]\u001b[A[2023-08-24 21:06:00,145] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:06:00,145] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 75%|█████████████████████████████████▊ | 6/8 [00:06<00:02, 1.28s/it]\u001b[A[2023-08-24 21:06:01,569] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:06:01,569] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 88%|███████████████████████████████████████▍ | 7/8 [00:08<00:01, 1.33s/it]\u001b[A[2023-08-24 21:06:02,956] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:06:02,956] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" \u001b[A\n",
"\u001b[A{'eval_loss': 0.01361126359552145, 'eval_runtime': 11.1696, 'eval_samples_per_second': 20.233, 'eval_steps_per_second': 10.117, 'epoch': 3.03}\n",
" 61%|████████████████████████▉ | 140/230 [45:06<28:12, 18.81s/it]\n",
"100%|█████████████████████████████████████████████| 8/8 [00:09<00:00, 1.34s/it]\u001b[A\n",
"{'loss': 0.0129, 'learning_rate': 6.799889280602031e-05, 'epoch': 3.05} \u001b[A\n",
"{'loss': 0.0133, 'learning_rate': 6.663068680640574e-05, 'epoch': 3.07} \n",
"{'loss': 0.0142, 'learning_rate': 6.526947471551798e-05, 'epoch': 3.09} \n",
"{'loss': 0.0118, 'learning_rate': 6.391554183120138e-05, 'epoch': 3.11} \n",
"{'loss': 0.0144, 'learning_rate': 6.25691719256439e-05, 'epoch': 3.14} \n",
"{'loss': 0.0142, 'learning_rate': 6.123064718590099e-05, 'epoch': 3.16} \n",
"{'loss': 0.013, 'learning_rate': 5.9900248154751616e-05, 'epoch': 3.18} \n",
"{'loss': 0.0123, 'learning_rate': 5.857825367189931e-05, 'epoch': 3.2} \n",
"{'loss': 0.0109, 'learning_rate': 5.7264940815529485e-05, 'epoch': 3.22} \n",
"{'loss': 0.0107, 'learning_rate': 5.596058484423656e-05, 'epoch': 3.24} \n",
"{'loss': 0.0104, 'learning_rate': 5.46654591393323e-05, 'epoch': 3.26} \n",
"{'loss': 0.0139, 'learning_rate': 5.337983514754723e-05, 'epoch': 3.29} \n",
"{'loss': 0.0138, 'learning_rate': 5.2103982324138244e-05, 'epoch': 3.31} \n",
"{'loss': 0.0155, 'learning_rate': 5.083816807641284e-05, 'epoch': 3.33} \n",
"{'loss': 0.0129, 'learning_rate': 4.958265770768316e-05, 'epoch': 3.35} \n",
"{'loss': 0.0143, 'learning_rate': 4.833771436166069e-05, 'epoch': 3.37} \n",
"{'loss': 0.0146, 'learning_rate': 4.710359896730379e-05, 'epoch': 3.39} \n",
"{'loss': 0.0112, 'learning_rate': 4.5880570184129215e-05, 'epoch': 3.42} \n",
"{'loss': 0.0105, 'learning_rate': 4.466888434799958e-05, 'epoch': 3.44} \n",
"{'loss': 0.0121, 'learning_rate': 4.34687954173974e-05, 'epoch': 3.46} \n",
" 70%|████████████████████████████▌ | 160/230 [51:23<21:52, 18.75s/it][2023-08-24 21:12:19,255] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"[2023-08-24 21:12:19,264] [INFO] [axolotl.utils.dataloader.generate_batches:181] [PID:125016] generating packed batches\u001b[39m\n",
"[2023-08-24 21:12:19,264] [INFO] [axolotl.utils.dataloader.generate_batches:187] [PID:125016] c0ef04db402ba917eb072daff58b8c0ef38c662600f92eee3292e60918d59b78\u001b[39m\n",
"[2023-08-24 21:12:19,264] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"/usr/local/lib/python3.10/dist-packages/bitsandbytes/autograd/_functions.py:322: UserWarning: MatMul8bitLt: inputs will be cast from torch.bfloat16 to float16 during quantization\n",
" warnings.warn(f\"MatMul8bitLt: inputs will be cast from {A.dtype} to float16 during quantization\")\n",
"[2023-08-24 21:12:20,628] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:12:20,628] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"[2023-08-24 21:12:20,628] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 0%| | 0/8 [00:00<?, ?it/s]\u001b[A[2023-08-24 21:12:22,028] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:12:22,028] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 25%|███████████▎ | 2/8 [00:01<00:04, 1.43it/s]\u001b[A[2023-08-24 21:12:23,454] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:12:23,454] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 38%|████████████████▉ | 3/8 [00:02<00:05, 1.00s/it]\u001b[A[2023-08-24 21:12:24,814] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:12:24,814] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 50%|██████████████████████▌ | 4/8 [00:04<00:04, 1.14s/it]\u001b[A[2023-08-24 21:12:26,214] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:12:26,215] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 62%|████████████████████████████▏ | 5/8 [00:05<00:03, 1.23s/it]\u001b[A[2023-08-24 21:12:27,598] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:12:27,598] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 75%|█████████████████████████████████▊ | 6/8 [00:06<00:02, 1.28s/it]\u001b[A[2023-08-24 21:12:29,021] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:12:29,021] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 88%|███████████████████████████████████████▍ | 7/8 [00:08<00:01, 1.33s/it]\u001b[A[2023-08-24 21:12:30,407] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:12:30,407] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" \u001b[A\n",
"\u001b[A{'eval_loss': 0.013194510713219643, 'eval_runtime': 11.1763, 'eval_samples_per_second': 20.221, 'eval_steps_per_second': 10.111, 'epoch': 3.46}\n",
" 70%|████████████████████████████▌ | 160/230 [51:34<21:52, 18.75s/it]\n",
"100%|█████████████████████████████████████████████| 8/8 [00:09<00:00, 1.34s/it]\u001b[A\n",
"{'loss': 0.0126, 'learning_rate': 4.2280554920197936e-05, 'epoch': 3.48} \u001b[A\n",
"{'loss': 0.0139, 'learning_rate': 4.1104411900951015e-05, 'epoch': 3.5} \n",
"{'loss': 0.0094, 'learning_rate': 3.994061286868361e-05, 'epoch': 3.52} \n",
"{'loss': 0.0144, 'learning_rate': 3.878940174523371e-05, 'epoch': 3.55} \n",
"{'loss': 0.0119, 'learning_rate': 3.7651019814126654e-05, 'epoch': 3.57} \n",
"{'loss': 0.0128, 'learning_rate': 3.652570567000402e-05, 'epoch': 3.59} \n",
"{'loss': 0.0141, 'learning_rate': 3.541369516861648e-05, 'epoch': 3.61} \n",
"{'loss': 0.0118, 'learning_rate': 3.431522137739049e-05, 'epoch': 3.63} \n",
"{'loss': 0.0142, 'learning_rate': 3.323051452657961e-05, 'epoch': 3.65} \n",
"{'loss': 0.0149, 'learning_rate': 3.215980196101002e-05, 'epoch': 3.68} \n",
"{'loss': 0.0106, 'learning_rate': 3.110330809243134e-05, 'epoch': 3.7} \n",
"{'loss': 0.0112, 'learning_rate': 3.0061254352481804e-05, 'epoch': 3.72} \n",
"{'loss': 0.0103, 'learning_rate': 2.9033859146278197e-05, 'epoch': 3.74} \n",
"{'loss': 0.0133, 'learning_rate': 2.8021337806640135e-05, 'epoch': 3.76} \n",
"{'loss': 0.0138, 'learning_rate': 2.702390254895819e-05, 'epoch': 3.78} \n",
"{'loss': 0.0095, 'learning_rate': 2.6041762426715566e-05, 'epoch': 3.81} \n",
"{'loss': 0.0152, 'learning_rate': 2.5075123287672175e-05, 'epoch': 3.83} \n",
"{'loss': 0.0126, 'learning_rate': 2.4124187730720917e-05, 'epoch': 3.85} \n",
"{'loss': 0.0106, 'learning_rate': 2.3189155063424782e-05, 'epoch': 3.87} \n",
"{'loss': 0.0135, 'learning_rate': 2.2270221260243673e-05, 'epoch': 3.89} \n",
" 78%|████████████████████████████████ | 180/230 [57:52<15:42, 18.85s/it][2023-08-24 21:18:48,116] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"[2023-08-24 21:18:48,124] [INFO] [axolotl.utils.dataloader.generate_batches:181] [PID:125016] generating packed batches\u001b[39m\n",
"[2023-08-24 21:18:48,124] [INFO] [axolotl.utils.dataloader.generate_batches:187] [PID:125016] c0ef04db402ba917eb072daff58b8c0ef38c662600f92eee3292e60918d59b78\u001b[39m\n",
"[2023-08-24 21:18:48,125] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"/usr/local/lib/python3.10/dist-packages/bitsandbytes/autograd/_functions.py:322: UserWarning: MatMul8bitLt: inputs will be cast from torch.bfloat16 to float16 during quantization\n",
" warnings.warn(f\"MatMul8bitLt: inputs will be cast from {A.dtype} to float16 during quantization\")\n",
"[2023-08-24 21:18:49,486] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:18:49,486] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"[2023-08-24 21:18:49,486] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 0%| | 0/8 [00:00<?, ?it/s]\u001b[A[2023-08-24 21:18:50,888] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:18:50,888] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 25%|███████████▎ | 2/8 [00:01<00:04, 1.43it/s]\u001b[A[2023-08-24 21:18:52,314] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:18:52,314] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 38%|████████████████▉ | 3/8 [00:02<00:05, 1.00s/it]\u001b[A[2023-08-24 21:18:53,675] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:18:53,676] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 50%|██████████████████████▌ | 4/8 [00:04<00:04, 1.14s/it]\u001b[A[2023-08-24 21:18:55,074] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:18:55,074] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 62%|████████████████████████████▏ | 5/8 [00:05<00:03, 1.23s/it]\u001b[A[2023-08-24 21:18:56,457] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:18:56,457] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 75%|█████████████████████████████████▊ | 6/8 [00:06<00:02, 1.28s/it]\u001b[A[2023-08-24 21:18:57,881] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:18:57,881] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 88%|███████████████████████████████████████▍ | 7/8 [00:08<00:01, 1.33s/it]\u001b[A[2023-08-24 21:18:59,267] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:18:59,267] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" \u001b[A\n",
"\u001b[A{'eval_loss': 0.013087373226881027, 'eval_runtime': 11.1759, 'eval_samples_per_second': 20.222, 'eval_steps_per_second': 10.111, 'epoch': 3.89}\n",
" 78%|████████████████████████████████ | 180/230 [58:03<15:42, 18.85s/it]\n",
"100%|█████████████████████████████████████████████| 8/8 [00:09<00:00, 1.34s/it]\u001b[A\n",
" \u001b[A/usr/local/lib/python3.10/dist-packages/bitsandbytes/autograd/_functions.py:322: UserWarning: MatMul8bitLt: inputs will be cast from torch.bfloat16 to float16 during quantization\n",
" warnings.warn(f\"MatMul8bitLt: inputs will be cast from {A.dtype} to float16 during quantization\")\n",
"{'loss': 0.0128, 'learning_rate': 2.1367578921460074e-05, 'epoch': 3.91} \n",
"{'loss': 0.0103, 'learning_rate': 2.0481417232811573e-05, 'epoch': 3.94} \n",
"{'loss': 0.0099, 'learning_rate': 1.961192192583934e-05, 'epoch': 3.96} \n",
"{'loss': 0.0112, 'learning_rate': 1.8759275238960473e-05, 'epoch': 3.98} \n",
"{'loss': 0.0132, 'learning_rate': 1.7923655879272393e-05, 'epoch': 4.0} \n",
" 80%|████████████████████████████████▉ | 185/230 [59:38<14:45, 19.68s/it][2023-08-24 21:20:34,361] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 1514815\u001b[39m\n",
"[2023-08-24 21:20:34,361] [INFO] [axolotl.utils.dataloader.generate_batches:181] [PID:125016] generating packed batches\u001b[39m\n",
"[2023-08-24 21:20:34,363] [INFO] [axolotl.utils.dataloader.generate_batches:187] [PID:125016] b61d2abf3bc15c84376d0af3386cd5fac907d76f1a3fd6fec08d54c6b52d49cb\u001b[39m\n",
"[2023-08-24 21:20:34,365] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 1514815\u001b[39m\n",
"{'loss': 0.0102, 'learning_rate': 1.7105238985097472e-05, 'epoch': 4.02} \n",
"{'loss': 0.0113, 'learning_rate': 1.6304196089275658e-05, 'epoch': 4.04} \n",
"{'loss': 0.0117, 'learning_rate': 1.5520695083212678e-05, 'epoch': 4.06} \n",
"{'loss': 0.012, 'learning_rate': 1.4754900181691467e-05, 'epoch': 4.09} \n",
"{'loss': 0.0144, 'learning_rate': 1.4006971888454323e-05, 'epoch': 4.11} \n",
"{'loss': 0.0102, 'learning_rate': 1.3277066962562645e-05, 'epoch': 4.13} \n",
"{'loss': 0.0132, 'learning_rate': 1.2565338385541792e-05, 'epoch': 4.15} \n",
"{'loss': 0.013, 'learning_rate': 1.1871935329317363e-05, 'epoch': 4.17} \n",
"{'loss': 0.0137, 'learning_rate': 1.1197003124950222e-05, 'epoch': 4.19} \n",
"{'loss': 0.0114, 'learning_rate': 1.0540683232176307e-05, 'epoch': 4.22} \n",
"{'loss': 0.0119, 'learning_rate': 9.903113209758096e-06, 'epoch': 4.24} \n",
"{'loss': 0.0126, 'learning_rate': 9.284426686653303e-06, 'epoch': 4.26} \n",
"{'loss': 0.0137, 'learning_rate': 8.68475333400769e-06, 'epoch': 4.28} \n",
"{'loss': 0.0132, 'learning_rate': 8.10421883797694e-06, 'epoch': 4.3} \n",
"{'loss': 0.0111, 'learning_rate': 7.542944873384106e-06, 'epoch': 4.32} \n",
" 87%|█████████████████████████████████▉ | 200/230 [1:04:20<09:26, 18.88s/it][2023-08-24 21:25:17,008] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"[2023-08-24 21:25:17,016] [INFO] [axolotl.utils.dataloader.generate_batches:181] [PID:125016] generating packed batches\u001b[39m\n",
"[2023-08-24 21:25:17,016] [INFO] [axolotl.utils.dataloader.generate_batches:187] [PID:125016] c0ef04db402ba917eb072daff58b8c0ef38c662600f92eee3292e60918d59b78\u001b[39m\n",
"[2023-08-24 21:25:17,017] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"/usr/local/lib/python3.10/dist-packages/bitsandbytes/autograd/_functions.py:322: UserWarning: MatMul8bitLt: inputs will be cast from torch.bfloat16 to float16 during quantization\n",
" warnings.warn(f\"MatMul8bitLt: inputs will be cast from {A.dtype} to float16 during quantization\")\n",
"[2023-08-24 21:25:18,378] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:25:18,378] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"[2023-08-24 21:25:18,378] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 0%| | 0/8 [00:00<?, ?it/s]\u001b[A[2023-08-24 21:25:19,776] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:25:19,776] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 25%|███████████▎ | 2/8 [00:01<00:04, 1.43it/s]\u001b[A[2023-08-24 21:25:21,199] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:25:21,199] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 38%|████████████████▉ | 3/8 [00:02<00:05, 1.00s/it]\u001b[A[2023-08-24 21:25:22,559] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:25:22,559] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 50%|██████████████████████▌ | 4/8 [00:04<00:04, 1.13s/it]\u001b[A[2023-08-24 21:25:23,958] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:25:23,958] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 62%|████████████████████████████▏ | 5/8 [00:05<00:03, 1.23s/it]\u001b[A[2023-08-24 21:25:25,341] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:25:25,341] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 75%|█████████████████████████████████▊ | 6/8 [00:06<00:02, 1.28s/it]\u001b[A[2023-08-24 21:25:26,764] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:25:26,764] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 88%|███████████████████████████████████████▍ | 7/8 [00:08<00:01, 1.32s/it]\u001b[A[2023-08-24 21:25:28,152] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:25:28,152] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" \u001b[A\n",
"\u001b[A{'eval_loss': 0.013082703575491905, 'eval_runtime': 11.1685, 'eval_samples_per_second': 20.235, 'eval_steps_per_second': 10.118, 'epoch': 4.32}\n",
" 87%|█████████████████████████████████▉ | 200/230 [1:04:32<09:26, 18.88s/it]\n",
"100%|█████████████████████████████████████████████| 8/8 [00:09<00:00, 1.34s/it]\u001b[A\n",
"{'loss': 0.0109, 'learning_rate': 7.0010490782176145e-06, 'epoch': 4.35} \u001b[A\n",
"{'loss': 0.0151, 'learning_rate': 6.4786450289753715e-06, 'epoch': 4.37} \n",
"{'loss': 0.016, 'learning_rate': 5.975842216860239e-06, 'epoch': 4.39} \n",
"{'loss': 0.0119, 'learning_rate': 5.492746024831541e-06, 'epoch': 4.41} \n",
"{'loss': 0.0132, 'learning_rate': 5.029457705517793e-06, 'epoch': 4.43} \n",
"{'loss': 0.0109, 'learning_rate': 4.586074359995119e-06, 'epoch': 4.45} \n",
"{'loss': 0.01, 'learning_rate': 4.162688917435631e-06, 'epoch': 4.48} \n",
"{'loss': 0.0125, 'learning_rate': 3.7593901156303566e-06, 'epoch': 4.5} \n",
"{'loss': 0.0137, 'learning_rate': 3.3762624823906573e-06, 'epoch': 4.52} \n",
"{'loss': 0.0122, 'learning_rate': 3.0133863178318232e-06, 'epoch': 4.54} \n",
"{'loss': 0.0125, 'learning_rate': 2.6708376775430033e-06, 'epoch': 4.56} \n",
"{'loss': 0.0132, 'learning_rate': 2.3486883566465777e-06, 'epoch': 4.58} \n",
"{'loss': 0.0118, 'learning_rate': 2.0470058747505516e-06, 'epoch': 4.61} \n",
"{'loss': 0.0124, 'learning_rate': 1.7658534617971067e-06, 'epoch': 4.63} \n",
"{'loss': 0.0121, 'learning_rate': 1.5052900448100815e-06, 'epoch': 4.65} \n",
"{'loss': 0.0145, 'learning_rate': 1.2653702355444608e-06, 'epoch': 4.67} \n",
"{'loss': 0.0133, 'learning_rate': 1.0461443190402099e-06, 'epoch': 4.69} \n",
"{'loss': 0.0132, 'learning_rate': 8.476582430830049e-07, 'epoch': 4.71} \n",
"{'loss': 0.0106, 'learning_rate': 6.699536085739588e-07, 'epoch': 4.74} \n",
"{'loss': 0.0106, 'learning_rate': 5.130676608104845e-07, 'epoch': 4.76} \n",
" 96%|█████████████████████████████████████▎ | 220/230 [1:10:47<03:08, 18.85s/it][2023-08-24 21:31:44,045] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"[2023-08-24 21:31:44,053] [INFO] [axolotl.utils.dataloader.generate_batches:181] [PID:125016] generating packed batches\u001b[39m\n",
"[2023-08-24 21:31:44,053] [INFO] [axolotl.utils.dataloader.generate_batches:187] [PID:125016] c0ef04db402ba917eb072daff58b8c0ef38c662600f92eee3292e60918d59b78\u001b[39m\n",
"[2023-08-24 21:31:44,054] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"/usr/local/lib/python3.10/dist-packages/bitsandbytes/autograd/_functions.py:322: UserWarning: MatMul8bitLt: inputs will be cast from torch.bfloat16 to float16 during quantization\n",
" warnings.warn(f\"MatMul8bitLt: inputs will be cast from {A.dtype} to float16 during quantization\")\n",
"[2023-08-24 21:31:45,414] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:31:45,415] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"[2023-08-24 21:31:45,415] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 0%| | 0/8 [00:00<?, ?it/s]\u001b[A[2023-08-24 21:31:46,811] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:31:46,811] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 25%|███████████▎ | 2/8 [00:01<00:04, 1.43it/s]\u001b[A[2023-08-24 21:31:48,235] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:31:48,235] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 38%|████████████████▉ | 3/8 [00:02<00:05, 1.00s/it]\u001b[A[2023-08-24 21:31:49,595] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:31:49,596] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 50%|██████████████████████▌ | 4/8 [00:04<00:04, 1.13s/it]\u001b[A[2023-08-24 21:31:50,994] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:31:50,994] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 62%|████████████████████████████▏ | 5/8 [00:05<00:03, 1.23s/it]\u001b[A[2023-08-24 21:31:52,376] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:31:52,377] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 75%|█████████████████████████████████▊ | 6/8 [00:06<00:02, 1.28s/it]\u001b[A[2023-08-24 21:31:53,798] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:31:53,799] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" 88%|███████████████████████████████████████▍ | 7/8 [00:08<00:01, 1.32s/it]\u001b[A[2023-08-24 21:31:55,183] [INFO] [accelerate.accelerator.log:60] [PID:125016] The used dataset had no length, returning gathered tensors. You should drop the remainder yourself.\n",
"[2023-08-24 21:31:55,183] [INFO] [axolotl.utils.dataloader._len_est:262] [PID:125016] packing_efficiency_estimate: 0.98 total_num_tokens per device: 79978\u001b[39m\n",
"\n",
" \u001b[A\n",
"\u001b[A{'eval_loss': 0.01321522518992424, 'eval_runtime': 11.1631, 'eval_samples_per_second': 20.245, 'eval_steps_per_second': 10.123, 'epoch': 4.76}\n",
" 96%|█████████████████████████████████████▎ | 220/230 [1:10:59<03:08, 18.85s/it]\n",
"100%|█████████████████████████████████████████████| 8/8 [00:09<00:00, 1.34s/it]\u001b[A\n",
"{'loss': 0.013, 'learning_rate': 3.7703328167999485e-07, 'epoch': 4.78} \u001b[A\n",
"{'loss': 0.0115, 'learning_rate': 2.6187898276813784e-07, 'epoch': 4.8} \n",
"{'loss': 0.0091, 'learning_rate': 1.6762889938303217e-07, 'epoch': 4.82} \n",
"{'loss': 0.0112, 'learning_rate': 9.430278549675819e-08, 'epoch': 4.84} \n",
"{'loss': 0.0111, 'learning_rate': 4.191600960505859e-08, 'epoch': 4.86} \n",
"{'loss': 0.0109, 'learning_rate': 1.0479551506259456e-08, 'epoch': 4.89} \n",
"{'loss': 0.0148, 'learning_rate': 0.0, 'epoch': 4.91} \n",
"{'loss': 0.0152, 'learning_rate': 1.0479551506270558e-08, 'epoch': 4.93} \n",
"{'loss': 0.0119, 'learning_rate': 4.191600960505859e-08, 'epoch': 4.95} \n",
"{'loss': 0.0092, 'learning_rate': 9.430278549675819e-08, 'epoch': 4.97} \n",
"{'train_runtime': 4450.2443, 'train_samples_per_second': 4.803, 'train_steps_per_second': 0.052, 'train_loss': 0.08349336267084531, 'epoch': 4.97}\n",
"100%|███████████████████████████████████████| 230/230 [1:14:07<00:00, 19.34s/it]\n",
"[2023-08-24 21:35:04,013] [INFO] [axolotl.scripts.train:303] [PID:125016] Training Completed!!! Saving pre-trained model to ./models/run1\u001b[39m\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: Waiting for W&B process to finish... \u001b[32m(success).\u001b[0m\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: \n",
"\u001b[34m\u001b[1mwandb\u001b[0m: Run history:\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: eval/loss █▃▂▂▁▁▁▁▁▁▁\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: eval/runtime █▂▁▁▂▁▃▄▄▃▂\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: eval/samples_per_second ▁▇██▇█▆▅▅▆▇\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: eval/steps_per_second ▁▇██▇█▆▅▅▆▇\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: train/epoch ▁▁▁▂▂▂▂▂▂▃▃▃▃▃▄▄▄▄▄▄▅▅▅▅▅▅▆▆▆▆▆▇▇▇▇▇▇███\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: train/global_step ▁▁▁▂▂▂▂▂▂▃▃▃▃▃▄▄▄▄▄▄▅▅▅▅▅▅▆▆▆▆▆▇▇▇▇▇▇███\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: train/learning_rate ▂▅██████▇▇▇▇▇▆▆▆▆▅▅▅▅▄▄▄▃▃▃▃▂▂▂▂▂▁▁▁▁▁▁▁\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: train/loss ██▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: train/total_flos ▁\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: train/train_loss ▁\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: train/train_runtime ▁\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: train/train_samples_per_second ▁\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: train/train_steps_per_second ▁\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: \n",
"\u001b[34m\u001b[1mwandb\u001b[0m: Run summary:\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: eval/loss 0.01322\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: eval/runtime 11.1631\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: eval/samples_per_second 20.245\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: eval/steps_per_second 10.123\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: train/epoch 4.97\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: train/global_step 230\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: train/learning_rate 0.0\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: train/loss 0.0092\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: train/total_flos 2.966052920056873e+17\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: train/train_loss 0.08349\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: train/train_runtime 4450.2443\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: train/train_samples_per_second 4.803\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: train/train_steps_per_second 0.052\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: \n",
"\u001b[34m\u001b[1mwandb\u001b[0m: 🚀 View run \u001b[33mrun1\u001b[0m at: \u001b[34m\u001b[4mhttps://wandb.ai/openpipe-team/classify-recipes/runs/run1\u001b[0m\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: ️⚡ View job at \u001b[34m\u001b[4mhttps://wandb.ai/openpipe-team/classify-recipes/jobs/QXJ0aWZhY3RDb2xsZWN0aW9uOjkyNjYwODUw/version_details/v0\u001b[0m\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: Synced 5 W&B file(s), 0 media file(s), 2 artifact file(s) and 0 other file(s)\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: Find logs at: \u001b[35m\u001b[1m./wandb/run-20230824_202055-run1/logs\u001b[0m\n",
"Exception in thread NetStatThr:\n",
"Traceback (most recent call last):\n",
" File \"/usr/lib/python3.10/threading.py\", line 1016, in _bootstrap_inner\n",
" self.run()\n",
" File \"/usr/lib/python3.10/threading.py\", line 953, in run\n",
" self._target(*self._args, **self._kwargs)\n",
" File \"/usr/local/lib/python3.10/dist-packages/wandb/sdk/wandb_run.py\", line 256, in check_network_status\n",
" self._loop_check_status(\n",
" File \"/usr/local/lib/python3.10/dist-packages/wandb/sdk/wandb_run.py\", line 212, in _loop_check_status\n",
" local_handle = request()\n",
" File \"/usr/local/lib/python3.10/dist-packages/wandb/sdk/interface/interface.py\", line 864, in deliver_network_status\n",
" return self._deliver_network_status(status)\n",
" File \"/usr/local/lib/python3.10/dist-packages/wandb/sdk/interface/interface_shared.py\", line 610, in _deliver_network_status\n",
" return self._deliver_record(record)\n",
" File \"/usr/local/lib/python3.10/dist-packages/wandb/sdk/interface/interface_shared.py\", line 569, in _deliver_record\n",
" handle = mailbox._deliver_record(record, interface=self)\n",
" File \"/usr/local/lib/python3.10/dist-packages/wandb/sdk/lib/mailbox.py\", line 455, in _deliver_record\n",
" interface._publish(record)\n",
" File \"/usr/local/lib/python3.10/dist-packages/wandb/sdk/interface/interface_sock.py\", line 51, in _publish\n",
" self._sock_client.send_record_publish(record)\n",
" File \"/usr/local/lib/python3.10/dist-packages/wandb/sdk/lib/sock_client.py\", line 221, in send_record_publish\n",
" self.send_server_request(server_req)\n",
" File \"/usr/local/lib/python3.10/dist-packages/wandb/sdk/lib/sock_client.py\", line 155, in send_server_request\n",
" self._send_message(msg)\n",
" File \"/usr/local/lib/python3.10/dist-packages/wandb/sdk/lib/sock_client.py\", line 152, in _send_message\n",
" self._sendall_with_error_handle(header + data)\n",
" File \"/usr/local/lib/python3.10/dist-packages/wandb/sdk/lib/sock_client.py\", line 130, in _sendall_with_error_handle\n",
" sent = self._sock.send(data)\n",
"BrokenPipeError: [Errno 32] Broken pipe\n",
"\u001b[0m"
]
}
],
"source": [
"!accelerate launch ./axolotl/scripts/finetune.py training-config.yaml"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Sweet! I now have a new directory `./models/run1`. This contains my trained model, which I can use to classify more recipes.\n",
"\n",
"There's one more step though. I trained our model using [LoRA](https://huggingface.co/docs/peft/conceptual_guides/lora), which is a memory-efficient training method. But the inference library we'll use for testing doesn't support LoRA models directly yet, so we need to \"merge\" our LoRA model to transform it into a standard Llama2-shaped model. I've defined a small helper to do that called `merge_lora_model` that I'll use below.\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Merging model (this could take a while)\n",
"Loading base model\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "13b36646399a45eab184327f17165046",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Loading checkpoint shards: 0%| | 0/2 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Loading PEFT model\n",
"Running merge_and_unload\n",
"Model saved to ./models/run1/merged\n",
"Final model saved to './models/run1/merged'\n"
]
}
],
"source": [
"from utils import merge_lora_model\n",
"\n",
"print(\"Merging model (this could take a while)\")\n",
"final_model_dir = merge_lora_model(\"training-config.yaml\")\n",
"print(f\"Final model saved to '{final_model_dir}'\")\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Ok, I have a model, but is it actually any good? I'll run some evaluations in [./evaluate.ipynb](./evaluate.ipynb) to check.\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}

View File

@@ -0,0 +1,905 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"I have a model in `./models/run1/merged` that was trained on GPT-4's outputs to classify recipes. I need to figure out whether it does a good job at classifying recipes. I'll install dependencies first.\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%%capture\n",
"%pip install vllm==0.1.3 pandas==2.0.3 joblib==1.3.2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Remember I got a \"test.jsonl\" file from OpenPipe back in [./prepare.ipynb](./prepare.ipynb)? That's data from our dataset that we didn't use in training, so we can use it to check our model's performance.\n"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"\n",
"test_data = pd.read_json(\"./data/test.jsonl\", lines=True)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"During the training process Axolotl transformed our data into an instruction/response format known as the \"Alpaca format\" based on [the project that introduced it](https://github.com/tatsu-lab/stanford_alpaca). I need to transform my test data into the same format for best results.\n"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Sample prompt:\n",
"--------------\n",
"### Instruction:\n",
"[{\"role\":\"system\",\"content\":\"Your goal is to classify a recipe along several dimensions.Pay attention to the instructions.\"},{\"role\":\"user\",\"content\":\"Pan Gravy\\n\\nIngredients:\\n- 1/3 cup all purpose flour\\n- 1/3 cup turkey drippings\\n- 3 cup water or broth\\n- 1/8 to 1/4 teaspoon salt\\n- 1/8 tsp pepper\\n\\nDirections:\\n- In a skillet or roasting pan, add flour to drippings; blend well.\\n- Cook over medium heat 2 to 3 minutes until smooth and light brown, stirring constantly.\\n- Add water; cook until mixture boils and thickens, stirring constantly.\\n- Stir in salt and pepper.\\n- *Flour and drippings can be decreased to 1/4 cup each for thinner gravy.\\n- *\"}]\n",
"\n",
"### Response:\n",
"\n"
]
}
],
"source": [
"from axolotl.prompters import UnpromptedPrompter\n",
"\n",
"prompter = UnpromptedPrompter()\n",
"\n",
"\n",
"def format_prompt(input: str) -> str:\n",
" return next(prompter.build_prompt(input))\n",
"\n",
"\n",
"prompts = test_data[\"instruction\"].apply(format_prompt)\n",
"\n",
"print(f\"Sample prompt:\\n--------------\\n{prompts[0]}\")\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Next up, I'll use [vLLM](https://vllm.readthedocs.io/en/latest/) to efficiently process all the prompts in our test data with our own model.\n"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"INFO 08-28 00:26:23 llm_engine.py:70] Initializing an LLM engine with config: model='./models/run1/merged', tokenizer='./models/run1/merged', tokenizer_mode=auto, trust_remote_code=False, dtype=torch.float16, use_dummy_weights=False, download_dir=None, use_np_weights=False, tensor_parallel_size=1, seed=0)\n",
"INFO 08-28 00:27:26 llm_engine.py:196] # GPU blocks: 3419, # CPU blocks: 512\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Processed prompts: 100%|██████████| 500/500 [00:37<00:00, 13.34it/s]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Sample output:\n",
"--------------\n",
"{\"role\":\"assistant\",\"content\":null,\"function_call\":{\"name\":\"classify\",\"arguments\":\"{\\n\\\"has_non_fish_meat\\\": true,\\n\\\"requires_oven\\\": false,\\n\\\"requires_stove\\\": true,\\n\\\"cook_time_over_30_mins\\\": false,\\n\\\"main_dish\\\": false\\n}\"}}\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n"
]
}
],
"source": [
"from vllm import LLM, SamplingParams\n",
"\n",
"llm = LLM(model=\"./models/run1/merged\", max_num_batched_tokens=4096)\n",
"\n",
"sampling_params = SamplingParams(\n",
" # 120 should be fine for the work we're doing here.\n",
" max_tokens=120,\n",
" # This is a deterministic task so temperature=0 is best.\n",
" temperature=0,\n",
")\n",
"\n",
"my_outputs = llm.generate(prompts, sampling_params=sampling_params)\n",
"my_outputs = [o.outputs[0].text for o in my_outputs]\n",
"\n",
"test_data[\"my_outputs\"] = my_outputs\n",
"\n",
"print(f\"Sample output:\\n--------------\\n{my_outputs[0]}\")\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Ok, we have our outputs! There are 5 categories we classify each recipe on, so let's check what percentage of the time our model's output matches GPT-4's. I'll write a quick eval function for that:\n"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Overall accuracy: 0.95\n"
]
}
],
"source": [
"import json\n",
"\n",
"\n",
"def parse_fn_call(str):\n",
" \"\"\"Parse the function call arguments from the response\"\"\"\n",
" response_dict = json.loads(str)\n",
" args_dict = json.loads(response_dict[\"function_call\"][\"arguments\"])\n",
"\n",
" return args_dict\n",
"\n",
"\n",
"test_data[\"output_parsed\"] = test_data[\"output\"].apply(parse_fn_call)\n",
"test_data[\"my_outputs_parsed\"] = test_data[\"my_outputs\"].apply(parse_fn_call)\n",
"\n",
"\n",
"def calculate_accuracy(row, labels_col):\n",
" \"\"\"Calculate the fraction of my model's outputs that match the reference outputs\"\"\"\n",
" true_outputs = row[\"output_parsed\"]\n",
" labels_outputs = row[labels_col]\n",
"\n",
" # print(f\"true_outputs: {true_outputs}\")\n",
" # print(f\"my_outputs: {row[labels_col]}\")\n",
"\n",
" num_matching_outputs = 0\n",
" for key in true_outputs.keys():\n",
" if key in labels_outputs and true_outputs[key] == labels_outputs[key]:\n",
" num_matching_outputs += 1\n",
"\n",
" return num_matching_outputs / len(true_outputs)\n",
"\n",
"\n",
"test_data[\"accuracy\"] = test_data.apply(\n",
" calculate_accuracy, axis=1, labels_col=\"my_outputs_parsed\"\n",
")\n",
"\n",
"print(f\"Overall accuracy: {test_data['accuracy'].mean():.2f}\")\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"95% seems good! However, we don't have much to compare it to. Let's see how GPT-3.5 would do on the same task as a baseline. We'll use the same prompt we used with GPT-4 to generate the labels.\n"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Sample recipe:\n",
"--------------\n",
"Pan Gravy\n",
"\n",
"Ingredients:\n",
"- 1/3 cup all purpose flour\n",
"- 1/3 cup turkey drippings\n",
"- 3 cup water or broth\n",
"- 1/8 to 1/4 teaspoon salt\n",
"- 1/8 tsp pepper\n",
"\n",
"Directions:\n",
"- In a skillet or roasting pan, add flour to drippings; blend well.\n",
"- Cook over medium heat 2 to 3 minutes until smooth and light brown, stirring constantly.\n",
"- Add water; cook until mixture boils and thickens, stirring constantly.\n",
"- Stir in salt and pepper.\n",
"- *Flour and drippings can be decreased to 1/4 cup each for thinner gravy.\n",
"- *\n"
]
}
],
"source": [
"import json\n",
"\n",
"\n",
"def extract_recipe(row):\n",
" \"\"\"Extract the recipe from the instruction\"\"\"\n",
" return json.loads(row[\"instruction\"])[1][\"content\"]\n",
"\n",
"\n",
"recipes = test_data.apply(extract_recipe, axis=1)\n",
"print(f\"Sample recipe:\\n--------------\\n{recipes[0]}\")\n"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Classifying first recipe:\n",
"------------------\n",
"{'has_non_fish_meat': False, 'requires_oven': False, 'requires_stove': True, 'cook_time_over_30_mins': False, 'main_dish': False}\n"
]
}
],
"source": [
"import joblib\n",
"import openai\n",
"import os\n",
"import dotenv\n",
"\n",
"dotenv.load_dotenv()\n",
"openai.api_key = os.getenv(\"OPENAI_API_KEY\")\n",
"\n",
"memory = joblib.Memory(\"./cache\", verbose=0)\n",
"\n",
"\n",
"@memory.cache\n",
"def classify_recipe_35(recipe: str):\n",
" completion = openai.ChatCompletion.create(\n",
" model=\"gpt-3.5-turbo\",\n",
" messages=[\n",
" {\n",
" \"role\": \"system\",\n",
" \"content\": \"Your goal is to classify a recipe along several dimensions.Pay attention to the instructions.\",\n",
" },\n",
" {\n",
" \"role\": \"user\",\n",
" \"content\": recipe,\n",
" },\n",
" ],\n",
" functions=[\n",
" {\n",
" \"name\": \"classify\",\n",
" \"parameters\": {\n",
" \"type\": \"object\",\n",
" \"properties\": {\n",
" \"has_non_fish_meat\": {\n",
" \"type\": \"boolean\",\n",
" \"description\": \"True if the recipe contains any meat or meat products (eg. chicken broth) besides fish\",\n",
" },\n",
" \"requires_oven\": {\n",
" \"type\": \"boolean\",\n",
" \"description\": \"True if the recipe requires an oven\",\n",
" },\n",
" \"requires_stove\": {\n",
" \"type\": \"boolean\",\n",
" \"description\": \"True if the recipe requires a stove\",\n",
" },\n",
" \"cook_time_over_30_mins\": {\n",
" \"type\": \"boolean\",\n",
" \"description\": \"True if the recipe takes over 30 minutes to prepare and cook, including waiting time\",\n",
" },\n",
" \"main_dish\": {\n",
" \"type\": \"boolean\",\n",
" \"description\": \"True if the recipe can be served as a main dish\",\n",
" },\n",
" },\n",
" \"required\": [\n",
" \"has_non_fish_meat\",\n",
" \"requires_oven\",\n",
" \"requires_stove\",\n",
" \"cook_time_over_30_mins\",\n",
" \"main_dish\",\n",
" ],\n",
" },\n",
" }\n",
" ],\n",
" function_call={\n",
" \"name\": \"classify\",\n",
" },\n",
" )\n",
" return json.loads(completion.choices[0].message.function_call.arguments)\n",
"\n",
"\n",
"print(\"Classifying first recipe:\\n------------------\")\n",
"print(classify_recipe_35(recipes[0]))\n"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"\u001b[A\n",
"\u001b[A\n",
"\u001b[A\n",
"\u001b[A\n",
"\u001b[A\n",
"\u001b[A\n",
"\u001b[A\n",
"\u001b[A\n",
"\u001b[A\n",
"\u001b[A\n",
"\u001b[A\n",
"\u001b[A\n",
"\u001b[A\n",
"\u001b[A\n",
"\u001b[A\n",
"100%|██████████| 500/500 [00:31<00:00, 15.77it/s]\n"
]
}
],
"source": [
"from tqdm import tqdm\n",
"\n",
"test_data[\"gpt_3.5\"] = [classify_recipe_35(r) for r in tqdm(recipes)]\n"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"GPT-3.5 accuracy: 0.91\n"
]
}
],
"source": [
"test_data[\"gpt_3.5_accuracy\"] = test_data.apply(\n",
" calculate_accuracy, axis=1, labels_col=\"gpt_3.5\"\n",
")\n",
"\n",
"print(f\"GPT-3.5 accuracy: {test_data['gpt_3.5_accuracy'].mean():.2f}\")\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"And for completeness, let's try a fine-tuned GPT-3.5 model. You can find the fine-tuning code in [finetune-gpt-3.5.ipynb](./finetune-gpt-3.5.ipynb)\n"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'has_non_fish_meat': True,\n",
" 'requires_oven': False,\n",
" 'requires_stove': True,\n",
" 'cook_time_over_30_mins': False,\n",
" 'main_dish': False}"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@memory.cache\n",
"def classify_recipe_35_ft(recipe: str):\n",
" completion = openai.ChatCompletion.create(\n",
" model=\"ft:gpt-3.5-turbo-0613:openpipe::7rZpPqYn\",\n",
" messages=[\n",
" {\n",
" \"role\": \"system\",\n",
" \"content\": \"Your goal is to classify a recipe along several \"\n",
" \"dimensions.Pay attention to the instructions.\",\n",
" },\n",
" {\"role\": \"user\", \"content\": recipe},\n",
" ],\n",
" )\n",
"\n",
" return json.loads(completion.choices[0].message.content)\n",
"\n",
"\n",
"classify_recipe_35_ft(recipes[0])\n"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 500/500 [07:31<00:00, 1.11it/s]\n"
]
}
],
"source": [
"test_data[\"gpt_3.5_ft\"] = [classify_recipe_35_ft(r) for r in tqdm(recipes)]\n"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"GPT-3.5 FT accuracy: 0.94\n"
]
}
],
"source": [
"test_data[\"gpt_3.5_ft_accuracy\"] = test_data.apply(\n",
" calculate_accuracy, axis=1, labels_col=\"gpt_3.5_ft\"\n",
")\n",
"\n",
"print(f\"GPT-3.5 FT accuracy: {test_data['gpt_3.5_ft_accuracy'].mean():.2f}\")\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Not bad! However, there are still a few rows where the model outputs don't match. Let's take a closer look.\n"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Alligator Sauce Piquant\n",
"\n",
"Ingredients:\n",
"- 2 lb. alligator, boneless and cubed *\n",
"- 4 onions, diced\n",
"- 1 c. parsley, chopped\n",
"- 4 stalks celery, chopped\n",
"- 1 bell pepper, diced\n",
"- 1 c. catsup\n",
"- 2 Tbsp. Heinz steak sauce\n",
"- 2 Tbsp. soy sauce\n",
"- 2 Tbsp. Louisiana hot sauce\n",
"- 2 Tbsp. cornstarch\n",
"- 1 tsp. salt\n",
"- 2 tsp. red pepper (ground)\n",
"- 1/4 c. cooking oil\n",
"\n",
"Directions:\n",
"- *Alligator must be free of all fat; also dark meat is the best (leg and body meat), boneless.\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>GPT-4</th>\n",
" <th>My model</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>cook_time_over_30_mins</th>\n",
" <td>True</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
" <th>main_dish</th>\n",
" <td>True</td>\n",
" <td>False</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" GPT-4 My model\n",
"cook_time_over_30_mins True False\n",
"main_dish True False"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Veggie Casserole\n",
"\n",
"Ingredients:\n",
"- 1 (8 oz.) bag mixed veggies (corn, peas, carrots, green beans), steamed\n",
"- 1 c. celery\n",
"- 1 c. onions\n",
"- 1 c. Cheddar cheese\n",
"- 1 c. mayonnaise\n",
"\n",
"Directions:\n",
"- Mix above ingredients.\n",
"- Bake at 350° for 30 minutes, until bubbly.\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>GPT-4</th>\n",
" <th>My model</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>main_dish</th>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" GPT-4 My model\n",
"main_dish False True"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Rhonda'S Butter Chess Pie\n",
"\n",
"Ingredients:\n",
"- 5 eggs\n",
"- 1 stick melted butter\n",
"- 2 c. sugar\n",
"- 1 tsp. vanilla\n",
"- 1 Tbsp. cornstarch\n",
"- 1/2 c. buttermilk\n",
"- unbaked 9-inch deep dish pie shell\n",
"\n",
"Directions:\n",
"- Mix eggs with sugar and cornstarch until smooth.\n",
"- Add melted butter, vanilla and buttermilk.\n",
"- Bake at 350° for 30 minutes or until done.\n",
"- Let cool and chill.\n",
"- Similar to Furr's Butter Chess Pie.\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>GPT-4</th>\n",
" <th>My model</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>cook_time_over_30_mins</th>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" GPT-4 My model\n",
"cook_time_over_30_mins False True"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Broccoli Gorgonzola Cream Soup\n",
"\n",
"Ingredients:\n",
"- 2 heads Broccoli\n",
"- 700 milliliters Water\n",
"- 1 Onion, Peeled And Cut Into Chunks\n",
"- 1 pinch Salt\n",
"- 1 teaspoon Oregano\n",
"- 1 Potato, Peeled And Cut Into Chunks\n",
"- 200 grams Crumbled Gorgonzola\n",
"- 1 Tablespoon Finely Grated Parmesan\n",
"\n",
"Directions:\n",
"- Cut off the hard trunks of the broccoli and cut it into small pieces. Prepare a pot with water, add broccoli, onion, salt and oregano and boil for about 30 minutes.\n",
"- Add the peeled potato and boil for another 20 minutes. When vegetables are cooked, strain and save the stock.\n",
"- Using a hand blender, puree vegetables, adding as much stock as desired. Bring soup back to heat over low heat, and sir in gorgonzola. Remove from heat and add Parmesan.\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>GPT-4</th>\n",
" <th>My model</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>main_dish</th>\n",
" <td>False</td>\n",
" <td>True</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" GPT-4 My model\n",
"main_dish False True"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Wild Rice With Cucumber And Feta\n",
"\n",
"Ingredients:\n",
"- 1 (8.5-ounce) package precooked wild rice (such as Archer Farms)\n",
"- 1 cup diced English cucumber\n",
"- 1 1/2 tablespoons olive oil\n",
"- 1 tablespoon fresh lemon juice\n",
"- 2 ounces crumbled feta cheese\n",
"- 1/2 teaspoon pepper\n",
"- 1/4 teaspoon salt\n",
"\n",
"Directions:\n",
"- Prepare rice according to the package directions.\n",
"- Combine cooked rice, cucumber, olive oil, lemon juice, and crumbled feta cheese in a medium bowl; toss to coat. Stir in pepper and salt.\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>GPT-4</th>\n",
" <th>My model</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>main_dish</th>\n",
" <td>True</td>\n",
" <td>False</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" GPT-4 My model\n",
"main_dish True False"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import numpy as np\n",
"\n",
"np.random.seed(42)\n",
"\n",
"for row in test_data[test_data.accuracy < 1].sample(5).itertuples():\n",
" print(json.loads(row.instruction)[1][\"content\"])\n",
"\n",
" gpt4_output = parse_fn_call(row.output)\n",
" my_output = parse_fn_call(row.my_outputs)\n",
"\n",
" table = pd.DataFrame(\n",
" {\n",
" \"GPT-4\": gpt4_output,\n",
" \"My model\": my_output,\n",
" }\n",
" )\n",
"\n",
" table = table[table[\"GPT-4\"] != table[\"My model\"]]\n",
" display(table)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Looking at the outputs, it's clear that our model still makes some mistakes. But at the same time, there are plenty of examples like \"Rhonda's Butter Chess Pie\" where our model gets it right, even though GPT-4 got it wrong! And there are also cases like the \"Veggie Casserole\", where the \"right\" answer is truly ambiguous and really both answers are defensible.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A realistic point of comparison here might be GPT-3.5. Let's try to classify the same set of recipes using GPT-3.5 and see how it does. We'll use the same prompt that we used with GPT-4 to generate the initial training data.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Interested in cost/latency benchmarking? You can check out [./benchmarking.ipynb](./benchmarking.ipynb) for an overview of my findings!\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}

View File

@@ -0,0 +1,349 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"I'm pretty happy with my model's accuracy relative to GPT-4. How does it compare cost-wise?\n",
"\n",
"I'll really push this to its limits -- let's see how quickly our poor model can classify the [full 2-million-recipe dataset](https://huggingface.co/datasets/corbt/all-recipes) 😈.\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%%capture\n",
"%pip install datasets==2.14.4 vllm==0.1.3"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Number of recipes: 2,147,248\n"
]
}
],
"source": [
"from datasets import load_dataset\n",
"\n",
"all_recipes = load_dataset(\"corbt/all-recipes\")[\"train\"][\"input\"]\n",
"\n",
"print(f\"Number of recipes: {len(all_recipes):,}\")\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"INFO 08-24 19:38:29 llm_engine.py:70] Initializing an LLM engine with config: model='./models/run1/merged', tokenizer='./models/run1/merged', tokenizer_mode=auto, trust_remote_code=False, dtype=torch.float16, use_dummy_weights=False, download_dir=None, use_np_weights=False, tensor_parallel_size=1, seed=0)\n",
"INFO 08-24 19:39:48 llm_engine.py:196] # GPU blocks: 3419, # CPU blocks: 512\n"
]
}
],
"source": [
"from vllm import LLM, SamplingParams\n",
"\n",
"llm = LLM(model=\"./models/run1/merged\", max_num_batched_tokens=4096)\n",
"\n",
"sampling_params = SamplingParams(\n",
" # 120 should be fine for the work we're doing here.\n",
" max_tokens=120,\n",
" # This is a deterministic task so temperature=0 is best.\n",
" temperature=0,\n",
")\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Start time: 1692906050.3340027\n",
"Processing recipes 0 to 10,000...\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Processed prompts: 100%|██████████| 10000/10000 [04:51<00:00, 34.30it/s]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Processing recipes 10,000 to 20,000...\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Processed prompts: 100%|██████████| 10000/10000 [04:54<00:00, 33.98it/s]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Processing recipes 20,000 to 30,000...\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Processed prompts: 100%|██████████| 10000/10000 [04:53<00:00, 34.11it/s]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Processing recipes 30,000 to 40,000...\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Processed prompts: 100%|██████████| 10000/10000 [04:53<00:00, 34.11it/s]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Processing recipes 40,000 to 50,000...\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Processed prompts: 48%|████▊ | 4796/10000 [02:21<03:18, 26.22it/s]"
]
},
{
"ename": "KeyboardInterrupt",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[6], line 12\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[39mfor\u001b[39;00m i \u001b[39min\u001b[39;00m \u001b[39mrange\u001b[39m(\u001b[39m0\u001b[39m, \u001b[39mlen\u001b[39m(all_recipes), BATCH_SIZE):\n\u001b[1;32m 11\u001b[0m \u001b[39mprint\u001b[39m(\u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mProcessing recipes \u001b[39m\u001b[39m{\u001b[39;00mi\u001b[39m:\u001b[39;00m\u001b[39m,\u001b[39m\u001b[39m}\u001b[39;00m\u001b[39m to \u001b[39m\u001b[39m{\u001b[39;00mi\u001b[39m+\u001b[39mBATCH_SIZE\u001b[39m:\u001b[39;00m\u001b[39m,\u001b[39m\u001b[39m}\u001b[39;00m\u001b[39m...\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[0;32m---> 12\u001b[0m outputs \u001b[39m=\u001b[39m llm\u001b[39m.\u001b[39;49mgenerate(all_recipes[i:i\u001b[39m+\u001b[39;49mBATCH_SIZE], sampling_params\u001b[39m=\u001b[39;49msampling_params)\n\u001b[1;32m 14\u001b[0m all_outputs\u001b[39m.\u001b[39mextend([o\u001b[39m.\u001b[39moutputs[\u001b[39m0\u001b[39m]\u001b[39m.\u001b[39mtext \u001b[39mfor\u001b[39;00m o \u001b[39min\u001b[39;00m outputs])\n\u001b[1;32m 16\u001b[0m end_time \u001b[39m=\u001b[39m time\u001b[39m.\u001b[39mtime()\n",
"File \u001b[0;32m/usr/local/lib/python3.10/dist-packages/vllm/entrypoints/llm.py:130\u001b[0m, in \u001b[0;36mLLM.generate\u001b[0;34m(self, prompts, sampling_params, prompt_token_ids, use_tqdm)\u001b[0m\n\u001b[1;32m 128\u001b[0m token_ids \u001b[39m=\u001b[39m prompt_token_ids[i]\n\u001b[1;32m 129\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_add_request(prompt, sampling_params, token_ids)\n\u001b[0;32m--> 130\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_run_engine(use_tqdm)\n",
"File \u001b[0;32m/usr/local/lib/python3.10/dist-packages/vllm/entrypoints/llm.py:150\u001b[0m, in \u001b[0;36mLLM._run_engine\u001b[0;34m(self, use_tqdm)\u001b[0m\n\u001b[1;32m 148\u001b[0m outputs: List[RequestOutput] \u001b[39m=\u001b[39m []\n\u001b[1;32m 149\u001b[0m \u001b[39mwhile\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mllm_engine\u001b[39m.\u001b[39mhas_unfinished_requests():\n\u001b[0;32m--> 150\u001b[0m step_outputs \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mllm_engine\u001b[39m.\u001b[39;49mstep()\n\u001b[1;32m 151\u001b[0m \u001b[39mfor\u001b[39;00m output \u001b[39min\u001b[39;00m step_outputs:\n\u001b[1;32m 152\u001b[0m \u001b[39mif\u001b[39;00m output\u001b[39m.\u001b[39mfinished:\n",
"File \u001b[0;32m/usr/local/lib/python3.10/dist-packages/vllm/engine/llm_engine.py:313\u001b[0m, in \u001b[0;36mLLMEngine.step\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 307\u001b[0m \u001b[39mreturn\u001b[39;00m [\n\u001b[1;32m 308\u001b[0m RequestOutput\u001b[39m.\u001b[39mfrom_seq_group(seq_group)\n\u001b[1;32m 309\u001b[0m \u001b[39mfor\u001b[39;00m seq_group \u001b[39min\u001b[39;00m scheduler_outputs\u001b[39m.\u001b[39mignored_seq_groups\n\u001b[1;32m 310\u001b[0m ]\n\u001b[1;32m 312\u001b[0m \u001b[39m# Execute the model.\u001b[39;00m\n\u001b[0;32m--> 313\u001b[0m output \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_run_workers(\n\u001b[1;32m 314\u001b[0m \u001b[39m\"\u001b[39;49m\u001b[39mexecute_model\u001b[39;49m\u001b[39m\"\u001b[39;49m,\n\u001b[1;32m 315\u001b[0m seq_group_metadata_list\u001b[39m=\u001b[39;49mseq_group_metadata_list,\n\u001b[1;32m 316\u001b[0m blocks_to_swap_in\u001b[39m=\u001b[39;49mscheduler_outputs\u001b[39m.\u001b[39;49mblocks_to_swap_in,\n\u001b[1;32m 317\u001b[0m blocks_to_swap_out\u001b[39m=\u001b[39;49mscheduler_outputs\u001b[39m.\u001b[39;49mblocks_to_swap_out,\n\u001b[1;32m 318\u001b[0m blocks_to_copy\u001b[39m=\u001b[39;49mscheduler_outputs\u001b[39m.\u001b[39;49mblocks_to_copy,\n\u001b[1;32m 319\u001b[0m )\n\u001b[1;32m 320\u001b[0m \u001b[39m# Update the scheduler with the model outputs.\u001b[39;00m\n\u001b[1;32m 321\u001b[0m seq_groups \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mscheduler\u001b[39m.\u001b[39mupdate(output)\n",
"File \u001b[0;32m/usr/local/lib/python3.10/dist-packages/vllm/engine/llm_engine.py:470\u001b[0m, in \u001b[0;36mLLMEngine._run_workers\u001b[0;34m(self, method, get_all_outputs, *args, **kwargs)\u001b[0m\n\u001b[1;32m 467\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[1;32m 468\u001b[0m executor \u001b[39m=\u001b[39m \u001b[39mgetattr\u001b[39m(worker, method)\n\u001b[0;32m--> 470\u001b[0m output \u001b[39m=\u001b[39m executor(\u001b[39m*\u001b[39;49margs, \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mkwargs)\n\u001b[1;32m 471\u001b[0m all_outputs\u001b[39m.\u001b[39mappend(output)\n\u001b[1;32m 473\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mparallel_config\u001b[39m.\u001b[39mworker_use_ray:\n",
"File \u001b[0;32m/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py:115\u001b[0m, in \u001b[0;36mcontext_decorator.<locals>.decorate_context\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 112\u001b[0m \u001b[39m@functools\u001b[39m\u001b[39m.\u001b[39mwraps(func)\n\u001b[1;32m 113\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mdecorate_context\u001b[39m(\u001b[39m*\u001b[39margs, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs):\n\u001b[1;32m 114\u001b[0m \u001b[39mwith\u001b[39;00m ctx_factory():\n\u001b[0;32m--> 115\u001b[0m \u001b[39mreturn\u001b[39;00m func(\u001b[39m*\u001b[39;49margs, \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mkwargs)\n",
"File \u001b[0;32m/usr/local/lib/python3.10/dist-packages/vllm/worker/worker.py:293\u001b[0m, in \u001b[0;36mWorker.execute_model\u001b[0;34m(self, seq_group_metadata_list, blocks_to_swap_in, blocks_to_swap_out, blocks_to_copy)\u001b[0m\n\u001b[1;32m 289\u001b[0m input_tokens, input_positions, input_metadata \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_prepare_inputs(\n\u001b[1;32m 290\u001b[0m seq_group_metadata_list)\n\u001b[1;32m 292\u001b[0m \u001b[39m# Execute the model.\u001b[39;00m\n\u001b[0;32m--> 293\u001b[0m output \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mmodel(\n\u001b[1;32m 294\u001b[0m input_ids\u001b[39m=\u001b[39;49minput_tokens,\n\u001b[1;32m 295\u001b[0m positions\u001b[39m=\u001b[39;49minput_positions,\n\u001b[1;32m 296\u001b[0m kv_caches\u001b[39m=\u001b[39;49m\u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mgpu_cache,\n\u001b[1;32m 297\u001b[0m input_metadata\u001b[39m=\u001b[39;49minput_metadata,\n\u001b[1;32m 298\u001b[0m cache_events\u001b[39m=\u001b[39;49mcache_events,\n\u001b[1;32m 299\u001b[0m )\n\u001b[1;32m 300\u001b[0m \u001b[39mreturn\u001b[39;00m output\n",
"File \u001b[0;32m/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py:1501\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1496\u001b[0m \u001b[39m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1497\u001b[0m \u001b[39m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1498\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mnot\u001b[39;00m (\u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_backward_hooks \u001b[39mor\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_backward_pre_hooks \u001b[39mor\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_forward_hooks \u001b[39mor\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1499\u001b[0m \u001b[39mor\u001b[39;00m _global_backward_pre_hooks \u001b[39mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1500\u001b[0m \u001b[39mor\u001b[39;00m _global_forward_hooks \u001b[39mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1501\u001b[0m \u001b[39mreturn\u001b[39;00m forward_call(\u001b[39m*\u001b[39;49margs, \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mkwargs)\n\u001b[1;32m 1502\u001b[0m \u001b[39m# Do not call functions when jit is used\u001b[39;00m\n\u001b[1;32m 1503\u001b[0m full_backward_hooks, non_full_backward_hooks \u001b[39m=\u001b[39m [], []\n",
"File \u001b[0;32m/usr/local/lib/python3.10/dist-packages/vllm/model_executor/models/llama.py:255\u001b[0m, in \u001b[0;36mLlamaForCausalLM.forward\u001b[0;34m(self, input_ids, positions, kv_caches, input_metadata, cache_events)\u001b[0m\n\u001b[1;32m 245\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mforward\u001b[39m(\n\u001b[1;32m 246\u001b[0m \u001b[39mself\u001b[39m,\n\u001b[1;32m 247\u001b[0m input_ids: torch\u001b[39m.\u001b[39mTensor,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 251\u001b[0m cache_events: Optional[List[torch\u001b[39m.\u001b[39mcuda\u001b[39m.\u001b[39mEvent]],\n\u001b[1;32m 252\u001b[0m ) \u001b[39m-\u001b[39m\u001b[39m>\u001b[39m Dict[\u001b[39mint\u001b[39m, SequenceOutputs]:\n\u001b[1;32m 253\u001b[0m hidden_states \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mmodel(input_ids, positions, kv_caches,\n\u001b[1;32m 254\u001b[0m input_metadata, cache_events)\n\u001b[0;32m--> 255\u001b[0m next_tokens \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49msampler(\u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mlm_head\u001b[39m.\u001b[39;49mweight, hidden_states,\n\u001b[1;32m 256\u001b[0m input_metadata)\n\u001b[1;32m 257\u001b[0m \u001b[39mreturn\u001b[39;00m next_tokens\n",
"File \u001b[0;32m/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py:1501\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1496\u001b[0m \u001b[39m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1497\u001b[0m \u001b[39m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1498\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mnot\u001b[39;00m (\u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_backward_hooks \u001b[39mor\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_backward_pre_hooks \u001b[39mor\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_forward_hooks \u001b[39mor\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1499\u001b[0m \u001b[39mor\u001b[39;00m _global_backward_pre_hooks \u001b[39mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1500\u001b[0m \u001b[39mor\u001b[39;00m _global_forward_hooks \u001b[39mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1501\u001b[0m \u001b[39mreturn\u001b[39;00m forward_call(\u001b[39m*\u001b[39;49margs, \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mkwargs)\n\u001b[1;32m 1502\u001b[0m \u001b[39m# Do not call functions when jit is used\u001b[39;00m\n\u001b[1;32m 1503\u001b[0m full_backward_hooks, non_full_backward_hooks \u001b[39m=\u001b[39m [], []\n",
"File \u001b[0;32m/usr/local/lib/python3.10/dist-packages/vllm/model_executor/layers/sampler.py:44\u001b[0m, in \u001b[0;36mSampler.forward\u001b[0;34m(self, embedding, hidden_states, input_metadata, embedding_bias)\u001b[0m\n\u001b[1;32m 36\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mforward\u001b[39m(\n\u001b[1;32m 37\u001b[0m \u001b[39mself\u001b[39m,\n\u001b[1;32m 38\u001b[0m embedding: torch\u001b[39m.\u001b[39mTensor,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 42\u001b[0m ) \u001b[39m-\u001b[39m\u001b[39m>\u001b[39m Dict[\u001b[39mint\u001b[39m, SequenceOutputs]:\n\u001b[1;32m 43\u001b[0m \u001b[39m# Get the hidden states that we use for sampling.\u001b[39;00m\n\u001b[0;32m---> 44\u001b[0m hidden_states \u001b[39m=\u001b[39m _prune_hidden_states(hidden_states, input_metadata)\n\u001b[1;32m 46\u001b[0m \u001b[39m# Get the logits for the next tokens.\u001b[39;00m\n\u001b[1;32m 47\u001b[0m logits \u001b[39m=\u001b[39m torch\u001b[39m.\u001b[39mmatmul(hidden_states, embedding\u001b[39m.\u001b[39mt())\n",
"\u001b[0;31mKeyboardInterrupt\u001b[0m: "
]
}
],
"source": [
"# We'll process our recipes in batches of 10,000.\n",
"\n",
"import time\n",
"\n",
"BATCH_SIZE = 10000\n",
"all_outputs = []\n",
"\n",
"start_time = time.time()\n",
"print(f\"Start time: {start_time}\")\n",
"for i in range(0, len(all_recipes), BATCH_SIZE):\n",
" print(f\"Processing recipes {i:,} to {i+BATCH_SIZE:,}...\")\n",
" outputs = llm.generate(\n",
" all_recipes[i : i + BATCH_SIZE], sampling_params=sampling_params\n",
" )\n",
"\n",
" all_outputs.extend([o.outputs[0].text for o in outputs])\n",
"\n",
"end_time = time.time()\n",
"print(f\"End time: {end_time}\")\n",
"print(f\"Total hours: {((end_time - start_time) / 3600):.2f}\")\n",
"\n",
"# Ended up running this in a separate script to leave it running in the background.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Nice! I've processed all 2,147,248 recipes in under 17 hours. Let's do a cost comparison with GPT-3.5 and GPT-4. I'll use the GPT-4 latency/cost numbers based on the 5000 samples used to generate our model's training data.\n"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Model</th>\n",
" <th>Cost to Classify One Recipe</th>\n",
" <th>Cost to Classify Entire Dataset</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Llama2 7B (FT)</td>\n",
" <td>0.000009</td>\n",
" <td>18.81</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>GPT-3.5</td>\n",
" <td>0.000481</td>\n",
" <td>1033.26</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>GPT-3.5 (FT)</td>\n",
" <td>0.004044</td>\n",
" <td>8683.47</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>GPT-4</td>\n",
" <td>0.010800</td>\n",
" <td>23190.28</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Model Cost to Classify One Recipe \\\n",
"0 Llama2 7B (FT) 0.000009 \n",
"1 GPT-3.5 0.000481 \n",
"2 GPT-3.5 (FT) 0.004044 \n",
"3 GPT-4 0.010800 \n",
"\n",
" Cost to Classify Entire Dataset \n",
"0 18.81 \n",
"1 1033.26 \n",
"2 8683.47 \n",
"3 23190.28 "
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"\n",
"# I used an on-demand Nvidia L40 on RunPod for this, at an hourly cost of $1.14.\n",
"finetuned_hourly_cost = 1.14\n",
"\n",
"finetuned_total_hours = 16.5\n",
"\n",
"finetuned_avg_cost = finetuned_hourly_cost * finetuned_total_hours / len(all_recipes)\n",
"\n",
"# The average input and output tokens for OpenAI, based on the 5000 recipes I\n",
"# sent them when generating training data.\n",
"avg_input_tokens = 276\n",
"avg_output_tokens = 42\n",
"\n",
"# Token pricing from https://openai.com/pricing\n",
"gpt_4_avg_cost = avg_input_tokens * 0.03 / 1000 + avg_output_tokens * 0.06 / 1000\n",
"\n",
"gpt_35_avg_cost = avg_input_tokens * 0.0015 / 1000 + avg_output_tokens * 0.0016 / 1000\n",
"\n",
"gpt_35_finetuned_avg_cost = (\n",
" avg_input_tokens * 0.012 / 1000 + avg_output_tokens * 0.016 / 1000 + 0.06 / 1000\n",
")\n",
"\n",
"models = pd.DataFrame(\n",
" {\n",
" \"Model\": [\n",
" \"Llama2 7B (FT)\",\n",
" \"GPT-3.5\",\n",
" \"GPT-3.5 (FT)\",\n",
" \"GPT-4\",\n",
" ],\n",
" \"Cost to Classify One Recipe\": [\n",
" finetuned_avg_cost,\n",
" gpt_35_avg_cost,\n",
" gpt_35_finetuned_avg_cost,\n",
" gpt_4_avg_cost,\n",
" ],\n",
" }\n",
")\n",
"\n",
"models[\"Cost to Classify Entire Dataset\"] = (\n",
" models[\"Cost to Classify One Recipe\"] * len(all_recipes)\n",
").round(2)\n",
"\n",
"models\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

View File

@@ -0,0 +1,10 @@
# OpenPipe demo: fine-tuning your own model
Hi there! This repository should give you a brief overview of how to fine-tune a competitive model from start to finish. You should review the notebooks in this directory in the following order:
1. [./generate-data.ipynb](./generate-data.ipynb): Demonstrates how to generate a sample dataset of GPT-4 completions, store it using OpenPipe, and then export it in a format suitable for training a model.
2. [./train.ipynb](./train.ipynb): Trains a Llama 2 7B model on the dataset from step (1).
3. [./evaluate.ipynb](./evaluate.ipynb): Evaluates the model we trained using a special test set that we set aside in step (1).
4. [./benchmark.ipynb](./benchmark.ipynb): A script to compare costs and completion latencies between our fine-tuned model, GPT-3.5, and GPT-4.
If you want to follow along yourself, I recommend using [RunPod](https://www.runpod.io/). The training scripts we use will run on any of their GPUs with 24GB of vRAM or more.

View File

View File

@@ -0,0 +1,207 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Sample training data:\n",
"{'messages': [{'content': 'Your goal is to classify a recipe along several '\n",
" 'dimensions.Pay attention to the instructions.',\n",
" 'role': 'system'},\n",
" {'content': 'Homemade Salad Dressing\\n'\n",
" '\\n'\n",
" 'Ingredients:\\n'\n",
" \"- 1 pt. Hellmann's mayonnaise\\n\"\n",
" '- 1 pt. buttermilk\\n'\n",
" '- 1 tsp. Accent\\n'\n",
" '- 2 Tbsp. dry parsley\\n'\n",
" '- 2 pkg. low-calorie Italian salad dressing mix\\n'\n",
" '- 1 can jalapeno peppers or 4 oz. Jimenez green '\n",
" 'sauce\\n'\n",
" '\\n'\n",
" 'Directions:\\n'\n",
" '- Blend well in blender; store in refrigerator.\\n'\n",
" '- For dip, decrease liquid.',\n",
" 'role': 'user'},\n",
" {'content': '{\\n'\n",
" '\"has_non_fish_meat\": false,\\n'\n",
" '\"requires_oven\": false,\\n'\n",
" '\"requires_stove\": false,\\n'\n",
" '\"cook_time_over_30_mins\": false,\\n'\n",
" '\"main_dish\": false\\n'\n",
" '}',\n",
" 'role': 'assistant'}]}\n"
]
}
],
"source": [
"import pandas as pd\n",
"from pprint import pprint\n",
"import json\n",
"\n",
"df = pd.read_json(\"data/train.jsonl\", lines=True)\n",
"\n",
"training_data = []\n",
"for row in df.itertuples():\n",
" input = json.loads(row.instruction)\n",
" output = json.loads(row.output)\n",
"\n",
" output[\"content\"] = output[\"function_call\"][\"arguments\"]\n",
" del output[\"function_call\"]\n",
"\n",
" sample = {\"messages\": input.copy() + [output]}\n",
" training_data.append(sample)\n",
"\n",
"# save the training data to data/train-gpt3.5.jsonl\n",
"\n",
"with open(\"data/train-gpt3.5.jsonl\", \"w\") as f:\n",
" for sample in training_data:\n",
" f.write(json.dumps(sample) + \"\\n\")\n",
"\n",
"print(f\"Sample training data:\")\n",
"pprint(training_data[0])\n"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<File file id=file-faAdQ1KPxZH79ThW4Dbu4z1y at 0x7fa55db5c6d0> JSON: {\n",
" \"object\": \"file\",\n",
" \"id\": \"file-faAdQ1KPxZH79ThW4Dbu4z1y\",\n",
" \"purpose\": \"fine-tune\",\n",
" \"filename\": \"recipe-classification\",\n",
" \"bytes\": 4210831,\n",
" \"created_at\": 1693000959,\n",
" \"status\": \"uploaded\",\n",
" \"status_details\": null\n",
"}"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import os\n",
"import openai\n",
"\n",
"import dotenv\n",
"\n",
"dotenv.load_dotenv()\n",
"\n",
"openai.api_key = os.getenv(\"OPENAI_API_KEY\")\n",
"\n",
"openai.File.create(\n",
" file=open(\"data/train-gpt3.5.jsonl\", \"rb\"),\n",
" purpose=\"fine-tune\",\n",
" user_provided_filename=\"recipe-classification\",\n",
")\n"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<OpenAIObject list at 0x7fa55dbf6930> JSON: {\n",
" \"object\": \"list\",\n",
" \"data\": [\n",
" {\n",
" \"object\": \"file\",\n",
" \"id\": \"file-faAdQ1KPxZH79ThW4Dbu4z1y\",\n",
" \"purpose\": \"fine-tune\",\n",
" \"filename\": \"recipe-classification\",\n",
" \"bytes\": 4210831,\n",
" \"created_at\": 1693000959,\n",
" \"status\": \"processed\",\n",
" \"status_details\": null\n",
" }\n",
" ]\n",
"}"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"openai.File.list()\n"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<FineTuningJob fine_tuning.job id=ftjob-EjjLxmj9P8apwPRk5s2NPSeB at 0x7fa55ddc4360> JSON: {\n",
" \"object\": \"fine_tuning.job\",\n",
" \"id\": \"ftjob-EjjLxmj9P8apwPRk5s2NPSeB\",\n",
" \"model\": \"gpt-3.5-turbo-0613\",\n",
" \"created_at\": 1693001190,\n",
" \"finished_at\": null,\n",
" \"fine_tuned_model\": null,\n",
" \"organization_id\": \"org-jRz4nVPMoeGHWL5nVR3Mb0kp\",\n",
" \"result_files\": [],\n",
" \"status\": \"created\",\n",
" \"validation_file\": null,\n",
" \"training_file\": \"file-faAdQ1KPxZH79ThW4Dbu4z1y\",\n",
" \"hyperparameters\": {\n",
" \"n_epochs\": 3\n",
" },\n",
" \"trained_tokens\": null\n",
"}"
]
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"openai.FineTuningJob.create(\n",
" training_file=\"file-faAdQ1KPxZH79ThW4Dbu4z1y\", model=\"gpt-3.5-turbo\"\n",
")\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}

View File

@@ -0,0 +1,73 @@
# This file is used by the training script in train.ipynb. You can read more about
# the format and see more examples at https://github.com/OpenAccess-AI-Collective/axolotl.
# One of the parameters you might want to play around with is `num_epochs`: if you have a
# smaller dataset size, making that large can have good results.
base_model: meta-llama/Llama-2-7b-hf
base_model_config: meta-llama/Llama-2-7b-hf
model_type: LlamaForCausalLM
tokenizer_type: LlamaTokenizer
is_llama_derived_model: true
load_in_8bit: true
load_in_4bit: false
strict: false
datasets:
- path: ./data/train.jsonl
type: alpaca_instruct.load_no_prompt
dataset_prepared_path: ./data/last_run_prepared
val_set_size: 0.05
output_dir: ./models/run1
sequence_len: 4096
sample_packing: true
adapter: lora
lora_model_dir:
lora_r: 32
lora_alpha: 16
lora_dropout: 0.05
lora_target_linear: true
lora_fan_in_fan_out:
# This will report stats from your training run to https://wandb.ai/. If you don't want to create a wandb account you can comment this section out.
wandb_project: classify-recipes
wandb_entity:
wandb_watch:
wandb_run_id: run1
wandb_log_model:
gradient_accumulation_steps: 4
micro_batch_size: 2
num_epochs: 5
optimizer: adamw_bnb_8bit
lr_scheduler: cosine
learning_rate: 0.0002
train_on_inputs: false
group_by_length: false
bf16: true
fp16: false
tf32: false
gradient_checkpointing: true
early_stopping_patience:
resume_from_checkpoint:
local_rank:
logging_steps: 1
xformers_attention:
flash_attention: true
warmup_steps: 10
eval_steps: 20
save_steps: 60
debug:
deepspeed:
weight_decay: 0.0
fsdp:
fsdp_config:
special_tokens:
bos_token: "<s>"
eos_token: "</s>"
unk_token: "<unk>"

View File

@@ -0,0 +1,37 @@
import yaml
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
from peft import PeftModel
import os
def merge_lora_model(config_file: str):
config = yaml.load(open(config_file, "r"), Loader=yaml.FullLoader)
base_model = config["base_model"]
lora_model = config["output_dir"]
merged_model = f"{lora_model}/merged"
if os.path.exists(merged_model):
print(f"Model {merged_model} already exists, skipping")
return merged_model
print("Loading base model")
model = AutoModelForCausalLM.from_pretrained(
base_model,
return_dict=True,
torch_dtype=torch.float16,
)
print("Loading PEFT model")
model = PeftModel.from_pretrained(model, lora_model)
print(f"Running merge_and_unload")
model = model.merge_and_unload()
tokenizer = AutoTokenizer.from_pretrained(base_model)
model.save_pretrained(merged_model)
tokenizer.save_pretrained(merged_model)
print(f"Model saved to {merged_model}")
return merged_model