diff --git "a/notebooks/sentence-similarity-datasets-creation/02_synthetic_data_creation.ipynb" "b/notebooks/sentence-similarity-datasets-creation/02_synthetic_data_creation.ipynb"
new file mode 100644--- /dev/null
+++ "b/notebooks/sentence-similarity-datasets-creation/02_synthetic_data_creation.ipynb"
@@ -0,0 +1,2050 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "id": "a51a3962-7801-4906-aeff-74fdfb805b3e",
+ "metadata": {
+ "tags": []
+ },
+ "source": [
+ "
\n",
+ " Tip: To run the default model for this notebook, it's suggested to run on 4xL4 GPUs. You can also opt for a smaller GPU, but you must swap out the used model. If you want to run on a smaller GPU it's suggested to use the `meta-llama/Meta-Llama-3-8B-Instruct` model.\n",
+ "
"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "d47bb232",
+ "metadata": {},
+ "source": [
+ "# Creating a synthetic dataset for fine-tuning a Sentence Transformer model \n",
+ "\n",
+ "In the previous notebook, we prepared a dataset that we'll use to generate our synthetic dataset. We'll now focus on generating a dataset that we can use to train or fine-tune a sentence similarity model using the Sentence Transformers library. \n",
+ "\n",
+ "As a reminder, the type of dataset format we're working towards creating has three columns: \"anchor\", \"positive\", and \"negative\". In our case, \"anchor\" is the text from the domain we want our Sentence Transformers model to work well with. The \"positive\" text is a text which should be similar in some way to the \"anchor\" text, whilst the \"negative\" should be in some way dissimilar to our original text.\n",
+ "\n",
+ "As a very simple example, if our \"anchor\" text is \"Bill 179 introduces restrictions on the use of pesticides in Canada\", a \"positive\" example might be \"a law that regulating the use of pesticides\", and a \"negative\" example might be \"a bill related to education funding\". Whilst it is possible to train a Sentence Transformer model using only positive examples, the inclusion of negative examples can help the model to learn more about the space of possible sentences and improve its performance. The [Sentence Transformers documentation](https://www.sbert.net/docs/sentence_transformer/training_overview.html) goes into more detail about this.\n",
+ "\n",
+ "## Creating positive and negative pairs using an LLM\n",
+ "\n",
+ "One of the remarkable aspects of working with large language models, especially instruction-tuned models, is the significant control and flexibility they offer in text generation. This unique capability empowers us to create a synthetic dataset for training a sentence similarity model. We can leverage our input anchor text alongside a prompt to generate the positive and negative examples for similarity, giving us full control over the dataset's composition.\n",
+ "\n",
+ "### What do we mean by similarity? \n",
+ "\n",
+ "How will the model be used in practice? Since we are fine-tuning a model and have a lot of control over the dataset, we should consider what we want similarity to look like. \n",
+ "\n",
+ "In an RAG use case, we might default to creating a prompt that's something like \"based on this text, write a user query that would be satisfied by this text\" Whilst that could make sense, for many RAG applications, the embeddings are used to give extra context to an LLM based on a user prompt. This user prompt might take the form of a query, but it's more likely to be a question rather than the query we make to a database. Depending on the use case, we might want to generate prompts that are more like the type of questions we expect the model to use."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "6eedd4ef",
+ "metadata": {},
+ "source": [
+ "Let's start with our imports"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "id": "fd71339b-7d22-4c9c-958e-f7b2f2ed2991",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [],
+ "source": [
+ "import json\n",
+ "import random\n",
+ "\n",
+ "from datasets import concatenate_datasets, load_dataset\n",
+ "from huggingface_hub import DatasetCard, login\n",
+ "from outlines import generate, models\n",
+ "from pydantic import BaseModel, conlist, constr\n",
+ "from tqdm.auto import tqdm\n",
+ "from vllm import LLM, SamplingParams"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "f47e5f95",
+ "metadata": {},
+ "source": [
+ "You can do this below if you haven't authenticated with the Hugging Face Hub yet."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "id": "5031cf30-3cfa-4bd9-ba9f-65bc52154f3f",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "a5df2a83236b4aa094ed05b50c0f5cec",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "VBox(children=(HTML(value='
\n",
+ " Tip: If you are running on a single GPU update the `tensor_parallel_size` below to 1. \n",
+ ""
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "id": "02107e5b-22e2-4bd3-85ba-aad6246ba9d9",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "/home/user/miniconda/lib/python3.9/site-packages/huggingface_hub/file_download.py:1132: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.\n",
+ " warnings.warn(\n",
+ "2024-06-19 14:03:15,692\tINFO worker.py:1753 -- Started a local Ray instance.\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "INFO 06-19 14:03:16 config.py:623] Defaulting to use mp for distributed inference\n",
+ "INFO 06-19 14:03:16 config.py:707] Chunked prefill is enabled (EXPERIMENTAL).\n",
+ "INFO 06-19 14:03:16 llm_engine.py:161] Initializing an LLM engine (v0.5.0) with config: model='01-ai/Yi-1.5-34B-Chat', speculative_config=None, tokenizer='01-ai/Yi-1.5-34B-Chat', skip_tokenizer_init=False, tokenizer_mode=auto, revision=None, rope_scaling=None, rope_theta=None, tokenizer_revision=None, trust_remote_code=False, dtype=torch.bfloat16, max_seq_len=4096, download_dir=None, load_format=LoadFormat.AUTO, tensor_parallel_size=4, disable_custom_all_reduce=False, quantization=None, enforce_eager=False, kv_cache_dtype=auto, quantization_param_path=None, device_config=cuda, decoding_config=DecodingConfig(guided_decoding_backend='outlines'), seed=0, served_model_name=01-ai/Yi-1.5-34B-Chat)\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44273)\u001b[0;0m INFO 06-19 14:03:19 multiproc_worker_utils.py:215] Worker ready; awaiting tasks\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44272)\u001b[0;0m INFO 06-19 14:03:19 multiproc_worker_utils.py:215] Worker ready; awaiting tasks\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44274)\u001b[0;0m INFO 06-19 14:03:19 multiproc_worker_utils.py:215] Worker ready; awaiting tasks\n",
+ "INFO 06-19 14:03:20 utils.py:623] Found nccl from library libnccl.so.2\n",
+ "INFO 06-19 14:03:20 pynccl.py:65] vLLM is using nccl==2.20.5\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44273)\u001b[0;0m INFO 06-19 14:03:20 utils.py:623] Found nccl from library libnccl.so.2\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44272)\u001b[0;0m INFO 06-19 14:03:20 utils.py:623] Found nccl from library libnccl.so.2\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44274)\u001b[0;0m INFO 06-19 14:03:20 utils.py:623] Found nccl from library libnccl.so.2\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44273)\u001b[0;0m INFO 06-19 14:03:20 pynccl.py:65] vLLM is using nccl==2.20.5\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44272)\u001b[0;0m INFO 06-19 14:03:20 pynccl.py:65] vLLM is using nccl==2.20.5\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44274)\u001b[0;0m INFO 06-19 14:03:20 pynccl.py:65] vLLM is using nccl==2.20.5\n",
+ "WARNING 06-19 14:03:20 custom_all_reduce.py:170] Custom allreduce is disabled because it's not supported on more than two PCIe-only GPUs. To silence this warning, specify disable_custom_all_reduce=True explicitly.\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44273)\u001b[0;0m WARNING 06-19 14:03:20 custom_all_reduce.py:170] Custom allreduce is disabled because it's not supported on more than two PCIe-only GPUs. To silence this warning, specify disable_custom_all_reduce=True explicitly.\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44272)\u001b[0;0m \u001b[1;36m(VllmWorkerProcess pid=44274)\u001b[0;0m WARNING 06-19 14:03:20 custom_all_reduce.py:170] Custom allreduce is disabled because it's not supported on more than two PCIe-only GPUs. To silence this warning, specify disable_custom_all_reduce=True explicitly.\n",
+ "WARNING 06-19 14:03:20 custom_all_reduce.py:170] Custom allreduce is disabled because it's not supported on more than two PCIe-only GPUs. To silence this warning, specify disable_custom_all_reduce=True explicitly.\n"
+ ]
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "Traceback (most recent call last):\n",
+ " File \"/home/user/miniconda/lib/python3.9/multiprocessing/resource_tracker.py\", line 201, in main\n",
+ " cache[rtype].remove(name)\n",
+ "KeyError: '/psm_e0bb0061'\n",
+ "Traceback (most recent call last):\n",
+ " File \"/home/user/miniconda/lib/python3.9/multiprocessing/resource_tracker.py\", line 201, in main\n",
+ " cache[rtype].remove(name)\n",
+ "KeyError: '/psm_e0bb0061'\n",
+ "Traceback (most recent call last):\n",
+ " File \"/home/user/miniconda/lib/python3.9/multiprocessing/resource_tracker.py\", line 201, in main\n",
+ " cache[rtype].remove(name)\n",
+ "KeyError: '/psm_e0bb0061'\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[1;36m(VllmWorkerProcess pid=44274)\u001b[0;0m INFO 06-19 14:03:20 weight_utils.py:218] Using model weights format ['*.safetensors']\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44273)\u001b[0;0m INFO 06-19 14:03:20 weight_utils.py:218] Using model weights format ['*.safetensors']\n",
+ "INFO 06-19 14:03:20 weight_utils.py:218] Using model weights format ['*.safetensors']\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44272)\u001b[0;0m INFO 06-19 14:03:20 weight_utils.py:218] Using model weights format ['*.safetensors']\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44273)\u001b[0;0m INFO 06-19 14:03:32 model_runner.py:159] Loading model weights took 16.0451 GB\n",
+ "INFO 06-19 14:03:32 model_runner.py:159] Loading model weights took 16.0451 GB\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44272)\u001b[0;0m INFO 06-19 14:03:32 model_runner.py:159] Loading model weights took 16.0451 GB\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44274)\u001b[0;0m INFO 06-19 14:03:32 model_runner.py:159] Loading model weights took 16.0451 GB\n",
+ "INFO 06-19 14:03:33 distributed_gpu_executor.py:56] # GPU blocks: 3187, # CPU blocks: 4369\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44272)\u001b[0;0m INFO 06-19 14:03:42 model_runner.py:878] Capturing the model for CUDA graphs. This may lead to unexpected consequences if the model is not static. To run the model in eager mode, set 'enforce_eager=True' or use '--enforce-eager' in the CLI.\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44272)\u001b[0;0m INFO 06-19 14:03:42 model_runner.py:882] CUDA graphs can take additional 1~3 GiB memory per GPU. If you are running out of memory, consider decreasing `gpu_memory_utilization` or enforcing eager mode. You can also reduce the `max_num_seqs` as needed to decrease memory usage.\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44273)\u001b[0;0m INFO 06-19 14:03:42 model_runner.py:878] Capturing the model for CUDA graphs. This may lead to unexpected consequences if the model is not static. To run the model in eager mode, set 'enforce_eager=True' or use '--enforce-eager' in the CLI.\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44273)\u001b[0;0m INFO 06-19 14:03:42 model_runner.py:882] CUDA graphs can take additional 1~3 GiB memory per GPU. If you are running out of memory, consider decreasing `gpu_memory_utilization` or enforcing eager mode. You can also reduce the `max_num_seqs` as needed to decrease memory usage.\n",
+ "INFO 06-19 14:03:42 model_runner.py:878] Capturing the model for CUDA graphs. This may lead to unexpected consequences if the model is not static. To run the model in eager mode, set 'enforce_eager=True' or use '--enforce-eager' in the CLI.\n",
+ "INFO 06-19 14:03:42 model_runner.py:882] CUDA graphs can take additional 1~3 GiB memory per GPU. If you are running out of memory, consider decreasing `gpu_memory_utilization` or enforcing eager mode. You can also reduce the `max_num_seqs` as needed to decrease memory usage.\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44274)\u001b[0;0m INFO 06-19 14:03:42 model_runner.py:878] Capturing the model for CUDA graphs. This may lead to unexpected consequences if the model is not static. To run the model in eager mode, set 'enforce_eager=True' or use '--enforce-eager' in the CLI.\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44274)\u001b[0;0m INFO 06-19 14:03:42 model_runner.py:882] CUDA graphs can take additional 1~3 GiB memory per GPU. If you are running out of memory, consider decreasing `gpu_memory_utilization` or enforcing eager mode. You can also reduce the `max_num_seqs` as needed to decrease memory usage.\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44274)\u001b[0;0m INFO 06-19 14:04:02 model_runner.py:954] Graph capturing finished in 21 secs.\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44272)\u001b[0;0m INFO 06-19 14:04:02 model_runner.py:954] Graph capturing finished in 21 secs.\n",
+ "\u001b[1;36m(VllmWorkerProcess pid=44273)\u001b[0;0m INFO 06-19 14:04:02 model_runner.py:954] Graph capturing finished in 21 secs.\n",
+ "INFO 06-19 14:04:03 model_runner.py:954] Graph capturing finished in 21 secs.\n"
+ ]
+ }
+ ],
+ "source": [
+ "llm = LLM(\n",
+ " \"01-ai/Yi-1.5-34B-Chat\",\n",
+ " tensor_parallel_size=4,\n",
+ " tokenizer=\"01-ai/Yi-1.5-34B-Chat\",\n",
+ " gpu_memory_utilization=0.9,\n",
+ " enable_chunked_prefill=True,\n",
+ ")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "a479e701",
+ "metadata": {},
+ "source": [
+ "Below are some configs for other models you might want to experiment with. \n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "id": "ef4266cf-f970-4c7a-b9db-503b9f584922",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# llm = LLM(\n",
+ "# \"meta-llama/Meta-Llama-3-8B-Instruct\",\n",
+ "# tensor_parallel_size=4,\n",
+ "# tokenizer=\"meta-llama/Meta-Llama-3-8B-Instruct\",\n",
+ "# gpu_memory_utilization=0.9,\n",
+ "# enable_chunked_prefill=True,\n",
+ "# )"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "id": "c8e9995a-dfbd-4493-8906-3556be75f145",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [],
+ "source": [
+ "# llm = LLM(\n",
+ "# \"Qwen/Qwen2-72B-Instruct-AWQ\",\n",
+ "# quantization=\"AWQ\",\n",
+ "# tensor_parallel_size=4,\n",
+ "# tokenizer=\"Qwen/Qwen2-72B-Instruct-AWQ\",\n",
+ "# gpu_memory_utilization=0.8,\n",
+ "# enable_chunked_prefill=True,\n",
+ "# )"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "27c0774b-44d6-4828-8514-65fe8d52f906",
+ "metadata": {
+ "tags": []
+ },
+ "source": [
+ "### Constrained Generation using Outlines\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "f92b36eb-71ce-4301-a0d0-c7a47dce9cde",
+ "metadata": {},
+ "source": [
+ "Now we have created an LLM and loaded our dataset, we can move to the next step of creating our dataset. As a reminder we are looking to create a dataset with three columns: \"anchor\", \"positive\", and \"negative\" using the anchor text from our dataset as a starting point.\n",
+ "\n",
+ "We can do something like this as a prompt:\n",
+ "\n",
+ "\"Given the following text, write a sentence that is similar to the text. Write a sentence that is dissimilar to the text.\"\n",
+ "\n",
+ "This prompt (might!) generate a sentence that is similar to the anchor text and a sentence that is dissimilar to the anchor text. However, we may want some way to have more certainty that the LLM produces the text we want (at least in terms of format). For example if we want to generate valid JSON the first token generated should be `{`. \n",
+ "\n",
+ "Since we want to have two types of output \"good\" and \"bad\" aka positive and negative examples, we may to produce data that looks something like:\n",
+ "\n",
+ "{\"good\": \"a sentence that is similar to the text\", \"bad\": \"a sentence that is dissimilar to the text\"}\n",
+ "\n",
+ "\n",
+ "A strong LLM with a good prompt will probably already do this but we can also use a technique called guided generation to enforce this more strongly. This has a few advantages:\n",
+ "\n",
+ "- the outputs are what we expect i.e. valid JSON, this makes processing them in later steps easier\n",
+ "- we can have some additional control over other parts of the generation process\n",
+ "\n",
+ "For doing guided generation we'll use a library called [Outlines](https://github.com/outlines-dev/outlines). Outlines is a library that allows you to create constraints on the generation process.\n",
+ "\n",
+ "> Outlines〰 is a Python library that allows you to use Large Language Model in a simple and robust way (with structured generation).\n",
+ "\n",
+ "One of the advantages of Outlines over some other libraries is that it does structured generation by directly altering the behavior of the models generation process rather than using prompting and lots of retries. The Outlines library has an integration with `vLLM` which we used to load our model."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "bed24b92-287a-4b2d-8807-2c8e031aba4c",
+ "metadata": {},
+ "source": [
+ "We can start by passing the llm we just created into the Outlines `models.VLLM` class"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "id": "4be1bb3b-e665-4d40-aa24-bf8d8acf67f4",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [],
+ "source": [
+ "model = models.VLLM(llm)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "3f2fff3d",
+ "metadata": {},
+ "source": [
+ "### Defining the constraints\n",
+ "\n",
+ "We can now define the constraints we want to use. We can do this in various ways using the Outlines library but one nice way is to use a Pydantic Class to represent the output we want. If you are not familiar with Pydantic it is a\n",
+ "\n",
+ "> fast and extensible library for validating and serializing data using Python type hints.\n",
+ "\n",
+ "In our case we want to have two fields \"good\" and \"bad\" which are strings. We could define this as a Pydantic class like this:\n",
+ "\n",
+ "\n",
+ "```python\n",
+ "\n",
+ "from pydantic import BaseModel\n",
+ "\n",
+ "class Example(BaseModel):\n",
+ " good: str\n",
+ " bad: str\n",
+ "\n",
+ "```\n",
+ "\n",
+ "This will ensure we get a JSON object with two fields \"good\" and \"bad\" which are strings. However, when creating data for a sentence embedding task it can be useful to have multiple generations for each anchor text. In particular for the `bad` examples we may want the LLM to produce multiple bad examples and then choose the \"hard\" negative example i.e. the one that is most similar to the anchor text. This can help the model learn more quickly and deal with more complex examples.\n",
+ "\n",
+ "We can define this as a Pydantic class like this:\n",
+ "\n",
+ "```python\n",
+ "\n",
+ "from pydantic import BaseModel\n",
+ "from typing import List\n",
+ "\n",
+ "class Example(BaseModel):\n",
+ " good: str\n",
+ " bad: List[str]\n",
+ "\n",
+ "```\n",
+ "\n",
+ "You can see that we now have a list of strings for the \"bad\" field. This will allow us to generate multiple negative examples for each anchor text.\n",
+ "\n",
+ "In addition to controlling the structure of the JSON we can also define some additional constrains. For this example we'll create a Pydantic Class that has:\n",
+ "\n",
+ "- a good field which is a list of 1 string\n",
+ "- a bad field which is a list of 3 strings\n",
+ "- we also specify a constraint on the minimum and maximum length of the strings\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "id": "3b96eb01-d186-442d-a15d-bbe170438dc2",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [],
+ "source": [
+ "class AbstractDescriptions(BaseModel):\n",
+ " good: conlist(constr(min_length=20, max_length=200), min_length=1, max_length=1) # type: ignore\n",
+ " bad: conlist(constr(min_length=20, max_length=200), min_length=3, max_length=3) # type: ignore\n",
+ "\n",
+ "\n",
+ "schema = AbstractDescriptions.model_json_schema()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "da0c6430",
+ "metadata": {},
+ "source": [
+ "Although it can be tempting to make a Pydantic Class that has a lot of constraints, it's often better to start with a simple class and then add more constraints as needed. Whilst Outlines will help guide the model to the output you want if it's very hard for an LLM to generate the output you want you may get suboptimal results."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "720f6891-8650-4021-b992-dc98e0307075",
+ "metadata": {},
+ "source": [
+ "## Creating our prompt\n",
+ "\n",
+ "Now we turn to writing a prompt that will generate the data we want. In this case we write a prompt that is focused on the specific data we are working with (US legislation). We give the LLM a few shot example to help it understand the type of response we want as well as the format. \n",
+ "\n",
+ "In addition we pass in the constraints we defined above as a JSON Schema. This is another reason you may want to limit the number of constrains you have as the JSON Schema will get larger and in turn the size of your prompts will grow a lot. "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "id": "7695058d-487b-4db0-97e2-3d5ef5767f45",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [],
+ "source": [
+ "def format_prompt(text: str) -> str:\n",
+ " return f\"\"\"Write one good and three bad abstract descriptions of the following text. Output the descriptions in a JSON file with keys ‘good’ and ‘bad’.\n",
+ "Example:\n",
+ "Text: Community Energy Savings Program Act of 2019\\n\\nThis bill directs the Department of Energy to establish a grant program for states and Indian tribes to provide loans to consumers and communities that want to implement cost-effective energy efficiency measures.\n",
+ "Good description: A legislative proposal to promote energy efficiency through financial incentives\n",
+ "Bad description: A federal reform relating to the process for submitting planning applications related to oil pipelines\n",
+ "\n",
+ "Note: Descriptions can vary in abstraction, detail, and focus. Both good and bad descriptions should be short (max 20 words)\n",
+ "\n",
+ "Text to describe: {text}\n",
+ "Return a JSON object with the keys 'good' and 'bad' using this schema: {schema}.\"\"\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "df05525c",
+ "metadata": {},
+ "source": [
+ "We not add a new column to our dataset called `prompt` which contains the prompt we want to use."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "id": "206fbcfd-3cea-4540-8dd0-7ab0fba08254",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "2d609b2a30d0402b8d162f4a4f2723f0",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "Map: 0%| | 0/1000 [00:00, ? examples/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "ds = ds.map(lambda x: {\"prompt\": format_prompt(x['section'])})"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "450376a7-ee63-4c00-84a8-f79b28376a2e",
+ "metadata": {},
+ "source": [
+ "We now create a `generator` object using Outlines. We pass our model and the `AbstractDescriptions` Pydantic model we created to Outlines `generate.json`. Outlines will then \"compile\" our Pydantic model into a [finite state machine](https://en.wikipedia.org/wiki/Finite-state_machine) (FSM) representation of our Schema. Outlines constrains the possible tokens that the LLM can generate at different steps during the generation."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "id": "ba34b313-8e89-4ac5-8739-2dd17d3989d1",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "Compiling FSM index for all state transitions: 100%|██████████| 4845/4845 [01:44<00:00, 46.55it/s]\n"
+ ]
+ }
+ ],
+ "source": [
+ "generator = generate.json(model, AbstractDescriptions)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "6bd7b877-dca2-47f8-97a2-c67fde2a34f7",
+ "metadata": {},
+ "source": [
+ "We now have a `generator` to which we can pass our prompts. Although we created this via Outlines, under the hood the generation is being done by `vLLM`. `vLLM` supports [offline batched inference](https://docs.vllm.ai/en/latest/getting_started/quickstart.html#offline-batched-inference). Many LLM serving engines are primarily optimized for deployment via an API where a variable number of requests will be sent to the model. In our case, we have a batch of prompts for which we want to generate responses. The vLLM `LLM` Class:\n",
+ "\n",
+ "> includes a tokenizer, a language model (possibly distributed across multiple GPUs), and GPU memory space allocated for intermediate states (aka KV cache). Given a batch of prompts and sampling parameters, this Class generates texts from the model using an intelligent batching mechanism and efficient memory management.\n",
+ "\n",
+ "While we could still work to optimize throughput further, this Class represents a good starting point for synthetic data generation. "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "54810b5c-b7e2-43b6-ad2c-0c4bd4adb29c",
+ "metadata": {},
+ "source": [
+ "### Generating our dataset\n",
+ "\n",
+ "We are now ready to generate our dataset. We'll use the `generator` object to generate our data. We'll run our dataset as batches to allow us to retry generating data that fails. \n",
+ "\n",
+ "In the below `process_batch` function, we roughly do the following:\n",
+ "- Split our dataset into an initial batch size\n",
+ "- Try and generate a response for the batch\n",
+ "- If we have errors for the batch, we split the batch that failed into a smaller subset and retryß\n",
+ "- We go through this process with a maximum number of retries and a minimum batch size\n",
+ "\n",
+ "There are ways we could further optimize this, but this works quite well for not skipping a whole batch whilst not wasting too much compute/time retrying tiny batches to generate a bit of extra data. \n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "3c63a0bc",
+ "metadata": {},
+ "source": [
+ "We can specify some generation parameters that will be passed to vLLM when generating the data. "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "3a3cfec0-96f4-4a35-acc4-6b932238599e",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [],
+ "source": [
+ "params = SamplingParams(n=1, max_tokens=800, best_of=2, temperature=0.7)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "299b08f1",
+ "metadata": {},
+ "source": [
+ "We can now generate our data. Feel free to adjust the `batch_size`, `max_retries`, and `min_batch_size` to suit your needs."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "id": "b277db6b-29f6-467c-8512-2675076b1309",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "9534747f9c0c4ef89eefac53b47039b3",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ " 0%| | 0/10 [00:00, ?it/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "Processed prompts: 0%| | 0/100 [00:00, ?it/s, Generation Speed: 0.00 toks/s]\u001b[A\n",
+ "Processed prompts: 1%| | 1/100 [00:39<1:05:13, 39.53s/it, Generation Speed: 1.64 toks/s]\u001b[A\n",
+ "Processed prompts: 2%|▏ | 2/100 [00:42<29:49, 18.26s/it, Generation Speed: 2.89 toks/s] \u001b[A\n",
+ "Processed prompts: 3%|▎ | 3/100 [00:43<16:39, 10.31s/it, Generation Speed: 4.41 toks/s]\u001b[A\n",
+ "Processed prompts: 5%|▌ | 5/100 [00:44<07:27, 4.71s/it, Generation Speed: 7.16 toks/s]\u001b[A\n",
+ "Processed prompts: 6%|▌ | 6/100 [00:45<05:37, 3.59s/it, Generation Speed: 8.50 toks/s]\u001b[A\n",
+ "Processed prompts: 8%|▊ | 8/100 [00:46<03:33, 2.32s/it, Generation Speed: 10.96 toks/s]\u001b[A\n",
+ "Processed prompts: 9%|▉ | 9/100 [00:47<02:58, 1.96s/it, Generation Speed: 12.26 toks/s]\u001b[A\n",
+ "Processed prompts: 11%|█ | 11/100 [00:52<03:17, 2.22s/it, Generation Speed: 13.56 toks/s]\u001b[A\n",
+ "Processed prompts: 12%|█▏ | 12/100 [00:55<03:23, 2.31s/it, Generation Speed: 14.28 toks/s]\u001b[A\n",
+ "Processed prompts: 14%|█▍ | 14/100 [00:56<02:15, 1.58s/it, Generation Speed: 16.30 toks/s]\u001b[A\n",
+ "Processed prompts: 15%|█▌ | 15/100 [00:57<02:00, 1.42s/it, Generation Speed: 17.24 toks/s]\u001b[A\n",
+ "Processed prompts: 17%|█▋ | 17/100 [00:58<01:26, 1.04s/it, Generation Speed: 19.16 toks/s]\u001b[A\n",
+ "Processed prompts: 18%|█▊ | 18/100 [00:59<01:21, 1.00it/s, Generation Speed: 20.39 toks/s]\u001b[A\n",
+ "Processed prompts: 20%|██ | 20/100 [01:00<01:14, 1.07it/s, Generation Speed: 21.95 toks/s]\u001b[A\n",
+ "Processed prompts: 22%|██▏ | 22/100 [01:01<00:58, 1.32it/s, Generation Speed: 24.13 toks/s]\u001b[A\n",
+ "Processed prompts: 23%|██▎ | 23/100 [01:02<01:07, 1.13it/s, Generation Speed: 24.77 toks/s]\u001b[A\n",
+ "Processed prompts: 25%|██▌ | 25/100 [01:04<00:58, 1.27it/s, Generation Speed: 26.28 toks/s]\u001b[A\n",
+ "Processed prompts: 26%|██▌ | 26/100 [01:04<00:55, 1.32it/s, Generation Speed: 27.24 toks/s]\u001b[A\n",
+ "Processed prompts: 28%|██▊ | 28/100 [01:06<00:50, 1.43it/s, Generation Speed: 29.21 toks/s]\u001b[A\n",
+ "Processed prompts: 29%|██▉ | 29/100 [01:06<00:47, 1.49it/s, Generation Speed: 30.10 toks/s]\u001b[A\n",
+ "Processed prompts: 31%|███ | 31/100 [01:07<00:36, 1.89it/s, Generation Speed: 31.88 toks/s]\u001b[A\n",
+ "Processed prompts: 32%|███▏ | 32/100 [01:07<00:36, 1.86it/s, Generation Speed: 32.73 toks/s]\u001b[A\n",
+ "Processed prompts: 34%|███▍ | 34/100 [01:08<00:29, 2.27it/s, Generation Speed: 34.54 toks/s]\u001b[A\n",
+ "Processed prompts: 35%|███▌ | 35/100 [01:08<00:30, 2.16it/s, Generation Speed: 35.54 toks/s]\u001b[A\n",
+ "Processed prompts: 38%|███▊ | 38/100 [01:10<00:35, 1.73it/s, Generation Speed: 37.09 toks/s]\u001b[A\n",
+ "Processed prompts: 39%|███▉ | 39/100 [01:11<00:34, 1.75it/s, Generation Speed: 37.78 toks/s]\u001b[A\n",
+ "Processed prompts: 40%|████ | 40/100 [01:12<00:33, 1.77it/s, Generation Speed: 38.72 toks/s]\u001b[A\n",
+ "Processed prompts: 41%|████ | 41/100 [01:12<00:32, 1.81it/s, Generation Speed: 39.20 toks/s]\u001b[A\n",
+ "Processed prompts: 43%|████▎ | 43/100 [01:13<00:24, 2.33it/s, Generation Speed: 40.66 toks/s]\u001b[A\n",
+ "Processed prompts: 44%|████▍ | 44/100 [01:13<00:24, 2.32it/s, Generation Speed: 41.31 toks/s]\u001b[A\n",
+ "Processed prompts: 46%|████▌ | 46/100 [01:13<00:18, 2.87it/s, Generation Speed: 43.16 toks/s]\u001b[A\n",
+ "Processed prompts: 47%|████▋ | 47/100 [01:14<00:19, 2.72it/s, Generation Speed: 44.28 toks/s]\u001b[A\n",
+ "Processed prompts: 48%|████▊ | 48/100 [01:14<00:19, 2.64it/s, Generation Speed: 44.97 toks/s]\u001b[A\n",
+ "Processed prompts: 50%|█████ | 50/100 [01:16<00:23, 2.09it/s, Generation Speed: 45.83 toks/s]\u001b[A\n",
+ "Processed prompts: 51%|█████ | 51/100 [01:16<00:22, 2.15it/s, Generation Speed: 46.61 toks/s]\u001b[A\n",
+ "Processed prompts: 52%|█████▏ | 52/100 [01:16<00:21, 2.22it/s, Generation Speed: 47.68 toks/s]\u001b[A\n",
+ "Processed prompts: 55%|█████▌ | 55/100 [01:17<00:13, 3.45it/s, Generation Speed: 50.81 toks/s]\u001b[A\n",
+ "Processed prompts: 57%|█████▋ | 57/100 [01:17<00:11, 3.88it/s, Generation Speed: 52.53 toks/s]\u001b[A\n",
+ "Processed prompts: 59%|█████▉ | 59/100 [01:18<00:09, 4.22it/s, Generation Speed: 53.90 toks/s]\u001b[A\n",
+ "Processed prompts: 60%|██████ | 60/100 [01:18<00:10, 3.78it/s, Generation Speed: 54.81 toks/s]\u001b[A\n",
+ "Processed prompts: 64%|██████▍ | 64/100 [01:19<00:09, 3.74it/s, Generation Speed: 57.35 toks/s]\u001b[A\n",
+ "Processed prompts: 65%|██████▌ | 65/100 [01:20<00:11, 3.04it/s, Generation Speed: 57.74 toks/s]\u001b[A\n",
+ "Processed prompts: 67%|██████▋ | 67/100 [01:20<00:09, 3.58it/s, Generation Speed: 59.30 toks/s]\u001b[A\n",
+ "Processed prompts: 68%|██████▊ | 68/100 [01:20<00:09, 3.47it/s, Generation Speed: 60.17 toks/s]\u001b[A\n",
+ "Processed prompts: 69%|██████▉ | 69/100 [01:21<00:09, 3.36it/s, Generation Speed: 60.85 toks/s]\u001b[A\n",
+ "Processed prompts: 70%|███████ | 70/100 [01:21<00:08, 3.35it/s, Generation Speed: 61.41 toks/s]\u001b[A\n",
+ "Processed prompts: 71%|███████ | 71/100 [01:22<00:10, 2.73it/s, Generation Speed: 61.80 toks/s]\u001b[A\n",
+ "Processed prompts: 73%|███████▎ | 73/100 [01:22<00:07, 3.65it/s, Generation Speed: 63.56 toks/s]\u001b[A\n",
+ "Processed prompts: 74%|███████▍ | 74/100 [01:22<00:07, 3.66it/s, Generation Speed: 64.14 toks/s]\u001b[A\n",
+ "Processed prompts: 75%|███████▌ | 75/100 [01:23<00:08, 2.90it/s, Generation Speed: 64.67 toks/s]\u001b[A\n",
+ "Processed prompts: 77%|███████▋ | 77/100 [01:24<00:09, 2.44it/s, Generation Speed: 65.80 toks/s]\u001b[A\n",
+ "Processed prompts: 79%|███████▉ | 79/100 [01:24<00:06, 3.29it/s, Generation Speed: 67.29 toks/s]\u001b[A\n",
+ "Processed prompts: 80%|████████ | 80/100 [01:24<00:05, 3.45it/s, Generation Speed: 68.21 toks/s]\u001b[A\n",
+ "Processed prompts: 82%|████████▏ | 82/100 [01:25<00:04, 3.76it/s, Generation Speed: 69.75 toks/s]\u001b[A\n",
+ "Processed prompts: 84%|████████▍ | 84/100 [01:25<00:03, 4.81it/s, Generation Speed: 71.36 toks/s]\u001b[A\n",
+ "Processed prompts: 86%|████████▌ | 86/100 [01:25<00:02, 5.12it/s, Generation Speed: 72.79 toks/s]\u001b[A\n",
+ "Processed prompts: 87%|████████▋ | 87/100 [01:25<00:02, 4.59it/s, Generation Speed: 73.24 toks/s]\u001b[A\n",
+ "Processed prompts: 88%|████████▊ | 88/100 [01:26<00:02, 4.88it/s, Generation Speed: 73.89 toks/s]\u001b[A\n",
+ "Processed prompts: 89%|████████▉ | 89/100 [01:26<00:02, 5.16it/s, Generation Speed: 74.57 toks/s]\u001b[A\n",
+ "Processed prompts: 91%|█████████ | 91/100 [01:26<00:01, 6.79it/s, Generation Speed: 76.28 toks/s]\u001b[A\n",
+ "Processed prompts: 92%|█████████▏| 92/100 [01:26<00:01, 6.75it/s, Generation Speed: 76.99 toks/s]\u001b[A\n",
+ "Processed prompts: 93%|█████████▎| 93/100 [01:26<00:01, 4.68it/s, Generation Speed: 77.61 toks/s]\u001b[A\n",
+ "Processed prompts: 94%|█████████▍| 94/100 [01:27<00:01, 4.55it/s, Generation Speed: 78.26 toks/s]\u001b[A\n",
+ "Processed prompts: 95%|█████████▌| 95/100 [01:27<00:00, 5.18it/s, Generation Speed: 79.00 toks/s]\u001b[A\n",
+ "Processed prompts: 96%|█████████▌| 96/100 [01:27<00:01, 3.48it/s, Generation Speed: 79.41 toks/s]\u001b[A\n",
+ "Processed prompts: 99%|█████████▉| 99/100 [01:28<00:00, 5.25it/s, Generation Speed: 81.99 toks/s]\u001b[A\n",
+ "Processed prompts: 100%|██████████| 100/100 [01:28<00:00, 1.13it/s, Generation Speed: 82.88 toks/s]\u001b[A\n"
+ ]
+ },
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "607fe2197abf4f91a3556c3dcae0b0cb",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "Flattening the indices: 0%| | 0/100 [00:00, ? examples/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "Processed prompts: 0%| | 0/100 [00:00, ?it/s, Generation Speed: 0.00 toks/s]\u001b[A\n",
+ "Processed prompts: 1%| | 1/100 [00:34<57:02, 34.57s/it, Generation Speed: 1.42 toks/s]\u001b[A\n",
+ "Processed prompts: 2%|▏ | 2/100 [00:37<25:36, 15.68s/it, Generation Speed: 2.86 toks/s]\u001b[A\n",
+ "Processed prompts: 3%|▎ | 3/100 [00:37<14:22, 8.90s/it, Generation Speed: 4.49 toks/s]\u001b[A\n",
+ "Processed prompts: 4%|▍ | 4/100 [00:38<09:08, 5.71s/it, Generation Speed: 6.02 toks/s]\u001b[A\n",
+ "Processed prompts: 5%|▌ | 5/100 [00:42<08:06, 5.12s/it, Generation Speed: 6.97 toks/s]\u001b[A\n",
+ "Processed prompts: 6%|▌ | 6/100 [00:46<07:03, 4.50s/it, Generation Speed: 7.71 toks/s]\u001b[A\n",
+ "Processed prompts: 7%|▋ | 7/100 [00:46<05:08, 3.31s/it, Generation Speed: 9.02 toks/s]\u001b[A\n",
+ "Processed prompts: 8%|▊ | 8/100 [00:47<03:53, 2.53s/it, Generation Speed: 10.30 toks/s]\u001b[A\n",
+ "Processed prompts: 9%|▉ | 9/100 [00:49<03:28, 2.29s/it, Generation Speed: 11.48 toks/s]\u001b[A\n",
+ "Processed prompts: 10%|█ | 10/100 [00:51<03:11, 2.12s/it, Generation Speed: 12.38 toks/s]\u001b[A\n",
+ "Processed prompts: 12%|█▏ | 12/100 [00:54<02:49, 1.93s/it, Generation Speed: 14.02 toks/s]\u001b[A\n",
+ "Processed prompts: 13%|█▎ | 13/100 [00:55<02:23, 1.65s/it, Generation Speed: 15.17 toks/s]\u001b[A\n",
+ "Processed prompts: 16%|█▌ | 16/100 [00:56<01:19, 1.06it/s, Generation Speed: 18.84 toks/s]\u001b[A\n",
+ "Processed prompts: 18%|█▊ | 18/100 [00:58<01:15, 1.09it/s, Generation Speed: 21.06 toks/s]\u001b[A\n",
+ "Processed prompts: 19%|█▉ | 19/100 [00:58<01:13, 1.10it/s, Generation Speed: 22.02 toks/s]\u001b[A\n",
+ "Processed prompts: 20%|██ | 20/100 [00:59<01:11, 1.12it/s, Generation Speed: 22.91 toks/s]\u001b[A\n",
+ "Processed prompts: 21%|██ | 21/100 [01:01<01:24, 1.07s/it, Generation Speed: 23.22 toks/s]\u001b[A\n",
+ "Processed prompts: 22%|██▏ | 22/100 [01:02<01:18, 1.01s/it, Generation Speed: 24.14 toks/s]\u001b[A\n",
+ "Processed prompts: 24%|██▍ | 24/100 [01:03<01:02, 1.21it/s, Generation Speed: 25.91 toks/s]\u001b[A\n",
+ "Processed prompts: 25%|██▌ | 25/100 [01:06<01:40, 1.34s/it, Generation Speed: 26.10 toks/s]\u001b[A\n",
+ "Processed prompts: 30%|███ | 30/100 [01:07<00:40, 1.72it/s, Generation Speed: 31.65 toks/s]\u001b[A\n",
+ "Processed prompts: 32%|███▏ | 32/100 [01:07<00:34, 1.97it/s, Generation Speed: 33.68 toks/s]\u001b[A\n",
+ "Processed prompts: 34%|███▍ | 34/100 [01:08<00:34, 1.92it/s, Generation Speed: 34.78 toks/s]\u001b[A\n",
+ "Processed prompts: 35%|███▌ | 35/100 [01:09<00:34, 1.89it/s, Generation Speed: 35.62 toks/s]\u001b[A\n",
+ "Processed prompts: 37%|███▋ | 37/100 [01:09<00:28, 2.22it/s, Generation Speed: 37.23 toks/s]\u001b[A\n",
+ "Processed prompts: 38%|███▊ | 38/100 [01:10<00:28, 2.15it/s, Generation Speed: 37.79 toks/s]\u001b[A\n",
+ "Processed prompts: 39%|███▉ | 39/100 [01:10<00:28, 2.12it/s, Generation Speed: 38.65 toks/s]\u001b[A\n",
+ "Processed prompts: 41%|████ | 41/100 [01:11<00:28, 2.06it/s, Generation Speed: 40.00 toks/s]\u001b[A\n",
+ "Processed prompts: 42%|████▏ | 42/100 [01:12<00:33, 1.74it/s, Generation Speed: 40.50 toks/s]\u001b[A\n",
+ "Processed prompts: 43%|████▎ | 43/100 [01:13<00:30, 1.84it/s, Generation Speed: 41.24 toks/s]\u001b[A\n",
+ "Processed prompts: 46%|████▌ | 46/100 [01:14<00:26, 2.02it/s, Generation Speed: 43.26 toks/s]\u001b[A\n",
+ "Processed prompts: 48%|████▊ | 48/100 [01:15<00:21, 2.47it/s, Generation Speed: 44.97 toks/s]\u001b[A\n",
+ "Processed prompts: 50%|█████ | 50/100 [01:15<00:17, 2.88it/s, Generation Speed: 46.67 toks/s]\u001b[A\n",
+ "Processed prompts: 51%|█████ | 51/100 [01:15<00:17, 2.76it/s, Generation Speed: 47.47 toks/s]\u001b[A\n",
+ "Processed prompts: 53%|█████▎ | 53/100 [01:16<00:18, 2.53it/s, Generation Speed: 48.68 toks/s]\u001b[A\n",
+ "Processed prompts: 54%|█████▍ | 54/100 [01:17<00:18, 2.47it/s, Generation Speed: 49.01 toks/s]\u001b[A\n",
+ "Processed prompts: 55%|█████▌ | 55/100 [01:19<00:34, 1.32it/s, Generation Speed: 48.79 toks/s]\u001b[A\n",
+ "Processed prompts: 57%|█████▋ | 57/100 [01:19<00:23, 1.84it/s, Generation Speed: 50.69 toks/s]\u001b[A\n",
+ "Processed prompts: 61%|██████ | 61/100 [01:20<00:13, 2.79it/s, Generation Speed: 53.86 toks/s]\u001b[A\n",
+ "Processed prompts: 62%|██████▏ | 62/100 [01:21<00:15, 2.41it/s, Generation Speed: 54.60 toks/s]\u001b[A\n",
+ "Processed prompts: 65%|██████▌ | 65/100 [01:21<00:10, 3.42it/s, Generation Speed: 57.09 toks/s]\u001b[A\n",
+ "Processed prompts: 67%|██████▋ | 67/100 [01:22<00:09, 3.38it/s, Generation Speed: 58.41 toks/s]\u001b[A\n",
+ "Processed prompts: 69%|██████▉ | 69/100 [01:22<00:07, 3.94it/s, Generation Speed: 59.90 toks/s]\u001b[A\n",
+ "Processed prompts: 71%|███████ | 71/100 [01:22<00:06, 4.49it/s, Generation Speed: 61.33 toks/s]\u001b[A\n",
+ "Processed prompts: 72%|███████▏ | 72/100 [01:23<00:06, 4.27it/s, Generation Speed: 61.85 toks/s]\u001b[A\n",
+ "Processed prompts: 73%|███████▎ | 73/100 [01:23<00:06, 4.12it/s, Generation Speed: 62.67 toks/s]\u001b[A\n",
+ "Processed prompts: 75%|███████▌ | 75/100 [01:23<00:06, 4.00it/s, Generation Speed: 64.01 toks/s]\u001b[A\n",
+ "Processed prompts: 77%|███████▋ | 77/100 [01:24<00:05, 3.98it/s, Generation Speed: 65.73 toks/s]\u001b[A\n",
+ "Processed prompts: 80%|████████ | 80/100 [01:24<00:03, 5.65it/s, Generation Speed: 68.55 toks/s]\u001b[A\n",
+ "Processed prompts: 82%|████████▏ | 82/100 [01:25<00:03, 5.24it/s, Generation Speed: 69.84 toks/s]\u001b[A\n",
+ "Processed prompts: 83%|████████▎ | 83/100 [01:25<00:04, 3.80it/s, Generation Speed: 70.23 toks/s]\u001b[A\n",
+ "Processed prompts: 85%|████████▌ | 85/100 [01:25<00:03, 4.86it/s, Generation Speed: 71.57 toks/s]\u001b[A\n",
+ "Processed prompts: 87%|████████▋ | 87/100 [01:26<00:02, 5.12it/s, Generation Speed: 72.82 toks/s]\u001b[A\n",
+ "Processed prompts: 88%|████████▊ | 88/100 [01:26<00:02, 5.22it/s, Generation Speed: 73.85 toks/s]\u001b[A\n",
+ "Processed prompts: 89%|████████▉ | 89/100 [01:26<00:02, 4.44it/s, Generation Speed: 74.84 toks/s]\u001b[A\n",
+ "Processed prompts: 90%|█████████ | 90/100 [01:27<00:02, 3.60it/s, Generation Speed: 75.32 toks/s]\u001b[A\n",
+ "Processed prompts: 91%|█████████ | 91/100 [01:27<00:02, 3.59it/s, Generation Speed: 75.89 toks/s]\u001b[A\n",
+ "Processed prompts: 92%|█████████▏| 92/100 [01:27<00:01, 4.09it/s, Generation Speed: 76.57 toks/s]\u001b[A\n",
+ "Processed prompts: 93%|█████████▎| 93/100 [01:28<00:02, 2.74it/s, Generation Speed: 76.82 toks/s]\u001b[A\n",
+ "Processed prompts: 94%|█████████▍| 94/100 [01:28<00:01, 3.35it/s, Generation Speed: 77.74 toks/s]\u001b[A\n",
+ "Processed prompts: 95%|█████████▌| 95/100 [01:28<00:01, 4.01it/s, Generation Speed: 78.62 toks/s]\u001b[A\n",
+ "Processed prompts: 96%|█████████▌| 96/100 [01:28<00:01, 3.73it/s, Generation Speed: 79.27 toks/s]\u001b[A\n",
+ "Processed prompts: 98%|█████████▊| 98/100 [01:29<00:00, 4.36it/s, Generation Speed: 80.90 toks/s]\u001b[A\n",
+ "Processed prompts: 99%|█████████▉| 99/100 [01:29<00:00, 4.69it/s, Generation Speed: 81.80 toks/s]\u001b[A\n",
+ "Processed prompts: 100%|██████████| 100/100 [01:30<00:00, 1.11it/s, Generation Speed: 81.92 toks/s]\u001b[A\n"
+ ]
+ },
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "cdf5b30d647d4bf3b83bfd86ce88133e",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "Flattening the indices: 0%| | 0/100 [00:00, ? examples/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "Processed prompts: 0%| | 0/100 [00:00, ?it/s, Generation Speed: 0.00 toks/s]\u001b[A\n",
+ "Processed prompts: 1%| | 1/100 [00:37<1:01:59, 37.57s/it, Generation Speed: 1.70 toks/s]\u001b[A\n",
+ "Processed prompts: 2%|▏ | 2/100 [00:40<28:28, 17.43s/it, Generation Speed: 3.06 toks/s] \u001b[A\n",
+ "Processed prompts: 4%|▍ | 4/100 [00:43<11:40, 7.30s/it, Generation Speed: 5.62 toks/s]\u001b[A\n",
+ "Processed prompts: 5%|▌ | 5/100 [00:45<08:51, 5.59s/it, Generation Speed: 6.96 toks/s]\u001b[A\n",
+ "Processed prompts: 6%|▌ | 6/100 [00:46<06:29, 4.15s/it, Generation Speed: 8.33 toks/s]\u001b[A\n",
+ "Processed prompts: 7%|▋ | 7/100 [00:47<05:15, 3.39s/it, Generation Speed: 9.61 toks/s]\u001b[A\n",
+ "Processed prompts: 11%|█ | 11/100 [00:48<02:01, 1.37s/it, Generation Speed: 14.61 toks/s]\u001b[A\n",
+ "Processed prompts: 12%|█▏ | 12/100 [00:50<02:04, 1.42s/it, Generation Speed: 15.61 toks/s]\u001b[A\n",
+ "Processed prompts: 13%|█▎ | 13/100 [00:52<02:10, 1.50s/it, Generation Speed: 16.43 toks/s]\u001b[A\n",
+ "Processed prompts: 15%|█▌ | 15/100 [00:52<01:33, 1.10s/it, Generation Speed: 18.71 toks/s]\u001b[A\n",
+ "Processed prompts: 16%|█▌ | 16/100 [00:53<01:28, 1.05s/it, Generation Speed: 19.72 toks/s]\u001b[A\n",
+ "Processed prompts: 17%|█▋ | 17/100 [00:55<01:40, 1.22s/it, Generation Speed: 20.55 toks/s]\u001b[A\n",
+ "Processed prompts: 19%|█▉ | 19/100 [00:57<01:27, 1.08s/it, Generation Speed: 22.34 toks/s]\u001b[A\n",
+ "Processed prompts: 21%|██ | 21/100 [00:59<01:30, 1.14s/it, Generation Speed: 23.70 toks/s]\u001b[A\n",
+ "Processed prompts: 22%|██▏ | 22/100 [01:00<01:23, 1.07s/it, Generation Speed: 24.71 toks/s]\u001b[A\n",
+ "Processed prompts: 24%|██▍ | 24/100 [01:01<01:02, 1.21it/s, Generation Speed: 26.56 toks/s]\u001b[A\n",
+ "Processed prompts: 27%|██▋ | 27/100 [01:03<00:59, 1.23it/s, Generation Speed: 28.66 toks/s]\u001b[A\n",
+ "Processed prompts: 29%|██▉ | 29/100 [01:04<00:46, 1.53it/s, Generation Speed: 30.60 toks/s]\u001b[A\n",
+ "Processed prompts: 30%|███ | 30/100 [01:04<00:45, 1.55it/s, Generation Speed: 31.18 toks/s]\u001b[A\n",
+ "Processed prompts: 31%|███ | 31/100 [01:06<00:51, 1.35it/s, Generation Speed: 31.72 toks/s]\u001b[A\n",
+ "Processed prompts: 33%|███▎ | 33/100 [01:06<00:38, 1.74it/s, Generation Speed: 33.54 toks/s]\u001b[A\n",
+ "Processed prompts: 35%|███▌ | 35/100 [01:07<00:30, 2.11it/s, Generation Speed: 35.11 toks/s]\u001b[A\n",
+ "Processed prompts: 36%|███▌ | 36/100 [01:07<00:31, 2.04it/s, Generation Speed: 35.96 toks/s]\u001b[A\n",
+ "Processed prompts: 39%|███▉ | 39/100 [01:08<00:21, 2.89it/s, Generation Speed: 39.08 toks/s]\u001b[A\n",
+ "Processed prompts: 41%|████ | 41/100 [01:09<00:23, 2.56it/s, Generation Speed: 40.53 toks/s]\u001b[A\n",
+ "Processed prompts: 42%|████▏ | 42/100 [01:10<00:28, 2.02it/s, Generation Speed: 41.16 toks/s]\u001b[A\n",
+ "Processed prompts: 45%|████▌ | 45/100 [01:11<00:22, 2.40it/s, Generation Speed: 43.52 toks/s]\u001b[A\n",
+ "Processed prompts: 46%|████▌ | 46/100 [01:11<00:22, 2.35it/s, Generation Speed: 44.19 toks/s]\u001b[A\n",
+ "Processed prompts: 48%|████▊ | 48/100 [01:12<00:22, 2.35it/s, Generation Speed: 45.45 toks/s]\u001b[A\n",
+ "Processed prompts: 50%|█████ | 50/100 [01:14<00:27, 1.82it/s, Generation Speed: 46.21 toks/s]\u001b[A\n",
+ "Processed prompts: 52%|█████▏ | 52/100 [01:14<00:24, 1.97it/s, Generation Speed: 48.03 toks/s]\u001b[A\n",
+ "Processed prompts: 54%|█████▍ | 54/100 [01:15<00:19, 2.41it/s, Generation Speed: 49.46 toks/s]\u001b[A\n",
+ "Processed prompts: 55%|█████▌ | 55/100 [01:17<00:28, 1.57it/s, Generation Speed: 49.42 toks/s]\u001b[A\n",
+ "Processed prompts: 58%|█████▊ | 58/100 [01:17<00:17, 2.38it/s, Generation Speed: 52.09 toks/s]\u001b[A\n",
+ "Processed prompts: 60%|██████ | 60/100 [01:17<00:14, 2.84it/s, Generation Speed: 53.85 toks/s]\u001b[A\n",
+ "Processed prompts: 62%|██████▏ | 62/100 [01:18<00:13, 2.83it/s, Generation Speed: 54.97 toks/s]\u001b[A\n",
+ "Processed prompts: 64%|██████▍ | 64/100 [01:18<00:10, 3.30it/s, Generation Speed: 56.66 toks/s]\u001b[A\n",
+ "Processed prompts: 66%|██████▌ | 66/100 [01:19<00:09, 3.77it/s, Generation Speed: 58.55 toks/s]\u001b[A\n",
+ "Processed prompts: 69%|██████▉ | 69/100 [01:19<00:06, 4.90it/s, Generation Speed: 60.83 toks/s]\u001b[A\n",
+ "Processed prompts: 70%|███████ | 70/100 [01:19<00:06, 4.63it/s, Generation Speed: 61.46 toks/s]\u001b[A\n",
+ "Processed prompts: 71%|███████ | 71/100 [01:20<00:08, 3.58it/s, Generation Speed: 61.87 toks/s]\u001b[A\n",
+ "Processed prompts: 72%|███████▏ | 72/100 [01:20<00:09, 2.98it/s, Generation Speed: 62.50 toks/s]\u001b[A\n",
+ "Processed prompts: 76%|███████▌ | 76/100 [01:21<00:05, 4.50it/s, Generation Speed: 65.45 toks/s]\u001b[A\n",
+ "Processed prompts: 78%|███████▊ | 78/100 [01:21<00:05, 4.33it/s, Generation Speed: 66.77 toks/s]\u001b[A\n",
+ "Processed prompts: 79%|███████▉ | 79/100 [01:22<00:05, 3.64it/s, Generation Speed: 67.60 toks/s]\u001b[A\n",
+ "Processed prompts: 81%|████████ | 81/100 [01:22<00:04, 4.49it/s, Generation Speed: 69.11 toks/s]\u001b[A\n",
+ "Processed prompts: 83%|████████▎ | 83/100 [01:23<00:03, 4.51it/s, Generation Speed: 70.13 toks/s]\u001b[A\n",
+ "Processed prompts: 84%|████████▍ | 84/100 [01:23<00:05, 3.02it/s, Generation Speed: 70.49 toks/s]\u001b[A\n",
+ "Processed prompts: 86%|████████▌ | 86/100 [01:24<00:03, 4.02it/s, Generation Speed: 71.95 toks/s]\u001b[A\n",
+ "Processed prompts: 87%|████████▋ | 87/100 [01:24<00:03, 3.75it/s, Generation Speed: 72.53 toks/s]\u001b[A\n",
+ "Processed prompts: 88%|████████▊ | 88/100 [01:24<00:02, 4.15it/s, Generation Speed: 73.36 toks/s]\u001b[A\n",
+ "Processed prompts: 90%|█████████ | 90/100 [01:24<00:01, 5.60it/s, Generation Speed: 74.95 toks/s]\u001b[A\n",
+ "Processed prompts: 93%|█████████▎| 93/100 [01:25<00:00, 7.22it/s, Generation Speed: 77.16 toks/s]\u001b[A\n",
+ "Processed prompts: 94%|█████████▍| 94/100 [01:25<00:01, 4.46it/s, Generation Speed: 77.49 toks/s]\u001b[A\n",
+ "Processed prompts: 96%|█████████▌| 96/100 [01:25<00:00, 5.97it/s, Generation Speed: 79.17 toks/s]\u001b[A\n",
+ "Processed prompts: 98%|█████████▊| 98/100 [01:26<00:00, 5.86it/s, Generation Speed: 80.74 toks/s]\u001b[A\n",
+ "Processed prompts: 99%|█████████▉| 99/100 [01:26<00:00, 5.86it/s, Generation Speed: 81.62 toks/s]\u001b[A\n",
+ "Processed prompts: 100%|██████████| 100/100 [01:27<00:00, 1.14it/s, Generation Speed: 81.40 toks/s]\u001b[A\n"
+ ]
+ },
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "d793af1620b642bbb444c4aec8cf05f8",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "Flattening the indices: 0%| | 0/100 [00:00, ? examples/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "Processed prompts: 0%| | 0/100 [00:00, ?it/s, Generation Speed: 0.00 toks/s]\u001b[A\n",
+ "Processed prompts: 1%| | 1/100 [00:36<59:31, 36.08s/it, Generation Speed: 1.36 toks/s]\u001b[A\n",
+ "Processed prompts: 2%|▏ | 2/100 [00:36<25:01, 15.32s/it, Generation Speed: 2.90 toks/s]\u001b[A\n",
+ "Processed prompts: 3%|▎ | 3/100 [00:37<14:02, 8.69s/it, Generation Speed: 4.43 toks/s]\u001b[A\n",
+ "Processed prompts: 4%|▍ | 4/100 [00:38<08:54, 5.57s/it, Generation Speed: 6.03 toks/s]\u001b[A\n",
+ "Processed prompts: 5%|▌ | 5/100 [00:40<07:02, 4.45s/it, Generation Speed: 7.21 toks/s]\u001b[A\n",
+ "Processed prompts: 6%|▌ | 6/100 [00:43<05:52, 3.75s/it, Generation Speed: 8.41 toks/s]\u001b[A\n",
+ "Processed prompts: 8%|▊ | 8/100 [00:44<03:14, 2.11s/it, Generation Speed: 11.12 toks/s]\u001b[A\n",
+ "Processed prompts: 9%|▉ | 9/100 [00:46<03:23, 2.23s/it, Generation Speed: 11.96 toks/s]\u001b[A\n",
+ "Processed prompts: 11%|█ | 11/100 [00:48<02:24, 1.63s/it, Generation Speed: 14.52 toks/s]\u001b[A\n",
+ "Processed prompts: 12%|█▏ | 12/100 [00:50<02:41, 1.83s/it, Generation Speed: 15.14 toks/s]\u001b[A\n",
+ "Processed prompts: 13%|█▎ | 13/100 [00:51<02:18, 1.59s/it, Generation Speed: 16.18 toks/s]\u001b[A\n",
+ "Processed prompts: 14%|█▍ | 14/100 [00:52<01:58, 1.38s/it, Generation Speed: 17.29 toks/s]\u001b[A\n",
+ "Processed prompts: 15%|█▌ | 15/100 [00:53<01:43, 1.22s/it, Generation Speed: 18.27 toks/s]\u001b[A\n",
+ "Processed prompts: 16%|█▌ | 16/100 [00:54<01:33, 1.11s/it, Generation Speed: 19.48 toks/s]\u001b[A\n",
+ "Processed prompts: 18%|█▊ | 18/100 [00:56<01:37, 1.19s/it, Generation Speed: 21.04 toks/s]\u001b[A\n",
+ "Processed prompts: 20%|██ | 20/100 [00:57<01:11, 1.12it/s, Generation Speed: 23.13 toks/s]\u001b[A\n",
+ "Processed prompts: 21%|██ | 21/100 [00:59<01:24, 1.07s/it, Generation Speed: 23.72 toks/s]\u001b[A\n",
+ "Processed prompts: 23%|██▎ | 23/100 [01:01<01:16, 1.01it/s, Generation Speed: 25.33 toks/s]\u001b[A\n",
+ "Processed prompts: 24%|██▍ | 24/100 [01:02<01:24, 1.11s/it, Generation Speed: 26.07 toks/s]\u001b[A\n",
+ "Processed prompts: 26%|██▌ | 26/100 [01:03<00:59, 1.24it/s, Generation Speed: 27.88 toks/s]\u001b[A\n",
+ "Processed prompts: 27%|██▋ | 27/100 [01:04<01:04, 1.14it/s, Generation Speed: 28.60 toks/s]\u001b[A\n",
+ "Processed prompts: 30%|███ | 30/100 [01:05<00:44, 1.57it/s, Generation Speed: 31.20 toks/s]\u001b[A\n",
+ "Processed prompts: 33%|███▎ | 33/100 [01:06<00:30, 2.21it/s, Generation Speed: 34.05 toks/s]\u001b[A\n",
+ "Processed prompts: 34%|███▍ | 34/100 [01:07<00:36, 1.80it/s, Generation Speed: 34.46 toks/s]\u001b[A\n",
+ "Processed prompts: 35%|███▌ | 35/100 [01:08<00:43, 1.51it/s, Generation Speed: 35.18 toks/s]\u001b[A\n",
+ "Processed prompts: 38%|███▊ | 38/100 [01:09<00:37, 1.67it/s, Generation Speed: 37.56 toks/s]\u001b[A\n",
+ "Processed prompts: 40%|████ | 40/100 [01:10<00:34, 1.75it/s, Generation Speed: 39.11 toks/s]\u001b[A\n",
+ "Processed prompts: 42%|████▏ | 42/100 [01:11<00:27, 2.13it/s, Generation Speed: 40.77 toks/s]\u001b[A\n",
+ "Processed prompts: 43%|████▎ | 43/100 [01:11<00:26, 2.15it/s, Generation Speed: 41.34 toks/s]\u001b[A\n",
+ "Processed prompts: 44%|████▍ | 44/100 [01:12<00:26, 2.12it/s, Generation Speed: 42.01 toks/s]\u001b[A\n",
+ "Processed prompts: 45%|████▌ | 45/100 [01:13<00:32, 1.71it/s, Generation Speed: 42.43 toks/s]\u001b[A\n",
+ "Processed prompts: 46%|████▌ | 46/100 [01:14<00:36, 1.50it/s, Generation Speed: 43.14 toks/s]\u001b[A\n",
+ "Processed prompts: 47%|████▋ | 47/100 [01:14<00:32, 1.64it/s, Generation Speed: 43.91 toks/s]\u001b[A\n",
+ "Processed prompts: 49%|████▉ | 49/100 [01:15<00:22, 2.24it/s, Generation Speed: 45.85 toks/s]\u001b[A\n",
+ "Processed prompts: 51%|█████ | 51/100 [01:15<00:17, 2.79it/s, Generation Speed: 47.62 toks/s]\u001b[A\n",
+ "Processed prompts: 53%|█████▎ | 53/100 [01:16<00:17, 2.69it/s, Generation Speed: 49.28 toks/s]\u001b[A\n",
+ "Processed prompts: 54%|█████▍ | 54/100 [01:17<00:21, 2.14it/s, Generation Speed: 49.59 toks/s]\u001b[A\n",
+ "Processed prompts: 55%|█████▌ | 55/100 [01:17<00:20, 2.16it/s, Generation Speed: 50.27 toks/s]\u001b[A\n",
+ "Processed prompts: 56%|█████▌ | 56/100 [01:17<00:20, 2.20it/s, Generation Speed: 50.88 toks/s]\u001b[A\n",
+ "Processed prompts: 57%|█████▋ | 57/100 [01:18<00:23, 1.82it/s, Generation Speed: 51.36 toks/s]\u001b[A\n",
+ "Processed prompts: 59%|█████▉ | 59/100 [01:19<00:16, 2.55it/s, Generation Speed: 52.78 toks/s]\u001b[A\n",
+ "Processed prompts: 60%|██████ | 60/100 [01:19<00:15, 2.60it/s, Generation Speed: 53.56 toks/s]\u001b[A\n",
+ "Processed prompts: 62%|██████▏ | 62/100 [01:19<00:11, 3.32it/s, Generation Speed: 55.04 toks/s]\u001b[A\n",
+ "Processed prompts: 63%|██████▎ | 63/100 [01:20<00:11, 3.21it/s, Generation Speed: 55.92 toks/s]\u001b[A\n",
+ "Processed prompts: 66%|██████▌ | 66/100 [01:20<00:07, 4.68it/s, Generation Speed: 57.84 toks/s]\u001b[A\n",
+ "Processed prompts: 67%|██████▋ | 67/100 [01:20<00:07, 4.27it/s, Generation Speed: 58.51 toks/s]\u001b[A\n",
+ "Processed prompts: 68%|██████▊ | 68/100 [01:21<00:08, 3.95it/s, Generation Speed: 58.99 toks/s]\u001b[A\n",
+ "Processed prompts: 69%|██████▉ | 69/100 [01:21<00:10, 3.04it/s, Generation Speed: 59.41 toks/s]\u001b[A\n",
+ "Processed prompts: 70%|███████ | 70/100 [01:22<00:09, 3.10it/s, Generation Speed: 60.14 toks/s]\u001b[A\n",
+ "Processed prompts: 71%|███████ | 71/100 [01:22<00:09, 3.16it/s, Generation Speed: 60.95 toks/s]\u001b[A\n",
+ "Processed prompts: 72%|███████▏ | 72/100 [01:22<00:08, 3.22it/s, Generation Speed: 61.80 toks/s]\u001b[A\n",
+ "Processed prompts: 74%|███████▍ | 74/100 [01:23<00:07, 3.37it/s, Generation Speed: 63.18 toks/s]\u001b[A\n",
+ "Processed prompts: 75%|███████▌ | 75/100 [01:23<00:08, 2.84it/s, Generation Speed: 63.79 toks/s]\u001b[A\n",
+ "Processed prompts: 76%|███████▌ | 76/100 [01:24<00:11, 2.12it/s, Generation Speed: 64.08 toks/s]\u001b[A\n",
+ "Processed prompts: 78%|███████▊ | 78/100 [01:24<00:07, 3.04it/s, Generation Speed: 65.61 toks/s]\u001b[A\n",
+ "Processed prompts: 79%|███████▉ | 79/100 [01:25<00:06, 3.19it/s, Generation Speed: 66.31 toks/s]\u001b[A\n",
+ "Processed prompts: 80%|████████ | 80/100 [01:25<00:08, 2.47it/s, Generation Speed: 66.96 toks/s]\u001b[A\n",
+ "Processed prompts: 82%|████████▏ | 82/100 [01:25<00:05, 3.55it/s, Generation Speed: 68.51 toks/s]\u001b[A\n",
+ "Processed prompts: 83%|████████▎ | 83/100 [01:26<00:04, 3.75it/s, Generation Speed: 69.13 toks/s]\u001b[A\n",
+ "Processed prompts: 84%|████████▍ | 84/100 [01:26<00:03, 4.01it/s, Generation Speed: 69.76 toks/s]\u001b[A\n",
+ "Processed prompts: 85%|████████▌ | 85/100 [01:26<00:04, 3.58it/s, Generation Speed: 70.46 toks/s]\u001b[A\n",
+ "Processed prompts: 88%|████████▊ | 88/100 [01:26<00:01, 6.14it/s, Generation Speed: 72.80 toks/s]\u001b[A\n",
+ "Processed prompts: 89%|████████▉ | 89/100 [01:27<00:01, 6.07it/s, Generation Speed: 73.56 toks/s]\u001b[A\n",
+ "Processed prompts: 90%|█████████ | 90/100 [01:27<00:01, 6.07it/s, Generation Speed: 74.55 toks/s]\u001b[A\n",
+ "Processed prompts: 91%|█████████ | 91/100 [01:27<00:02, 4.27it/s, Generation Speed: 75.26 toks/s]\u001b[A\n",
+ "Processed prompts: 93%|█████████▎| 93/100 [01:28<00:01, 4.03it/s, Generation Speed: 76.63 toks/s]\u001b[A\n",
+ "Processed prompts: 94%|█████████▍| 94/100 [01:28<00:01, 3.70it/s, Generation Speed: 77.32 toks/s]\u001b[A\n",
+ "Processed prompts: 96%|█████████▌| 96/100 [01:28<00:00, 4.39it/s, Generation Speed: 78.95 toks/s]\u001b[A\n",
+ "Processed prompts: 97%|█████████▋| 97/100 [01:29<00:01, 2.66it/s, Generation Speed: 79.20 toks/s]\u001b[A\n",
+ "Processed prompts: 98%|█████████▊| 98/100 [01:30<00:00, 2.85it/s, Generation Speed: 79.98 toks/s]\u001b[A\n",
+ "Processed prompts: 99%|█████████▉| 99/100 [01:30<00:00, 3.06it/s, Generation Speed: 80.96 toks/s]\u001b[A\n",
+ "Processed prompts: 100%|██████████| 100/100 [01:31<00:00, 1.10it/s, Generation Speed: 81.48 toks/s]\u001b[A\n"
+ ]
+ },
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "6e1cdb7dcf4048cb83b09cfad22ac04f",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "Flattening the indices: 0%| | 0/100 [00:00, ? examples/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "Processed prompts: 0%| | 0/100 [00:00, ?it/s, Generation Speed: 0.00 toks/s]\u001b[A\n",
+ "Processed prompts: 1%| | 1/100 [00:40<1:06:31, 40.31s/it, Generation Speed: 1.49 toks/s]\u001b[A\n",
+ "Processed prompts: 2%|▏ | 2/100 [00:43<30:30, 18.67s/it, Generation Speed: 2.92 toks/s] \u001b[A\n",
+ "Processed prompts: 3%|▎ | 3/100 [00:47<18:53, 11.69s/it, Generation Speed: 4.09 toks/s]\u001b[A\n",
+ "Processed prompts: 4%|▍ | 4/100 [00:48<11:51, 7.41s/it, Generation Speed: 5.26 toks/s]\u001b[A\n",
+ "Processed prompts: 5%|▌ | 5/100 [00:48<07:59, 5.05s/it, Generation Speed: 6.62 toks/s]\u001b[A\n",
+ "Processed prompts: 6%|▌ | 6/100 [00:49<05:40, 3.62s/it, Generation Speed: 7.79 toks/s]\u001b[A\n",
+ "Processed prompts: 7%|▋ | 7/100 [00:50<04:12, 2.72s/it, Generation Speed: 9.04 toks/s]\u001b[A\n",
+ "Processed prompts: 8%|▊ | 8/100 [00:52<03:43, 2.43s/it, Generation Speed: 10.16 toks/s]\u001b[A\n",
+ "Processed prompts: 9%|▉ | 9/100 [00:54<03:22, 2.22s/it, Generation Speed: 11.36 toks/s]\u001b[A\n",
+ "Processed prompts: 11%|█ | 11/100 [00:55<02:03, 1.39s/it, Generation Speed: 13.79 toks/s]\u001b[A\n",
+ "Processed prompts: 13%|█▎ | 13/100 [00:56<01:27, 1.01s/it, Generation Speed: 15.83 toks/s]\u001b[A\n",
+ "Processed prompts: 14%|█▍ | 14/100 [00:56<01:24, 1.02it/s, Generation Speed: 16.90 toks/s]\u001b[A\n",
+ "Processed prompts: 15%|█▌ | 15/100 [00:59<01:54, 1.35s/it, Generation Speed: 17.61 toks/s]\u001b[A\n",
+ "Processed prompts: 17%|█▋ | 17/100 [01:00<01:21, 1.02it/s, Generation Speed: 19.77 toks/s]\u001b[A\n",
+ "Processed prompts: 19%|█▉ | 19/100 [01:02<01:15, 1.07it/s, Generation Speed: 21.56 toks/s]\u001b[A\n",
+ "Processed prompts: 21%|██ | 21/100 [01:02<01:00, 1.31it/s, Generation Speed: 23.24 toks/s]\u001b[A\n",
+ "Processed prompts: 22%|██▏ | 22/100 [01:03<00:58, 1.34it/s, Generation Speed: 24.15 toks/s]\u001b[A\n",
+ "Processed prompts: 23%|██▎ | 23/100 [01:07<01:47, 1.40s/it, Generation Speed: 24.03 toks/s]\u001b[A\n",
+ "Processed prompts: 26%|██▌ | 26/100 [01:07<01:00, 1.22it/s, Generation Speed: 26.78 toks/s]\u001b[A\n",
+ "Processed prompts: 28%|██▊ | 28/100 [01:08<00:47, 1.52it/s, Generation Speed: 28.92 toks/s]\u001b[A\n",
+ "Processed prompts: 32%|███▏ | 32/100 [01:09<00:28, 2.41it/s, Generation Speed: 32.96 toks/s]\u001b[A\n",
+ "Processed prompts: 33%|███▎ | 33/100 [01:10<00:36, 1.85it/s, Generation Speed: 33.68 toks/s]\u001b[A\n",
+ "Processed prompts: 35%|███▌ | 35/100 [01:11<00:35, 1.82it/s, Generation Speed: 35.52 toks/s]\u001b[A\n",
+ "Processed prompts: 38%|███▊ | 38/100 [01:12<00:25, 2.47it/s, Generation Speed: 37.97 toks/s]\u001b[A\n",
+ "Processed prompts: 39%|███▉ | 39/100 [01:12<00:25, 2.39it/s, Generation Speed: 38.70 toks/s]\u001b[A\n",
+ "Processed prompts: 40%|████ | 40/100 [01:13<00:26, 2.31it/s, Generation Speed: 39.29 toks/s]\u001b[A\n",
+ "Processed prompts: 41%|████ | 41/100 [01:13<00:26, 2.26it/s, Generation Speed: 40.08 toks/s]\u001b[A\n",
+ "Processed prompts: 42%|████▏ | 42/100 [01:13<00:25, 2.26it/s, Generation Speed: 40.93 toks/s]\u001b[A\n",
+ "Processed prompts: 44%|████▍ | 44/100 [01:14<00:19, 2.85it/s, Generation Speed: 42.84 toks/s]\u001b[A\n",
+ "Processed prompts: 47%|████▋ | 47/100 [01:14<00:13, 3.94it/s, Generation Speed: 45.52 toks/s]\u001b[A\n",
+ "Processed prompts: 48%|████▊ | 48/100 [01:16<00:26, 1.96it/s, Generation Speed: 45.83 toks/s]\u001b[A\n",
+ "Processed prompts: 50%|█████ | 50/100 [01:16<00:20, 2.42it/s, Generation Speed: 47.76 toks/s]\u001b[A\n",
+ "Processed prompts: 52%|█████▏ | 52/100 [01:17<00:16, 2.88it/s, Generation Speed: 49.17 toks/s]\u001b[A\n",
+ "Processed prompts: 53%|█████▎ | 53/100 [01:17<00:16, 2.77it/s, Generation Speed: 49.79 toks/s]\u001b[A\n",
+ "Processed prompts: 55%|█████▌ | 55/100 [01:18<00:14, 3.21it/s, Generation Speed: 51.24 toks/s]\u001b[A\n",
+ "Processed prompts: 56%|█████▌ | 56/100 [01:18<00:14, 2.98it/s, Generation Speed: 52.00 toks/s]\u001b[A\n",
+ "Processed prompts: 57%|█████▋ | 57/100 [01:19<00:14, 2.88it/s, Generation Speed: 52.53 toks/s]\u001b[A\n",
+ "Processed prompts: 58%|█████▊ | 58/100 [01:19<00:14, 2.87it/s, Generation Speed: 53.32 toks/s]\u001b[A\n",
+ "Processed prompts: 61%|██████ | 61/100 [01:19<00:08, 4.33it/s, Generation Speed: 55.57 toks/s]\u001b[A\n",
+ "Processed prompts: 62%|██████▏ | 62/100 [01:20<00:09, 3.92it/s, Generation Speed: 56.29 toks/s]\u001b[A\n",
+ "Processed prompts: 65%|██████▌ | 65/100 [01:21<00:10, 3.36it/s, Generation Speed: 57.91 toks/s]\u001b[A\n",
+ "Processed prompts: 68%|██████▊ | 68/100 [01:21<00:07, 4.44it/s, Generation Speed: 60.14 toks/s]\u001b[A\n",
+ "Processed prompts: 70%|███████ | 70/100 [01:22<00:10, 2.98it/s, Generation Speed: 61.03 toks/s]\u001b[A\n",
+ "Processed prompts: 71%|███████ | 71/100 [01:23<00:09, 3.04it/s, Generation Speed: 61.75 toks/s]\u001b[A\n",
+ "Processed prompts: 72%|███████▏ | 72/100 [01:23<00:10, 2.68it/s, Generation Speed: 62.09 toks/s]\u001b[A\n",
+ "Processed prompts: 75%|███████▌ | 75/100 [01:24<00:08, 3.09it/s, Generation Speed: 63.86 toks/s]\u001b[A\n",
+ "Processed prompts: 76%|███████▌ | 76/100 [01:24<00:07, 3.16it/s, Generation Speed: 64.51 toks/s]\u001b[A\n",
+ "Processed prompts: 78%|███████▊ | 78/100 [01:25<00:06, 3.34it/s, Generation Speed: 65.70 toks/s]\u001b[A\n",
+ "Processed prompts: 79%|███████▉ | 79/100 [01:25<00:07, 2.63it/s, Generation Speed: 66.56 toks/s]\u001b[A\n",
+ "Processed prompts: 80%|████████ | 80/100 [01:26<00:06, 2.87it/s, Generation Speed: 67.29 toks/s]\u001b[A\n",
+ "Processed prompts: 81%|████████ | 81/100 [01:26<00:06, 2.72it/s, Generation Speed: 68.03 toks/s]\u001b[A\n",
+ "Processed prompts: 82%|████████▏ | 82/100 [01:26<00:05, 3.06it/s, Generation Speed: 68.75 toks/s]\u001b[A\n",
+ "Processed prompts: 84%|████████▍ | 84/100 [01:26<00:03, 4.28it/s, Generation Speed: 70.08 toks/s]\u001b[A\n",
+ "Processed prompts: 86%|████████▌ | 86/100 [01:27<00:02, 4.80it/s, Generation Speed: 71.51 toks/s]\u001b[A\n",
+ "Processed prompts: 87%|████████▋ | 87/100 [01:27<00:02, 5.01it/s, Generation Speed: 72.28 toks/s]\u001b[A\n",
+ "Processed prompts: 89%|████████▉ | 89/100 [01:27<00:01, 6.43it/s, Generation Speed: 73.68 toks/s]\u001b[A\n",
+ "Processed prompts: 91%|█████████ | 91/100 [01:28<00:01, 4.86it/s, Generation Speed: 75.70 toks/s]\u001b[A\n",
+ "Processed prompts: 93%|█████████▎| 93/100 [01:28<00:01, 6.36it/s, Generation Speed: 77.28 toks/s]\u001b[A\n",
+ "Processed prompts: 95%|█████████▌| 95/100 [01:28<00:00, 6.97it/s, Generation Speed: 78.81 toks/s]\u001b[A\n",
+ "Processed prompts: 96%|█████████▌| 96/100 [01:28<00:00, 6.34it/s, Generation Speed: 79.92 toks/s]\u001b[A\n",
+ "Processed prompts: 98%|█████████▊| 98/100 [01:29<00:00, 6.75it/s, Generation Speed: 81.49 toks/s]\u001b[A\n",
+ "Processed prompts: 100%|██████████| 100/100 [01:29<00:00, 1.12it/s, Generation Speed: 83.23 toks/s][A\n"
+ ]
+ },
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "313dedca02184a419c132d0c400507d7",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "Flattening the indices: 0%| | 0/100 [00:00, ? examples/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "Processed prompts: 0%| | 0/100 [00:00, ?it/s, Generation Speed: 0.00 toks/s]\u001b[A\n",
+ "Processed prompts: 1%| | 1/100 [00:35<58:52, 35.68s/it, Generation Speed: 1.71 toks/s]\u001b[A\n",
+ "Processed prompts: 4%|▍ | 4/100 [00:39<12:31, 7.83s/it, Generation Speed: 5.95 toks/s]\u001b[A\n",
+ "Processed prompts: 5%|▌ | 5/100 [00:42<09:59, 6.31s/it, Generation Speed: 7.04 toks/s]\u001b[A\n",
+ "Processed prompts: 6%|▌ | 6/100 [00:44<08:06, 5.18s/it, Generation Speed: 8.20 toks/s]\u001b[A\n",
+ "Processed prompts: 7%|▋ | 7/100 [00:45<06:04, 3.92s/it, Generation Speed: 9.38 toks/s]\u001b[A\n",
+ "Processed prompts: 9%|▉ | 9/100 [00:46<03:50, 2.53s/it, Generation Speed: 11.75 toks/s]\u001b[A\n",
+ "Processed prompts: 11%|█ | 11/100 [00:47<02:31, 1.71s/it, Generation Speed: 14.45 toks/s]\u001b[A\n",
+ "Processed prompts: 13%|█▎ | 13/100 [00:48<01:48, 1.25s/it, Generation Speed: 16.79 toks/s]\u001b[A\n",
+ "Processed prompts: 14%|█▍ | 14/100 [00:49<01:40, 1.17s/it, Generation Speed: 17.76 toks/s]\u001b[A\n",
+ "Processed prompts: 15%|█▌ | 15/100 [00:52<02:06, 1.49s/it, Generation Speed: 18.32 toks/s]\u001b[A\n",
+ "Processed prompts: 16%|█▌ | 16/100 [00:52<01:51, 1.33s/it, Generation Speed: 19.28 toks/s]\u001b[A\n",
+ "Processed prompts: 17%|█▋ | 17/100 [00:59<03:35, 2.60s/it, Generation Speed: 18.58 toks/s]\u001b[A\n",
+ "Processed prompts: 18%|█▊ | 18/100 [01:00<02:55, 2.14s/it, Generation Speed: 19.45 toks/s]\u001b[A\n",
+ "Processed prompts: 19%|█▉ | 19/100 [01:01<02:46, 2.05s/it, Generation Speed: 20.17 toks/s]\u001b[A\n",
+ "Processed prompts: 20%|██ | 20/100 [01:02<02:12, 1.66s/it, Generation Speed: 21.22 toks/s]\u001b[A\n",
+ "Processed prompts: 21%|██ | 21/100 [01:03<02:01, 1.53s/it, Generation Speed: 22.18 toks/s]\u001b[A\n",
+ "Processed prompts: 22%|██▏ | 22/100 [01:04<01:37, 1.25s/it, Generation Speed: 23.18 toks/s]\u001b[A\n",
+ "Processed prompts: 25%|██▌ | 25/100 [01:04<00:49, 1.51it/s, Generation Speed: 26.12 toks/s]\u001b[A\n",
+ "Processed prompts: 27%|██▋ | 27/100 [01:05<00:38, 1.89it/s, Generation Speed: 28.47 toks/s]\u001b[A\n",
+ "Processed prompts: 30%|███ | 30/100 [01:06<00:26, 2.60it/s, Generation Speed: 31.55 toks/s]\u001b[A\n",
+ "Processed prompts: 32%|███▏ | 32/100 [01:06<00:24, 2.80it/s, Generation Speed: 33.30 toks/s]\u001b[A\n",
+ "Processed prompts: 33%|███▎ | 33/100 [01:07<00:33, 2.01it/s, Generation Speed: 33.79 toks/s]\u001b[A\n",
+ "Processed prompts: 34%|███▍ | 34/100 [01:08<00:33, 1.96it/s, Generation Speed: 34.59 toks/s]\u001b[A\n",
+ "Processed prompts: 35%|███▌ | 35/100 [01:08<00:33, 1.92it/s, Generation Speed: 35.25 toks/s]\u001b[A\n",
+ "Processed prompts: 36%|███▌ | 36/100 [01:09<00:33, 1.89it/s, Generation Speed: 36.20 toks/s]\u001b[A\n",
+ "Processed prompts: 37%|███▋ | 37/100 [01:09<00:33, 1.89it/s, Generation Speed: 36.91 toks/s]\u001b[A\n",
+ "Processed prompts: 39%|███▉ | 39/100 [01:10<00:25, 2.40it/s, Generation Speed: 38.30 toks/s]\u001b[A\n",
+ "Processed prompts: 40%|████ | 40/100 [01:10<00:25, 2.31it/s, Generation Speed: 39.23 toks/s]\u001b[A\n",
+ "Processed prompts: 41%|████ | 41/100 [01:11<00:33, 1.76it/s, Generation Speed: 39.84 toks/s]\u001b[A\n",
+ "Processed prompts: 46%|████▌ | 46/100 [01:12<00:14, 3.77it/s, Generation Speed: 44.35 toks/s]\u001b[A\n",
+ "Processed prompts: 48%|████▊ | 48/100 [01:12<00:13, 3.90it/s, Generation Speed: 45.77 toks/s]\u001b[A\n",
+ "Processed prompts: 49%|████▉ | 49/100 [01:13<00:14, 3.48it/s, Generation Speed: 46.78 toks/s]\u001b[A\n",
+ "Processed prompts: 50%|█████ | 50/100 [01:13<00:15, 3.21it/s, Generation Speed: 47.50 toks/s]\u001b[A\n",
+ "Processed prompts: 51%|█████ | 51/100 [01:14<00:16, 3.01it/s, Generation Speed: 48.16 toks/s]\u001b[A\n",
+ "Processed prompts: 52%|█████▏ | 52/100 [01:14<00:21, 2.27it/s, Generation Speed: 48.56 toks/s]\u001b[A\n",
+ "Processed prompts: 53%|█████▎ | 53/100 [01:15<00:24, 1.90it/s, Generation Speed: 49.10 toks/s]\u001b[A\n",
+ "Processed prompts: 54%|█████▍ | 54/100 [01:16<00:22, 2.03it/s, Generation Speed: 49.65 toks/s]\u001b[A\n",
+ "Processed prompts: 56%|█████▌ | 56/100 [01:16<00:16, 2.74it/s, Generation Speed: 51.29 toks/s]\u001b[A\n",
+ "Processed prompts: 58%|█████▊ | 58/100 [01:17<00:15, 2.65it/s, Generation Speed: 52.81 toks/s]\u001b[A\n",
+ "Processed prompts: 59%|█████▉ | 59/100 [01:17<00:15, 2.63it/s, Generation Speed: 53.41 toks/s]\u001b[A\n",
+ "Processed prompts: 60%|██████ | 60/100 [01:18<00:18, 2.13it/s, Generation Speed: 53.86 toks/s]\u001b[A\n",
+ "Processed prompts: 62%|██████▏ | 62/100 [01:19<00:16, 2.35it/s, Generation Speed: 55.26 toks/s]\u001b[A\n",
+ "Processed prompts: 63%|██████▎ | 63/100 [01:19<00:15, 2.45it/s, Generation Speed: 55.90 toks/s]\u001b[A\n",
+ "Processed prompts: 64%|██████▍ | 64/100 [01:19<00:14, 2.54it/s, Generation Speed: 56.52 toks/s]\u001b[A\n",
+ "Processed prompts: 65%|██████▌ | 65/100 [01:20<00:13, 2.62it/s, Generation Speed: 57.04 toks/s]\u001b[A\n",
+ "Processed prompts: 66%|██████▌ | 66/100 [01:20<00:12, 2.68it/s, Generation Speed: 58.05 toks/s]\u001b[A\n",
+ "Processed prompts: 68%|██████▊ | 68/100 [01:21<00:11, 2.81it/s, Generation Speed: 59.16 toks/s]\u001b[A\n",
+ "Processed prompts: 69%|██████▉ | 69/100 [01:21<00:10, 2.91it/s, Generation Speed: 59.68 toks/s]\u001b[A\n",
+ "Processed prompts: 70%|███████ | 70/100 [01:21<00:09, 3.04it/s, Generation Speed: 60.50 toks/s]\u001b[A\n",
+ "Processed prompts: 72%|███████▏ | 72/100 [01:22<00:06, 4.03it/s, Generation Speed: 62.17 toks/s]\u001b[A\n",
+ "Processed prompts: 74%|███████▍ | 74/100 [01:22<00:06, 3.75it/s, Generation Speed: 63.42 toks/s]\u001b[A\n",
+ "Processed prompts: 76%|███████▌ | 76/100 [01:23<00:07, 3.24it/s, Generation Speed: 64.56 toks/s]\u001b[A\n",
+ "Processed prompts: 79%|███████▉ | 79/100 [01:23<00:05, 4.12it/s, Generation Speed: 66.59 toks/s]\u001b[A\n",
+ "Processed prompts: 81%|████████ | 81/100 [01:24<00:03, 4.94it/s, Generation Speed: 68.17 toks/s]\u001b[A\n",
+ "Processed prompts: 83%|████████▎ | 83/100 [01:24<00:02, 5.87it/s, Generation Speed: 69.77 toks/s]\u001b[A\n",
+ "Processed prompts: 85%|████████▌ | 85/100 [01:24<00:02, 6.75it/s, Generation Speed: 71.43 toks/s]\u001b[A\n",
+ "Processed prompts: 86%|████████▌ | 86/100 [01:25<00:03, 3.89it/s, Generation Speed: 71.70 toks/s]\u001b[A\n",
+ "Processed prompts: 87%|████████▋ | 87/100 [01:25<00:03, 3.56it/s, Generation Speed: 72.29 toks/s]\u001b[A\n",
+ "Processed prompts: 88%|████████▊ | 88/100 [01:26<00:03, 3.06it/s, Generation Speed: 72.75 toks/s]\u001b[A\n",
+ "Processed prompts: 91%|█████████ | 91/100 [01:26<00:01, 5.15it/s, Generation Speed: 75.68 toks/s]\u001b[A\n",
+ "Processed prompts: 92%|█████████▏| 92/100 [01:26<00:01, 4.75it/s, Generation Speed: 76.21 toks/s]\u001b[A\n",
+ "Processed prompts: 93%|█████████▎| 93/100 [01:26<00:01, 5.18it/s, Generation Speed: 77.29 toks/s]\u001b[A\n",
+ "Processed prompts: 96%|█████████▌| 96/100 [01:27<00:00, 6.97it/s, Generation Speed: 79.64 toks/s]\u001b[A\n",
+ "Processed prompts: 100%|██████████| 100/100 [01:31<00:00, 1.09it/s, Generation Speed: 79.51 toks/s]\u001b[A\n"
+ ]
+ },
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "a74c464d5b044bf8829e5685c0f5f9a5",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "Flattening the indices: 0%| | 0/100 [00:00, ? examples/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "Processed prompts: 0%| | 0/100 [00:00, ?it/s, Generation Speed: 0.00 toks/s]\u001b[A\n",
+ "Processed prompts: 1%| | 1/100 [00:35<58:17, 35.33s/it, Generation Speed: 1.73 toks/s]\u001b[A\n",
+ "Processed prompts: 2%|▏ | 2/100 [00:38<26:49, 16.43s/it, Generation Speed: 3.14 toks/s]\u001b[A\n",
+ "Processed prompts: 3%|▎ | 3/100 [00:40<16:14, 10.04s/it, Generation Speed: 4.56 toks/s]\u001b[A\n",
+ "Processed prompts: 4%|▍ | 4/100 [00:44<11:48, 7.38s/it, Generation Speed: 5.78 toks/s]\u001b[A\n",
+ "Processed prompts: 7%|▋ | 7/100 [00:46<05:05, 3.28s/it, Generation Speed: 9.58 toks/s]\u001b[A\n",
+ "Processed prompts: 8%|▊ | 8/100 [00:49<04:47, 3.12s/it, Generation Speed: 10.58 toks/s]\u001b[A\n",
+ "Processed prompts: 9%|▉ | 9/100 [00:50<03:53, 2.56s/it, Generation Speed: 11.83 toks/s]\u001b[A\n",
+ "Processed prompts: 13%|█▎ | 13/100 [00:51<01:53, 1.31s/it, Generation Speed: 16.08 toks/s]\u001b[A\n",
+ "Processed prompts: 14%|█▍ | 14/100 [00:52<01:45, 1.23s/it, Generation Speed: 16.97 toks/s]\u001b[A\n",
+ "Processed prompts: 15%|█▌ | 15/100 [00:54<01:53, 1.33s/it, Generation Speed: 17.77 toks/s]\u001b[A\n",
+ "Processed prompts: 17%|█▋ | 17/100 [00:55<01:22, 1.00it/s, Generation Speed: 19.93 toks/s]\u001b[A\n",
+ "Processed prompts: 19%|█▉ | 19/100 [00:56<01:04, 1.26it/s, Generation Speed: 22.15 toks/s]\u001b[A\n",
+ "Processed prompts: 20%|██ | 20/100 [00:57<01:17, 1.04it/s, Generation Speed: 22.94 toks/s]\u001b[A\n",
+ "Processed prompts: 21%|██ | 21/100 [00:58<01:14, 1.07it/s, Generation Speed: 23.81 toks/s]\u001b[A\n",
+ "Processed prompts: 23%|██▎ | 23/100 [00:59<00:56, 1.35it/s, Generation Speed: 25.74 toks/s]\u001b[A\n",
+ "Processed prompts: 24%|██▍ | 24/100 [01:01<01:11, 1.06it/s, Generation Speed: 26.17 toks/s]\u001b[A\n",
+ "Processed prompts: 25%|██▌ | 25/100 [01:01<01:07, 1.11it/s, Generation Speed: 27.17 toks/s]\u001b[A\n",
+ "Processed prompts: 26%|██▌ | 26/100 [01:02<01:01, 1.21it/s, Generation Speed: 27.87 toks/s]\u001b[A\n",
+ "Processed prompts: 27%|██▋ | 27/100 [01:03<01:07, 1.08it/s, Generation Speed: 28.18 toks/s]\u001b[A\n",
+ "Processed prompts: 28%|██▊ | 28/100 [01:04<01:00, 1.19it/s, Generation Speed: 29.02 toks/s]\u001b[A\n",
+ "Processed prompts: 30%|███ | 30/100 [01:05<00:51, 1.35it/s, Generation Speed: 30.59 toks/s]\u001b[A\n",
+ "Processed prompts: 31%|███ | 31/100 [01:06<00:48, 1.42it/s, Generation Speed: 31.39 toks/s]\u001b[A\n",
+ "Processed prompts: 32%|███▏ | 32/100 [01:07<01:05, 1.04it/s, Generation Speed: 31.90 toks/s]\u001b[A\n",
+ "Processed prompts: 34%|███▍ | 34/100 [01:08<00:44, 1.48it/s, Generation Speed: 33.70 toks/s]\u001b[A\n",
+ "Processed prompts: 35%|███▌ | 35/100 [01:09<00:49, 1.31it/s, Generation Speed: 34.21 toks/s]\u001b[A\n",
+ "Processed prompts: 37%|███▋ | 37/100 [01:10<00:35, 1.77it/s, Generation Speed: 35.81 toks/s]\u001b[A\n",
+ "Processed prompts: 39%|███▉ | 39/100 [01:11<00:32, 1.86it/s, Generation Speed: 37.42 toks/s]\u001b[A\n",
+ "Processed prompts: 41%|████ | 41/100 [01:11<00:25, 2.31it/s, Generation Speed: 39.38 toks/s]\u001b[A\n",
+ "Processed prompts: 47%|████▋ | 47/100 [01:12<00:13, 3.84it/s, Generation Speed: 44.66 toks/s]\u001b[A\n",
+ "Processed prompts: 49%|████▉ | 49/100 [01:13<00:15, 3.36it/s, Generation Speed: 46.15 toks/s]\u001b[A\n",
+ "Processed prompts: 50%|█████ | 50/100 [01:14<00:18, 2.70it/s, Generation Speed: 46.66 toks/s]\u001b[A\n",
+ "Processed prompts: 51%|█████ | 51/100 [01:14<00:18, 2.64it/s, Generation Speed: 47.37 toks/s]\u001b[A\n",
+ "Processed prompts: 52%|█████▏ | 52/100 [01:15<00:26, 1.79it/s, Generation Speed: 47.73 toks/s]\u001b[A\n",
+ "Processed prompts: 53%|█████▎ | 53/100 [01:16<00:29, 1.61it/s, Generation Speed: 48.33 toks/s]\u001b[A\n",
+ "Processed prompts: 55%|█████▌ | 55/100 [01:17<00:27, 1.61it/s, Generation Speed: 49.34 toks/s]\u001b[A\n",
+ "Processed prompts: 56%|█████▌ | 56/100 [01:18<00:25, 1.72it/s, Generation Speed: 50.16 toks/s]\u001b[A\n",
+ "Processed prompts: 59%|█████▉ | 59/100 [01:19<00:20, 2.03it/s, Generation Speed: 52.09 toks/s]\u001b[A\n",
+ "Processed prompts: 60%|██████ | 60/100 [01:19<00:18, 2.12it/s, Generation Speed: 53.35 toks/s]\u001b[A\n",
+ "Processed prompts: 63%|██████▎ | 63/100 [01:20<00:11, 3.15it/s, Generation Speed: 55.82 toks/s]\u001b[A\n",
+ "Processed prompts: 65%|██████▌ | 65/100 [01:21<00:13, 2.67it/s, Generation Speed: 56.91 toks/s]\u001b[A\n",
+ "Processed prompts: 68%|██████▊ | 68/100 [01:21<00:08, 3.71it/s, Generation Speed: 59.13 toks/s]\u001b[A\n",
+ "Processed prompts: 70%|███████ | 70/100 [01:22<00:08, 3.61it/s, Generation Speed: 60.37 toks/s]\u001b[A\n",
+ "Processed prompts: 72%|███████▏ | 72/100 [01:22<00:07, 3.62it/s, Generation Speed: 61.96 toks/s]\u001b[A\n",
+ "Processed prompts: 75%|███████▌ | 75/100 [01:23<00:05, 4.82it/s, Generation Speed: 64.40 toks/s]\u001b[A\n",
+ "Processed prompts: 78%|███████▊ | 78/100 [01:23<00:04, 5.27it/s, Generation Speed: 66.59 toks/s]\u001b[A\n",
+ "Processed prompts: 79%|███████▉ | 79/100 [01:23<00:04, 5.07it/s, Generation Speed: 67.34 toks/s]\u001b[A\n",
+ "Processed prompts: 81%|████████ | 81/100 [01:24<00:03, 4.86it/s, Generation Speed: 68.93 toks/s]\u001b[A\n",
+ "Processed prompts: 83%|████████▎ | 83/100 [01:24<00:02, 5.72it/s, Generation Speed: 70.29 toks/s]\u001b[A\n",
+ "Processed prompts: 84%|████████▍ | 84/100 [01:24<00:02, 5.62it/s, Generation Speed: 70.96 toks/s]\u001b[A\n",
+ "Processed prompts: 87%|████████▋ | 87/100 [01:24<00:01, 6.51it/s, Generation Speed: 73.07 toks/s]\u001b[A\n",
+ "Processed prompts: 88%|████████▊ | 88/100 [01:25<00:02, 4.66it/s, Generation Speed: 74.03 toks/s]\u001b[A\n",
+ "Processed prompts: 89%|████████▉ | 89/100 [01:25<00:02, 4.30it/s, Generation Speed: 74.75 toks/s]\u001b[A\n",
+ "Processed prompts: 91%|█████████ | 91/100 [01:25<00:01, 5.77it/s, Generation Speed: 76.40 toks/s]\u001b[A\n",
+ "Processed prompts: 92%|█████████▏| 92/100 [01:26<00:01, 6.05it/s, Generation Speed: 77.10 toks/s]\u001b[A\n",
+ "Processed prompts: 94%|█████████▍| 94/100 [01:26<00:00, 7.81it/s, Generation Speed: 78.52 toks/s]\u001b[A\n",
+ "Processed prompts: 96%|█████████▌| 96/100 [01:26<00:00, 4.46it/s, Generation Speed: 79.58 toks/s]\u001b[A\n",
+ "Processed prompts: 98%|█████████▊| 98/100 [01:27<00:00, 5.58it/s, Generation Speed: 81.25 toks/s]\u001b[A\n",
+ "Processed prompts: 99%|█████████▉| 99/100 [01:27<00:00, 4.42it/s, Generation Speed: 81.90 toks/s]\u001b[A\n",
+ "Processed prompts: 100%|██████████| 100/100 [01:27<00:00, 1.14it/s, Generation Speed: 82.70 toks/s]\u001b[A\n"
+ ]
+ },
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "e423bb10bcaa4d88a259a4d3f0e63564",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "Flattening the indices: 0%| | 0/100 [00:00, ? examples/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "Processed prompts: 0%| | 0/100 [00:00, ?it/s, Generation Speed: 0.00 toks/s]\u001b[A\n",
+ "Processed prompts: 1%| | 1/100 [00:34<56:53, 34.48s/it, Generation Speed: 1.62 toks/s]\u001b[A\n",
+ "Processed prompts: 2%|▏ | 2/100 [00:36<24:45, 15.15s/it, Generation Speed: 3.27 toks/s]\u001b[A\n",
+ "Processed prompts: 3%|▎ | 3/100 [00:41<17:31, 10.84s/it, Generation Speed: 4.33 toks/s]\u001b[A\n",
+ "Processed prompts: 5%|▌ | 5/100 [00:42<07:48, 4.93s/it, Generation Speed: 7.04 toks/s]\u001b[A\n",
+ "Processed prompts: 6%|▌ | 6/100 [00:43<05:52, 3.74s/it, Generation Speed: 8.29 toks/s]\u001b[A\n",
+ "Processed prompts: 7%|▋ | 7/100 [00:44<04:29, 2.89s/it, Generation Speed: 9.42 toks/s]\u001b[A\n",
+ "Processed prompts: 8%|▊ | 8/100 [00:45<03:30, 2.29s/it, Generation Speed: 10.31 toks/s]\u001b[A\n",
+ "Processed prompts: 9%|▉ | 9/100 [00:48<03:55, 2.59s/it, Generation Speed: 11.10 toks/s]\u001b[A\n",
+ "Processed prompts: 11%|█ | 11/100 [00:49<02:21, 1.59s/it, Generation Speed: 13.85 toks/s]\u001b[A\n",
+ "Processed prompts: 13%|█▎ | 13/100 [00:50<01:38, 1.13s/it, Generation Speed: 16.08 toks/s]\u001b[A\n",
+ "Processed prompts: 14%|█▍ | 14/100 [00:50<01:31, 1.06s/it, Generation Speed: 17.35 toks/s]\u001b[A\n",
+ "Processed prompts: 16%|█▌ | 16/100 [00:51<01:07, 1.24it/s, Generation Speed: 19.59 toks/s]\u001b[A\n",
+ "Processed prompts: 17%|█▋ | 17/100 [00:53<01:23, 1.00s/it, Generation Speed: 20.22 toks/s]\u001b[A\n",
+ "Processed prompts: 18%|█▊ | 18/100 [00:56<01:53, 1.39s/it, Generation Speed: 20.56 toks/s]\u001b[A\n",
+ "Processed prompts: 19%|█▉ | 19/100 [00:56<01:42, 1.26s/it, Generation Speed: 21.22 toks/s]\u001b[A\n",
+ "Processed prompts: 20%|██ | 20/100 [00:57<01:33, 1.16s/it, Generation Speed: 21.89 toks/s]\u001b[A\n",
+ "Processed prompts: 21%|██ | 21/100 [00:58<01:26, 1.09s/it, Generation Speed: 22.46 toks/s]\u001b[A\n",
+ "Processed prompts: 22%|██▏ | 22/100 [01:00<01:38, 1.26s/it, Generation Speed: 23.33 toks/s]\u001b[A\n",
+ "Processed prompts: 24%|██▍ | 24/100 [01:01<01:06, 1.14it/s, Generation Speed: 25.46 toks/s]\u001b[A\n",
+ "Processed prompts: 25%|██▌ | 25/100 [01:02<01:04, 1.17it/s, Generation Speed: 26.51 toks/s]\u001b[A\n",
+ "Processed prompts: 28%|██▊ | 28/100 [01:02<00:37, 1.94it/s, Generation Speed: 29.67 toks/s]\u001b[A\n",
+ "Processed prompts: 29%|██▉ | 29/100 [01:04<00:52, 1.34it/s, Generation Speed: 29.87 toks/s]\u001b[A\n",
+ "Processed prompts: 30%|███ | 30/100 [01:04<00:49, 1.42it/s, Generation Speed: 30.75 toks/s]\u001b[A\n",
+ "Processed prompts: 32%|███▏ | 32/100 [01:05<00:36, 1.87it/s, Generation Speed: 32.95 toks/s]\u001b[A\n",
+ "Processed prompts: 37%|███▋ | 37/100 [01:06<00:25, 2.47it/s, Generation Speed: 37.30 toks/s]\u001b[A\n",
+ "Processed prompts: 38%|███▊ | 38/100 [01:07<00:26, 2.37it/s, Generation Speed: 38.21 toks/s]\u001b[A\n",
+ "Processed prompts: 39%|███▉ | 39/100 [01:07<00:26, 2.27it/s, Generation Speed: 38.83 toks/s]\u001b[A\n",
+ "Processed prompts: 40%|████ | 40/100 [01:08<00:27, 2.20it/s, Generation Speed: 39.32 toks/s]\u001b[A\n",
+ "Processed prompts: 41%|████ | 41/100 [01:08<00:27, 2.18it/s, Generation Speed: 40.11 toks/s]\u001b[A\n",
+ "Processed prompts: 43%|████▎ | 43/100 [01:09<00:21, 2.68it/s, Generation Speed: 41.99 toks/s]\u001b[A\n",
+ "Processed prompts: 44%|████▍ | 44/100 [01:09<00:22, 2.50it/s, Generation Speed: 42.85 toks/s]\u001b[A\n",
+ "Processed prompts: 45%|████▌ | 45/100 [01:10<00:22, 2.41it/s, Generation Speed: 43.72 toks/s]\u001b[A\n",
+ "Processed prompts: 46%|████▌ | 46/100 [01:10<00:22, 2.35it/s, Generation Speed: 44.42 toks/s]\u001b[A\n",
+ "Processed prompts: 47%|████▋ | 47/100 [01:11<00:22, 2.31it/s, Generation Speed: 45.05 toks/s]\u001b[A\n",
+ "Processed prompts: 48%|████▊ | 48/100 [01:12<00:35, 1.47it/s, Generation Speed: 45.14 toks/s]\u001b[A\n",
+ "Processed prompts: 49%|████▉ | 49/100 [01:13<00:31, 1.64it/s, Generation Speed: 46.21 toks/s]\u001b[A\n",
+ "Processed prompts: 50%|█████ | 50/100 [01:13<00:27, 1.80it/s, Generation Speed: 46.94 toks/s]\u001b[A\n",
+ "Processed prompts: 52%|█████▏ | 52/100 [01:14<00:23, 2.04it/s, Generation Speed: 48.45 toks/s]\u001b[A\n",
+ "Processed prompts: 53%|█████▎ | 53/100 [01:15<00:26, 1.74it/s, Generation Speed: 48.99 toks/s]\u001b[A\n",
+ "Processed prompts: 55%|█████▌ | 55/100 [01:15<00:23, 1.95it/s, Generation Speed: 50.24 toks/s]\u001b[A\n",
+ "Processed prompts: 56%|█████▌ | 56/100 [01:16<00:21, 2.04it/s, Generation Speed: 50.89 toks/s]\u001b[A\n",
+ "Processed prompts: 57%|█████▋ | 57/100 [01:16<00:20, 2.13it/s, Generation Speed: 51.76 toks/s]\u001b[A\n",
+ "Processed prompts: 58%|█████▊ | 58/100 [01:17<00:23, 1.80it/s, Generation Speed: 52.02 toks/s]\u001b[A\n",
+ "Processed prompts: 59%|█████▉ | 59/100 [01:17<00:20, 1.96it/s, Generation Speed: 52.84 toks/s]\u001b[A\n",
+ "Processed prompts: 61%|██████ | 61/100 [01:18<00:17, 2.22it/s, Generation Speed: 54.06 toks/s]\u001b[A\n",
+ "Processed prompts: 62%|██████▏ | 62/100 [01:19<00:16, 2.33it/s, Generation Speed: 54.64 toks/s]\u001b[A\n",
+ "Processed prompts: 63%|██████▎ | 63/100 [01:19<00:15, 2.41it/s, Generation Speed: 55.33 toks/s]\u001b[A\n",
+ "Processed prompts: 64%|██████▍ | 64/100 [01:20<00:18, 1.99it/s, Generation Speed: 55.72 toks/s]\u001b[A\n",
+ "Processed prompts: 66%|██████▌ | 66/100 [01:20<00:12, 2.79it/s, Generation Speed: 57.21 toks/s]\u001b[A\n",
+ "Processed prompts: 67%|██████▋ | 67/100 [01:20<00:11, 2.89it/s, Generation Speed: 57.63 toks/s]\u001b[A\n",
+ "Processed prompts: 68%|██████▊ | 68/100 [01:21<00:10, 3.00it/s, Generation Speed: 58.23 toks/s]\u001b[A\n",
+ "Processed prompts: 70%|███████ | 70/100 [01:21<00:07, 3.96it/s, Generation Speed: 59.78 toks/s]\u001b[A\n",
+ "Processed prompts: 73%|███████▎ | 73/100 [01:21<00:04, 5.50it/s, Generation Speed: 61.97 toks/s]\u001b[A\n",
+ "Processed prompts: 74%|███████▍ | 74/100 [01:22<00:05, 4.98it/s, Generation Speed: 62.71 toks/s]\u001b[A\n",
+ "Processed prompts: 75%|███████▌ | 75/100 [01:22<00:05, 4.69it/s, Generation Speed: 63.60 toks/s]\u001b[A\n",
+ "Processed prompts: 77%|███████▋ | 77/100 [01:22<00:05, 4.39it/s, Generation Speed: 64.91 toks/s]\u001b[A\n",
+ "Processed prompts: 78%|███████▊ | 78/100 [01:23<00:05, 4.34it/s, Generation Speed: 65.62 toks/s]\u001b[A\n",
+ "Processed prompts: 79%|███████▉ | 79/100 [01:23<00:06, 3.44it/s, Generation Speed: 66.22 toks/s]\u001b[A\n",
+ "Processed prompts: 80%|████████ | 80/100 [01:23<00:06, 2.98it/s, Generation Speed: 66.92 toks/s]\u001b[A\n",
+ "Processed prompts: 82%|████████▏ | 82/100 [01:24<00:05, 3.50it/s, Generation Speed: 68.65 toks/s]\u001b[A\n",
+ "Processed prompts: 84%|████████▍ | 84/100 [01:24<00:04, 3.95it/s, Generation Speed: 70.35 toks/s]\u001b[A\n",
+ "Processed prompts: 88%|████████▊ | 88/100 [01:24<00:01, 6.89it/s, Generation Speed: 73.40 toks/s]\u001b[A\n",
+ "Processed prompts: 89%|████████▉ | 89/100 [01:25<00:01, 5.75it/s, Generation Speed: 73.88 toks/s]\u001b[A\n",
+ "Processed prompts: 90%|█████████ | 90/100 [01:25<00:02, 4.98it/s, Generation Speed: 74.43 toks/s]\u001b[A\n",
+ "Processed prompts: 91%|█████████ | 91/100 [01:25<00:01, 4.70it/s, Generation Speed: 74.99 toks/s]\u001b[A\n",
+ "Processed prompts: 92%|█████████▏| 92/100 [01:26<00:01, 5.23it/s, Generation Speed: 75.88 toks/s]\u001b[A\n",
+ "Processed prompts: 95%|█████████▌| 95/100 [01:26<00:00, 7.43it/s, Generation Speed: 78.29 toks/s]\u001b[A\n",
+ "Processed prompts: 96%|█████████▌| 96/100 [01:26<00:00, 5.83it/s, Generation Speed: 78.96 toks/s]\u001b[A\n",
+ "Processed prompts: 97%|█████████▋| 97/100 [01:26<00:00, 6.36it/s, Generation Speed: 80.01 toks/s]\u001b[A\n",
+ "Processed prompts: 98%|█████████▊| 98/100 [01:27<00:00, 4.03it/s, Generation Speed: 80.47 toks/s]\u001b[A\n",
+ "Processed prompts: 99%|█████████▉| 99/100 [01:27<00:00, 3.19it/s, Generation Speed: 81.10 toks/s]\u001b[A\n",
+ "Processed prompts: 100%|██████████| 100/100 [01:27<00:00, 1.14it/s, Generation Speed: 81.90 toks/s]\u001b[A\n"
+ ]
+ },
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "333c59bbe9a34c8c8f167978b055b16e",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "Flattening the indices: 0%| | 0/100 [00:00, ? examples/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "Processed prompts: 0%| | 0/100 [00:00, ?it/s, Generation Speed: 0.00 toks/s]\u001b[A\n",
+ "Processed prompts: 1%| | 1/100 [00:33<56:03, 33.98s/it, Generation Speed: 1.65 toks/s]\u001b[A\n",
+ "Processed prompts: 2%|▏ | 2/100 [00:38<27:26, 16.80s/it, Generation Speed: 3.12 toks/s]\u001b[A\n",
+ "Processed prompts: 3%|▎ | 3/100 [00:43<18:31, 11.45s/it, Generation Speed: 4.29 toks/s]\u001b[A\n",
+ "Processed prompts: 4%|▍ | 4/100 [00:47<13:20, 8.34s/it, Generation Speed: 5.44 toks/s]\u001b[A\n",
+ "Processed prompts: 5%|▌ | 5/100 [00:49<09:27, 5.97s/it, Generation Speed: 6.51 toks/s]\u001b[A\n",
+ "Processed prompts: 6%|▌ | 6/100 [00:50<07:06, 4.53s/it, Generation Speed: 7.52 toks/s]\u001b[A\n",
+ "Processed prompts: 7%|▋ | 7/100 [00:52<05:37, 3.63s/it, Generation Speed: 8.48 toks/s]\u001b[A\n",
+ "Processed prompts: 9%|▉ | 9/100 [00:53<03:10, 2.09s/it, Generation Speed: 10.82 toks/s]\u001b[A\n",
+ "Processed prompts: 10%|█ | 10/100 [00:55<03:00, 2.01s/it, Generation Speed: 11.51 toks/s]\u001b[A\n",
+ "Processed prompts: 11%|█ | 11/100 [00:56<02:32, 1.71s/it, Generation Speed: 12.66 toks/s]\u001b[A\n",
+ "Processed prompts: 12%|█▏ | 12/100 [00:57<02:11, 1.49s/it, Generation Speed: 13.84 toks/s]\u001b[A\n",
+ "Processed prompts: 13%|█▎ | 13/100 [00:58<01:55, 1.32s/it, Generation Speed: 15.02 toks/s]\u001b[A\n",
+ "Processed prompts: 14%|█▍ | 14/100 [00:58<01:43, 1.20s/it, Generation Speed: 15.88 toks/s]\u001b[A\n",
+ "Processed prompts: 16%|█▌ | 16/100 [00:59<01:11, 1.17it/s, Generation Speed: 17.98 toks/s]\u001b[A\n",
+ "Processed prompts: 17%|█▋ | 17/100 [01:01<01:29, 1.08s/it, Generation Speed: 18.75 toks/s]\u001b[A\n",
+ "Processed prompts: 19%|█▉ | 19/100 [01:03<01:16, 1.06it/s, Generation Speed: 20.85 toks/s]\u001b[A\n",
+ "Processed prompts: 22%|██▏ | 22/100 [01:03<00:46, 1.68it/s, Generation Speed: 24.00 toks/s]\u001b[A\n",
+ "Processed prompts: 23%|██▎ | 23/100 [01:04<00:46, 1.67it/s, Generation Speed: 25.23 toks/s]\u001b[A\n",
+ "Processed prompts: 26%|██▌ | 26/100 [01:05<00:37, 1.99it/s, Generation Speed: 28.01 toks/s]\u001b[A\n",
+ "Processed prompts: 29%|██▉ | 29/100 [01:06<00:26, 2.64it/s, Generation Speed: 31.07 toks/s]\u001b[A\n",
+ "Processed prompts: 32%|███▏ | 32/100 [01:06<00:21, 3.21it/s, Generation Speed: 34.49 toks/s]\u001b[A\n",
+ "Processed prompts: 33%|███▎ | 33/100 [01:07<00:23, 2.84it/s, Generation Speed: 35.12 toks/s]\u001b[A\n",
+ "Processed prompts: 35%|███▌ | 35/100 [01:07<00:21, 3.00it/s, Generation Speed: 36.88 toks/s]\u001b[A\n",
+ "Processed prompts: 37%|███▋ | 37/100 [01:08<00:20, 3.14it/s, Generation Speed: 38.66 toks/s]\u001b[A\n",
+ "Processed prompts: 38%|███▊ | 38/100 [01:08<00:21, 2.82it/s, Generation Speed: 39.50 toks/s]\u001b[A\n",
+ "Processed prompts: 40%|████ | 40/100 [01:09<00:19, 3.07it/s, Generation Speed: 41.04 toks/s]\u001b[A\n",
+ "Processed prompts: 41%|████ | 41/100 [01:09<00:21, 2.75it/s, Generation Speed: 41.86 toks/s]\u001b[A\n",
+ "Processed prompts: 42%|████▏ | 42/100 [01:10<00:28, 2.03it/s, Generation Speed: 42.62 toks/s]\u001b[A\n",
+ "Processed prompts: 43%|████▎ | 43/100 [01:11<00:27, 2.09it/s, Generation Speed: 43.49 toks/s]\u001b[A\n",
+ "Processed prompts: 45%|████▌ | 45/100 [01:11<00:20, 2.68it/s, Generation Speed: 45.21 toks/s]\u001b[A\n",
+ "Processed prompts: 46%|████▌ | 46/100 [01:12<00:20, 2.62it/s, Generation Speed: 46.16 toks/s]\u001b[A\n",
+ "Processed prompts: 48%|████▊ | 48/100 [01:12<00:15, 3.26it/s, Generation Speed: 47.83 toks/s]\u001b[A\n",
+ "Processed prompts: 50%|█████ | 50/100 [01:13<00:20, 2.41it/s, Generation Speed: 48.81 toks/s]\u001b[A\n",
+ "Processed prompts: 52%|█████▏ | 52/100 [01:16<00:35, 1.37it/s, Generation Speed: 48.66 toks/s]\u001b[A\n",
+ "Processed prompts: 53%|█████▎ | 53/100 [01:17<00:35, 1.32it/s, Generation Speed: 49.01 toks/s]\u001b[A\n",
+ "Processed prompts: 55%|█████▌ | 55/100 [01:18<00:27, 1.63it/s, Generation Speed: 50.43 toks/s]\u001b[A\n",
+ "Processed prompts: 57%|█████▋ | 57/100 [01:18<00:20, 2.13it/s, Generation Speed: 51.95 toks/s]\u001b[A\n",
+ "Processed prompts: 61%|██████ | 61/100 [01:19<00:12, 3.00it/s, Generation Speed: 55.09 toks/s]\u001b[A\n",
+ "Processed prompts: 62%|██████▏ | 62/100 [01:19<00:12, 2.98it/s, Generation Speed: 56.03 toks/s]\u001b[A\n",
+ "Processed prompts: 63%|██████▎ | 63/100 [01:19<00:12, 2.95it/s, Generation Speed: 56.65 toks/s]\u001b[A\n",
+ "Processed prompts: 65%|██████▌ | 65/100 [01:20<00:10, 3.49it/s, Generation Speed: 57.79 toks/s]\u001b[A\n",
+ "Processed prompts: 66%|██████▌ | 66/100 [01:20<00:10, 3.35it/s, Generation Speed: 58.32 toks/s]\u001b[A\n",
+ "Processed prompts: 67%|██████▋ | 67/100 [01:21<00:12, 2.67it/s, Generation Speed: 58.78 toks/s]\u001b[A\n",
+ "Processed prompts: 68%|██████▊ | 68/100 [01:21<00:11, 2.75it/s, Generation Speed: 59.43 toks/s]\u001b[A\n",
+ "Processed prompts: 69%|██████▉ | 69/100 [01:21<00:10, 2.86it/s, Generation Speed: 60.33 toks/s]\u001b[A\n",
+ "Processed prompts: 70%|███████ | 70/100 [01:22<00:10, 2.96it/s, Generation Speed: 60.77 toks/s]\u001b[A\n",
+ "Processed prompts: 71%|███████ | 71/100 [01:22<00:09, 3.07it/s, Generation Speed: 61.37 toks/s]\u001b[A\n",
+ "Processed prompts: 72%|███████▏ | 72/100 [01:22<00:08, 3.16it/s, Generation Speed: 62.29 toks/s]\u001b[A\n",
+ "Processed prompts: 75%|███████▌ | 75/100 [01:23<00:04, 5.11it/s, Generation Speed: 64.48 toks/s]\u001b[A\n",
+ "Processed prompts: 77%|███████▋ | 77/100 [01:23<00:06, 3.79it/s, Generation Speed: 65.36 toks/s]\u001b[A\n",
+ "Processed prompts: 78%|███████▊ | 78/100 [01:24<00:05, 3.80it/s, Generation Speed: 66.04 toks/s]\u001b[A\n",
+ "Processed prompts: 80%|████████ | 80/100 [01:24<00:05, 3.99it/s, Generation Speed: 67.40 toks/s]\u001b[A\n",
+ "Processed prompts: 81%|████████ | 81/100 [01:24<00:05, 3.49it/s, Generation Speed: 68.12 toks/s]\u001b[A\n",
+ "Processed prompts: 83%|████████▎ | 83/100 [01:25<00:03, 4.50it/s, Generation Speed: 69.84 toks/s]\u001b[A\n",
+ "Processed prompts: 85%|████████▌ | 85/100 [01:25<00:03, 4.77it/s, Generation Speed: 71.08 toks/s]\u001b[A\n",
+ "Processed prompts: 86%|████████▌ | 86/100 [01:25<00:02, 4.86it/s, Generation Speed: 71.78 toks/s]\u001b[A\n",
+ "Processed prompts: 87%|████████▋ | 87/100 [01:25<00:02, 4.99it/s, Generation Speed: 72.56 toks/s]\u001b[A\n",
+ "Processed prompts: 88%|████████▊ | 88/100 [01:26<00:03, 3.64it/s, Generation Speed: 73.08 toks/s]\u001b[A\n",
+ "Processed prompts: 89%|████████▉ | 89/100 [01:26<00:03, 3.46it/s, Generation Speed: 73.96 toks/s]\u001b[A\n",
+ "Processed prompts: 91%|█████████ | 91/100 [01:26<00:01, 5.12it/s, Generation Speed: 75.58 toks/s]\u001b[A\n",
+ "Processed prompts: 92%|█████████▏| 92/100 [01:27<00:01, 4.73it/s, Generation Speed: 76.30 toks/s]\u001b[A\n",
+ "Processed prompts: 95%|█████████▌| 95/100 [01:27<00:00, 6.06it/s, Generation Speed: 78.64 toks/s]\u001b[A\n",
+ "Processed prompts: 96%|█████████▌| 96/100 [01:27<00:00, 5.80it/s, Generation Speed: 79.32 toks/s]\u001b[A\n",
+ "Processed prompts: 97%|█████████▋| 97/100 [01:28<00:00, 3.48it/s, Generation Speed: 79.91 toks/s]\u001b[A\n",
+ "Processed prompts: 99%|█████████▉| 99/100 [01:29<00:00, 2.14it/s, Generation Speed: 80.91 toks/s]\u001b[A\n",
+ "Processed prompts: 100%|██████████| 100/100 [01:30<00:00, 1.10it/s, Generation Speed: 81.45 toks/s]\u001b[A\n"
+ ]
+ },
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "bf7c43131bac4c8aa22c0cd1988e6368",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "Flattening the indices: 0%| | 0/100 [00:00, ? examples/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "Processed prompts: 0%| | 0/100 [00:00, ?it/s, Generation Speed: 0.00 toks/s]\u001b[A\n",
+ "Processed prompts: 1%| | 1/100 [00:27<45:52, 27.80s/it, Generation Speed: 1.83 toks/s]\u001b[A\n",
+ "Processed prompts: 2%|▏ | 2/100 [00:36<27:23, 16.77s/it, Generation Speed: 2.88 toks/s]\u001b[A\n",
+ "Processed prompts: 3%|▎ | 3/100 [00:40<17:39, 10.92s/it, Generation Speed: 4.14 toks/s]\u001b[A\n",
+ "Processed prompts: 4%|▍ | 4/100 [00:42<11:38, 7.27s/it, Generation Speed: 5.37 toks/s]\u001b[A\n",
+ "Processed prompts: 5%|▌ | 5/100 [00:43<07:50, 4.95s/it, Generation Speed: 6.74 toks/s]\u001b[A\n",
+ "Processed prompts: 6%|▌ | 6/100 [00:45<06:02, 3.86s/it, Generation Speed: 7.90 toks/s]\u001b[A\n",
+ "Processed prompts: 7%|▋ | 7/100 [00:48<05:45, 3.72s/it, Generation Speed: 8.89 toks/s]\u001b[A\n",
+ "Processed prompts: 9%|▉ | 9/100 [00:49<03:13, 2.12s/it, Generation Speed: 11.46 toks/s]\u001b[A\n",
+ "Processed prompts: 10%|█ | 10/100 [00:50<02:41, 1.80s/it, Generation Speed: 12.59 toks/s]\u001b[A\n",
+ "Processed prompts: 11%|█ | 11/100 [00:51<02:17, 1.54s/it, Generation Speed: 13.89 toks/s]\u001b[A\n",
+ "Processed prompts: 12%|█▏ | 12/100 [00:52<02:19, 1.59s/it, Generation Speed: 14.77 toks/s]\u001b[A\n",
+ "Processed prompts: 13%|█▎ | 13/100 [00:53<01:59, 1.38s/it, Generation Speed: 16.01 toks/s]\u001b[A\n",
+ "Processed prompts: 15%|█▌ | 15/100 [00:55<01:36, 1.14s/it, Generation Speed: 18.23 toks/s]\u001b[A\n",
+ "Processed prompts: 17%|█▋ | 17/100 [00:56<01:11, 1.17it/s, Generation Speed: 20.34 toks/s]\u001b[A\n",
+ "Processed prompts: 19%|█▉ | 19/100 [00:57<01:09, 1.17it/s, Generation Speed: 22.22 toks/s]\u001b[A\n",
+ "Processed prompts: 20%|██ | 20/100 [00:58<01:08, 1.17it/s, Generation Speed: 23.31 toks/s]\u001b[A\n",
+ "Processed prompts: 21%|██ | 21/100 [01:00<01:22, 1.04s/it, Generation Speed: 23.86 toks/s]\u001b[A\n",
+ "Processed prompts: 22%|██▏ | 22/100 [01:01<01:17, 1.00it/s, Generation Speed: 24.77 toks/s]\u001b[A\n",
+ "Processed prompts: 25%|██▌ | 25/100 [01:02<00:46, 1.60it/s, Generation Speed: 27.93 toks/s]\u001b[A\n",
+ "Processed prompts: 26%|██▌ | 26/100 [01:02<00:45, 1.62it/s, Generation Speed: 28.97 toks/s]\u001b[A\n",
+ "Processed prompts: 27%|██▋ | 27/100 [01:03<00:44, 1.62it/s, Generation Speed: 29.88 toks/s]\u001b[A\n",
+ "Processed prompts: 28%|██▊ | 28/100 [01:04<00:54, 1.32it/s, Generation Speed: 30.07 toks/s]\u001b[A\n",
+ "Processed prompts: 29%|██▉ | 29/100 [01:05<00:51, 1.39it/s, Generation Speed: 30.77 toks/s]\u001b[A\n",
+ "Processed prompts: 30%|███ | 30/100 [01:06<00:59, 1.17it/s, Generation Speed: 31.36 toks/s]\u001b[A\n",
+ "Processed prompts: 31%|███ | 31/100 [01:08<01:16, 1.11s/it, Generation Speed: 31.65 toks/s]\u001b[A\n",
+ "Processed prompts: 32%|███▏ | 32/100 [01:09<01:13, 1.08s/it, Generation Speed: 32.33 toks/s]\u001b[A\n",
+ "Processed prompts: 37%|███▋ | 37/100 [01:09<00:26, 2.36it/s, Generation Speed: 36.98 toks/s]\u001b[A\n",
+ "Processed prompts: 40%|████ | 40/100 [01:09<00:19, 3.06it/s, Generation Speed: 39.68 toks/s]\u001b[A\n",
+ "Processed prompts: 42%|████▏ | 42/100 [01:10<00:21, 2.72it/s, Generation Speed: 41.15 toks/s]\u001b[A\n",
+ "Processed prompts: 44%|████▍ | 44/100 [01:12<00:24, 2.24it/s, Generation Speed: 42.28 toks/s]\u001b[A\n",
+ "Processed prompts: 48%|████▊ | 48/100 [01:12<00:15, 3.33it/s, Generation Speed: 46.17 toks/s]\u001b[A\n",
+ "Processed prompts: 49%|████▉ | 49/100 [01:13<00:19, 2.68it/s, Generation Speed: 46.53 toks/s]\u001b[A\n",
+ "Processed prompts: 50%|█████ | 50/100 [01:13<00:19, 2.63it/s, Generation Speed: 47.32 toks/s]\u001b[A\n",
+ "Processed prompts: 52%|█████▏ | 52/100 [01:14<00:15, 3.04it/s, Generation Speed: 49.06 toks/s]\u001b[A\n",
+ "Processed prompts: 53%|█████▎ | 53/100 [01:14<00:16, 2.90it/s, Generation Speed: 49.59 toks/s]\u001b[A\n",
+ "Processed prompts: 54%|█████▍ | 54/100 [01:15<00:16, 2.74it/s, Generation Speed: 50.06 toks/s]\u001b[A\n",
+ "Processed prompts: 55%|█████▌ | 55/100 [01:16<00:21, 2.10it/s, Generation Speed: 50.28 toks/s]\u001b[A\n",
+ "Processed prompts: 56%|█████▌ | 56/100 [01:17<00:28, 1.53it/s, Generation Speed: 50.64 toks/s]\u001b[A\n",
+ "Processed prompts: 60%|██████ | 60/100 [01:18<00:15, 2.62it/s, Generation Speed: 53.87 toks/s]\u001b[A\n",
+ "Processed prompts: 61%|██████ | 61/100 [01:18<00:17, 2.24it/s, Generation Speed: 54.15 toks/s]\u001b[A\n",
+ "Processed prompts: 63%|██████▎ | 63/100 [01:19<00:13, 2.76it/s, Generation Speed: 55.39 toks/s]\u001b[A\n",
+ "Processed prompts: 64%|██████▍ | 64/100 [01:19<00:15, 2.34it/s, Generation Speed: 55.90 toks/s]\u001b[A\n",
+ "Processed prompts: 66%|██████▌ | 66/100 [01:21<00:17, 1.94it/s, Generation Speed: 56.73 toks/s]\u001b[A\n",
+ "Processed prompts: 67%|██████▋ | 67/100 [01:21<00:15, 2.13it/s, Generation Speed: 57.66 toks/s]\u001b[A\n",
+ "Processed prompts: 68%|██████▊ | 68/100 [01:21<00:13, 2.32it/s, Generation Speed: 58.13 toks/s]\u001b[A\n",
+ "Processed prompts: 69%|██████▉ | 69/100 [01:22<00:12, 2.51it/s, Generation Speed: 59.04 toks/s]\u001b[A\n",
+ "Processed prompts: 73%|███████▎ | 73/100 [01:23<00:09, 2.98it/s, Generation Speed: 62.34 toks/s]\u001b[A\n",
+ "Processed prompts: 75%|███████▌ | 75/100 [01:23<00:06, 3.65it/s, Generation Speed: 64.16 toks/s]\u001b[A\n",
+ "Processed prompts: 77%|███████▋ | 77/100 [01:23<00:05, 4.32it/s, Generation Speed: 65.71 toks/s]\u001b[A\n",
+ "Processed prompts: 78%|███████▊ | 78/100 [01:24<00:05, 4.24it/s, Generation Speed: 66.38 toks/s]\u001b[A\n",
+ "Processed prompts: 80%|████████ | 80/100 [01:24<00:05, 3.69it/s, Generation Speed: 67.56 toks/s]\u001b[A\n",
+ "Processed prompts: 82%|████████▏ | 82/100 [01:24<00:03, 4.61it/s, Generation Speed: 69.18 toks/s]\u001b[A\n",
+ "Processed prompts: 84%|████████▍ | 84/100 [01:25<00:02, 5.55it/s, Generation Speed: 70.69 toks/s]\u001b[A\n",
+ "Processed prompts: 86%|████████▌ | 86/100 [01:25<00:02, 6.50it/s, Generation Speed: 72.19 toks/s]\u001b[A\n",
+ "Processed prompts: 88%|████████▊ | 88/100 [01:25<00:01, 7.50it/s, Generation Speed: 73.84 toks/s]\u001b[A\n",
+ "Processed prompts: 89%|████████▉ | 89/100 [01:25<00:01, 7.25it/s, Generation Speed: 74.64 toks/s]\u001b[A\n",
+ "Processed prompts: 90%|█████████ | 90/100 [01:25<00:01, 7.13it/s, Generation Speed: 75.24 toks/s]\u001b[A\n",
+ "Processed prompts: 91%|█████████ | 91/100 [01:26<00:01, 6.94it/s, Generation Speed: 76.05 toks/s]\u001b[A\n",
+ "Processed prompts: 92%|█████████▏| 92/100 [01:26<00:01, 5.75it/s, Generation Speed: 76.62 toks/s]\u001b[A\n",
+ "Processed prompts: 93%|█████████▎| 93/100 [01:26<00:01, 6.17it/s, Generation Speed: 77.30 toks/s]\u001b[A\n",
+ "Processed prompts: 94%|█████████▍| 94/100 [01:26<00:01, 4.53it/s, Generation Speed: 77.83 toks/s]\u001b[A\n",
+ "Processed prompts: 95%|█████████▌| 95/100 [01:27<00:01, 3.85it/s, Generation Speed: 78.53 toks/s]\u001b[A\n",
+ "Processed prompts: 96%|█████████▌| 96/100 [01:27<00:00, 4.58it/s, Generation Speed: 79.37 toks/s]\u001b[A\n",
+ "Processed prompts: 97%|█████████▋| 97/100 [01:27<00:00, 3.04it/s, Generation Speed: 79.74 toks/s]\u001b[A\n",
+ "Processed prompts: 98%|█████████▊| 98/100 [01:28<00:00, 3.49it/s, Generation Speed: 80.63 toks/s]\u001b[A\n",
+ "Processed prompts: 100%|██████████| 100/100 [01:29<00:00, 1.12it/s, Generation Speed: 81.78 toks/s]\u001b[A\n"
+ ]
+ },
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "0aa4ac3c1c3a4ccd9d27972d0cb776c9",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "Flattening the indices: 0%| | 0/100 [00:00, ? examples/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "def process_batch(batch, batch_size, retry_count=0, max_retries=3, min_batch_size=25):\n",
+ " if len(batch) == 0:\n",
+ " return []\n",
+ "\n",
+ " batch_prompts = batch[\"prompt\"]\n",
+ "\n",
+ " try:\n",
+ " batch_results = generator(batch_prompts, sampling_params=params)\n",
+ " return batch.add_column(\n",
+ " \"generations\",\n",
+ " [result.model_dump_json() for result in batch_results],\n",
+ " )\n",
+ " except Exception as e:\n",
+ " print(f\"Error in generation for batch (size {len(batch)}): {e}\")\n",
+ "\n",
+ " if retry_count >= max_retries or batch_size <= min_batch_size:\n",
+ " print(\"Max retries reached or batch size too small. Skipping batch.\")\n",
+ " return []\n",
+ "\n",
+ " print(f\"Splitting batch and retrying (retry count: {retry_count + 1})\")\n",
+ " num_sub_batches = 2 ** (retry_count + 1)\n",
+ " sub_batch_size = max(batch_size // num_sub_batches, min_batch_size)\n",
+ " sub_batches = [\n",
+ " batch.shard(num_shards=num_sub_batches, index=i)\n",
+ " for i in range(num_sub_batches)\n",
+ " ]\n",
+ " print(f\"Sub batch size {sub_batch_size}\")\n",
+ " updated_sub_batches = []\n",
+ " for sub_batch in sub_batches:\n",
+ " updated_sub_batch = process_batch(\n",
+ " sub_batch, sub_batch_size, retry_count + 1, max_retries, min_batch_size\n",
+ " )\n",
+ " if len(updated_sub_batch) > 0:\n",
+ " updated_sub_batches.append(updated_sub_batch)\n",
+ "\n",
+ " return concatenate_datasets(updated_sub_batches) if updated_sub_batches else []\n",
+ "\n",
+ "\n",
+ "initial_batch_size = 100\n",
+ "num_batches = len(ds) // initial_batch_size + (len(ds) % initial_batch_size != 0)\n",
+ "dataset_parts = [ds.shard(num_shards=num_batches, index=i) for i in range(num_batches)]\n",
+ "\n",
+ "updated_parts = []\n",
+ "for part in tqdm(dataset_parts):\n",
+ " updated_part = process_batch(part, initial_batch_size)\n",
+ " if len(updated_part) > 0:\n",
+ " updated_parts.append(updated_part)\n",
+ "\n",
+ "if updated_parts:\n",
+ " ds = concatenate_datasets(updated_parts)\n",
+ "else:\n",
+ " print(\"No successfully updated parts. The dataset remains unchanged.\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "6f7768ac",
+ "metadata": {},
+ "source": [
+ "If we look at our dataset we can see that we have a new column called `generations` which contains the generated data."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "id": "490bf0b4-469b-4594-94a9-98916a47441e",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Dataset({\n",
+ " features: ['id', 'section', 'prompt', 'generations'],\n",
+ " num_rows: 1000\n",
+ "})"
+ ]
+ },
+ "execution_count": 22,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "ds"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "457cc887-7931-43dc-a261-74e27fba2f28",
+ "metadata": {},
+ "source": [
+ "Let's look at an example row"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 24,
+ "id": "66b0a713-b2f6-4668-ad37-72073bbd8397",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "{'id': '116s4049rs',\n",
+ " 'section': 'rear admiral in the Navy, or an equivalent grade in the Space Force is under investigation for alleged misconduct or pending the disposition of an adverse personnel action at the time of retirement, the Secretary of the military department concerned may— (A) conditionally determine the highest permanent grade of satisfactory service on active duty of the officer pending completion of the investigation or resolution of the personnel action, as applicable; and (B) retire the officer in that conditional grade, subject to subsection (e).',\n",
+ " 'prompt': \"Write one good and three bad abstract descriptions of the following text. Output the descriptions in a JSON file with keys ‘good’ and ‘bad’.\\nExample:\\nText: Community Energy Savings Program Act of 2019\\n\\nThis bill directs the Department of Energy to establish a grant program for states and Indian tribes to provide loans to consumers and communities that want to implement cost-effective energy efficiency measures.\\nGood description: A legislative proposal to promote energy efficiency through financial incentives\\nBad description: A federal reform relating to the process for submitting planning applications related to oil pipelines\\n\\nNote: Descriptions can vary in abstraction, detail, and focus. Both good and bad descriptions should be short (max 20 words)\\n\\nText to describe: rear admiral in the Navy, or an equivalent grade in the Space Force is under investigation for alleged misconduct or pending the disposition of an adverse personnel action at the time of retirement, the Secretary of the military department concerned may— (A) conditionally determine the highest permanent grade of satisfactory service on active duty of the officer pending completion of the investigation or resolution of the personnel action, as applicable; and (B) retire the officer in that conditional grade, subject to subsection (e).\\nReturn a JSON object with the keys 'good' and 'bad' using this schema: {'properties': {'good': {'items': {'maxLength': 200, 'minLength': 20, 'type': 'string'}, 'maxItems': 1, 'minItems': 1, 'title': 'Good', 'type': 'array'}, 'bad': {'items': {'maxLength': 200, 'minLength': 20, 'type': 'string'}, 'maxItems': 3, 'minItems': 3, 'title': 'Bad', 'type': 'array'}}, 'required': ['good', 'bad'], 'title': 'AbstractDescriptions', 'type': 'object'}.\",\n",
+ " 'generations': '{\"good\":[\"Retirement of rear admiral under investigation for misconduct may be conditional on the outcome of the investigation and resolution of personnel actions.\"],\"bad\":[\"A proposal to change the retirement benefits for military personnel based on their years of service.\",\"Legislation to implement new training programs for naval officers.\",\"Investigation process for harassment complaints in the military.\"]}'}"
+ ]
+ },
+ "execution_count": 24,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "ds[0]"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "4d048ff2-49bc-44fd-947b-facdc3977c85",
+ "metadata": {},
+ "source": [
+ "We'll do some more work to format the dataset in a format that is compatible with Sentence Transformers training APIs but let's already push to the raw dataset to the Hub. We can push this to a config called `raw`."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 25,
+ "id": "ee860819-fb00-4795-a75f-63d5b7961dee",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "ec47fd798c884451b528398b7a2de379",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "Uploading the dataset shards: 0%| | 0/1 [00:00, ?it/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "ed56cf35793749ee862cc3ad6b42db6f",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "Creating parquet from Arrow format: 0%| | 0/1 [00:00, ?ba/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "1e1348c5bf9947c8bbf1741004acb3e8",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "README.md: 0%| | 0.00/798 [00:00, ?B/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "CommitInfo(commit_url='https://huggingface.co/datasets/davanstrien/bill_summary_us_chunks-similarity-yi/commit/026cf1d1555ec6fece47b57fe54dc0d01f793221', commit_message='Upload dataset', commit_description='', oid='026cf1d1555ec6fece47b57fe54dc0d01f793221', pr_url=None, pr_revision=None, pr_num=None)"
+ ]
+ },
+ "execution_count": 25,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "ds.push_to_hub('bill_summary_us_chunks-similarity', \"raw\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "7e441ea9",
+ "metadata": {},
+ "source": [
+ "We can also see that we can load an example from the `generations` column as valid JSON."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 26,
+ "id": "f02932d7-aac7-41de-af0f-7072ff3c1a79",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "{'good': ['Retirement of rear admiral under investigation for misconduct may be conditional on the outcome of the investigation and resolution of personnel actions.'],\n",
+ " 'bad': ['A proposal to change the retirement benefits for military personnel based on their years of service.',\n",
+ " 'Legislation to implement new training programs for naval officers.',\n",
+ " 'Investigation process for harassment complaints in the military.']}"
+ ]
+ },
+ "execution_count": 26,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "json.loads(ds[0]['generations'])"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "4d842519-b64d-4e39-817c-112af8bc5013",
+ "metadata": {},
+ "source": [
+ "### Formatting the dataset for Sentence Transformers\n",
+ "\n",
+ "Sentence Transformers requires a dataset with three columns: \"anchor\", \"positive\", and \"negative\". We can now format our dataset in this way.\n",
+ "\n",
+ "For now we'll just randomly select a positive and negative example from the generations we created. A later notebook will look at how we can select the best positive and negative examples for each anchor text in other ways."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 27,
+ "id": "f4f03c81-0687-4842-8d35-366430502884",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [],
+ "source": [
+ "def format_for_st(row):\n",
+ " anchor = row[\"section\"]\n",
+ " generations = json.loads(row[\"generations\"])\n",
+ " good = generations.get(\"good\")\n",
+ " bad = generations.get(\"bad\")\n",
+ " positive = random.choice(good)\n",
+ " negative = random.choice(bad)\n",
+ " return {\"anchor\": anchor, \"positive\": positive, \"negative\": negative}"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 28,
+ "id": "e14b7b6b-d818-4bd3-a673-a1c005b99832",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "{'anchor': 'rear admiral in the Navy, or an equivalent grade in the Space Force is under investigation for alleged misconduct or pending the disposition of an adverse personnel action at the time of retirement, the Secretary of the military department concerned may— (A) conditionally determine the highest permanent grade of satisfactory service on active duty of the officer pending completion of the investigation or resolution of the personnel action, as applicable; and (B) retire the officer in that conditional grade, subject to subsection (e).',\n",
+ " 'positive': 'Retirement of rear admiral under investigation for misconduct may be conditional on the outcome of the investigation and resolution of personnel actions.',\n",
+ " 'negative': 'Legislation to implement new training programs for naval officers.'}"
+ ]
+ },
+ "execution_count": 28,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "format_for_st(ds[0])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 29,
+ "id": "187730e1-ba8c-4477-84c7-52f93a0cc2a3",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "c9c7c837a8ba4731920494575f5a5773",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "Map: 0%| | 0/1000 [00:00, ? examples/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "ds = ds.map(format_for_st)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "86a62b23",
+ "metadata": {},
+ "source": [
+ "We remove all the unnecessary columns"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 30,
+ "id": "9d44960e-c4f8-46ac-bee0-393416508912",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [],
+ "source": [
+ "ds = ds.remove_columns([c for c in ds.column_names if c not in { 'anchor', 'positive', 'negative'}])"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "61229f25",
+ "metadata": {},
+ "source": [
+ "We now push to the Hub, this time we don't specify a config so it will be pushed to the default config."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 39,
+ "id": "c47e5f2c-eebe-46c8-93c3-dfab78318007",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "7ed7ee9174bd4995b5342733ae766658",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "Uploading the dataset shards: 0%| | 0/1 [00:00, ?it/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "b2815fe9ee2d413d900d8e335e4034e3",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "Creating parquet from Arrow format: 0%| | 0/1 [00:00, ?ba/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "2f709f07095441b8a38cce34d8eaca5a",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "README.md: 0%| | 0.00/732 [00:00, ?B/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "info = ds.push_to_hub('bill_summary_us_chunks-similarity')"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "0fcba1cc",
+ "metadata": {},
+ "source": [
+ "### Add some metadata to the Dataset Card\n",
+ "\n",
+ "We can now add some metadata to the dataset card. This will help us keep track of the dataset and understand how it was created."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 38,
+ "id": "d6afcc00-1512-4ded-a36d-5e5d866112d9",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [],
+ "source": [
+ "card = DatasetCard.load(\"davanstrien/bill-summary-us-similarity\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 33,
+ "id": "a92bea99-1e80-4711-9d6a-e1ea4afb56ab",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [],
+ "source": [
+ "card.data['tags'] = ['sentence-transformers', 'synthetic' ,\"synthetic-data-workshop\"]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 42,
+ "id": "5126dd9a-9d73-4f6e-967b-ac93506bb720",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "CommitInfo(commit_url='https://huggingface.co/datasets/davanstrien/bill_summary_us_chunks-similarity/commit/8cf7a2e9209f631f5395296b0f8ee081101f4479', commit_message='Upload README.md with huggingface_hub', commit_description='', oid='8cf7a2e9209f631f5395296b0f8ee081101f4479', pr_url=None, pr_revision=None, pr_num=None)"
+ ]
+ },
+ "execution_count": 42,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "card.push_to_hub(\"davanstrien/bill_summary_us_chunks-similarity\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "5dfd1c60",
+ "metadata": {},
+ "source": [
+ "fin"
+ ]
+ }
+ ],
+ "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.11.1"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}