From 38cf72f921e11a93dff3bc91af4d30ad23c819d1 Mon Sep 17 00:00:00 2001 From: deep1 <> Date: Sun, 6 Aug 2023 18:47:42 +0800 Subject: [PATCH] fixes --- mjc_notes.md | 26 +- notebooks/03_make_dataset.ipynb | 867 +++++++++++++++++++++----------- src/datasets/batch.py | 4 +- src/datasets/hs.py | 15 +- src/datasets/load.py | 6 +- 5 files changed, 594 insertions(+), 324 deletions(-) diff --git a/mjc_notes.md b/mjc_notes.md index b972cae..5c1ed65 100644 --- a/mjc_notes.md +++ b/mjc_notes.md @@ -850,6 +850,20 @@ Maybe I should be looking at hidden state condictional on a token. But how to do Well I'm really trying to tell if the most likely answer is true. So I just need to work out if the most likely answer is true using the labels. Then I can order the hidden states. + +# Collect hidden state pairs + +The idea is this: given two pairs of hidden states, where everything is the same except r dropout. Then tell me which one is more truthfull? + +If this works, then for any inference, we can see which one is more truthfull. Then we can see if it's the lower or higher probability one, and judge the answer and true or false. + +Steps: +- collect pairs of hidden states, where the inputs and outputs are the same. We modify the random seed and dropout. +- Each pair should have a binary answer. We can get that by comparing the probabilities of two tokens such as Yes and No. +- Train a prob to distinguish the pairs as more and less truthfull +- Test probe to see if it generalizes + + # 2023-08-05 07:09:39 TODO @@ -884,15 +898,3 @@ Lesson: padding can lead to weird outputs so it's best to use an attention mask - [x] round up the FIXME TODO UPTO HACK's - [ ] get model nb working - [ ] do multiple datasets - -# Collect hidden state pairs - -The idea is this: given two pairs of hidden states, where everything is the same except r dropout. Then tell me which one is more truthfull? - -If this works, then for any inference, we can see which one is more truthfull. Then we can see if it's the lower or higher probability one, and judge the answer and true or false. - -Steps: -- collect pairs of hidden states, where the inputs and outputs are the same. We modify the random seed and dropout. -- Each pair should have a binary answer. We can get that by comparing the probabilities of two tokens such as Yes and No. -- Train a prob to distinguish the pairs as more and less truthfull -- Test probe to see if it generalizes diff --git a/notebooks/03_make_dataset.ipynb b/notebooks/03_make_dataset.ipynb index 30bcd2b..95d2ac1 100644 --- a/notebooks/03_make_dataset.ipynb +++ b/notebooks/03_make_dataset.ipynb @@ -108,7 +108,7 @@ "dataset_params = dict(\n", " model_repo=\"HuggingFaceH4/starchat-beta\",\n", " dataset_name = \"amazon_polarity\",\n", - " N = 1200, # 8000 # 4000 in 4 hours\n", + " N = 200, # 8000 # 4000 in 4 hours\n", " N_SHOTS = 3,\n", " prompt_fmt=format_guard_prompt,\n", " choices=default_class2choices,\n", @@ -137,7 +137,7 @@ "- https://github.com/deep-diver/LLM-As-Chatbot/blob/main/model_cards.json\n", "\n", "\n", - "A uncensored and large one might be best for lying." + "A uncensored and large coding ones might be best for lying." ] }, { @@ -167,7 +167,7 @@ " and submit this information together with your error trace to: https://github.com/TimDettmers/bitsandbytes/issues\n", "================================================================================\n", "bin /home/ubuntu/mambaforge/envs/dlk2/lib/python3.9/site-packages/bitsandbytes/libbitsandbytes_cuda117.so\n", - "CUDA SETUP: CUDA runtime path found: /home/ubuntu/mambaforge/envs/dlk2/lib/libcudart.so.11.0\n", + "CUDA SETUP: CUDA runtime path found: /home/ubuntu/mambaforge/envs/dlk2/lib/libcudart.so\n", "CUDA SETUP: Highest compute capability among GPUs detected: 8.6\n", "CUDA SETUP: Detected CUDA version 117\n", "CUDA SETUP: Loading binary /home/ubuntu/mambaforge/envs/dlk2/lib/python3.9/site-packages/bitsandbytes/libbitsandbytes_cuda117.so...\n" @@ -177,7 +177,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/ubuntu/mambaforge/envs/dlk2/lib/python3.9/site-packages/bitsandbytes/cuda_setup/main.py:149: UserWarning: Found duplicate ['libcudart.so', 'libcudart.so.11.0', 'libcudart.so.12.0'] files: {PosixPath('/home/ubuntu/mambaforge/envs/dlk2/lib/libcudart.so.11.0'), PosixPath('/home/ubuntu/mambaforge/envs/dlk2/lib/libcudart.so')}.. We'll flip a coin and try one of these, in order to fail forward.\n", + "/home/ubuntu/mambaforge/envs/dlk2/lib/python3.9/site-packages/bitsandbytes/cuda_setup/main.py:149: UserWarning: Found duplicate ['libcudart.so', 'libcudart.so.11.0', 'libcudart.so.12.0'] files: {PosixPath('/home/ubuntu/mambaforge/envs/dlk2/lib/libcudart.so'), PosixPath('/home/ubuntu/mambaforge/envs/dlk2/lib/libcudart.so.11.0')}.. We'll flip a coin and try one of these, in order to fail forward.\n", "Either way, this might cause trouble in the future:\n", "If you get `CUDA error: invalid device function` errors, the above might be the cause and the solution is to make sure only one ['libcudart.so', 'libcudart.so.11.0', 'libcudart.so.12.0'] in the paths that we search based on your env.\n", " warn(msg)\n" @@ -186,7 +186,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "77cfa16c0f9b42b4b941e21091e6e5b0", + "model_id": "9ec728d6b1b5411bac0193809bea2218", "version_major": 2, "version_minor": 0 }, @@ -282,7 +282,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "79c0f37cb1094acd8080bcb029ba4421", + "model_id": "727752b42ff94875ae432a1e11314b22", "version_major": 2, "version_minor": 0 }, @@ -315,7 +315,7 @@ ], "source": [ "dataset = load_dataset(dataset_params['dataset_name'])\n", - "dataset\n" + "dataset" ] }, { @@ -326,7 +326,9 @@ "\n", "The prompt is the thing we most often have to change and debug. So we do it explicitly here.\n", "\n", - "We do it as transforms on a huggingface dataset.\n" + "We do it as transforms on a huggingface dataset.\n", + "\n", + "In this case we use multishot examples from train, and use the test set to generated the hidden states dataset. We will test generalisation on a whole new dataset.\n" ] }, { @@ -392,7 +394,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 9, "metadata": { "notebookRunGroups": { "groupValue": "" @@ -400,56 +402,23 @@ }, "outputs": [ { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "b9777e0fd6d24e7d9fd13246c75b543c", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Map: 0%| | 0/1200 [00:00, ? examples/s]" - ] - }, - "metadata": {}, - "output_type": "display_data" + "name": "stderr", + "output_type": "stream", + "text": [ + "Loading cached processed dataset at /home/ubuntu/.cache/huggingface/datasets/amazon_polarity/amazon_polarity/3.0.0/a27b32b7e7b88eb274a8fa8ba0f654f1fe998a87c22547557317793b5d2772dc/cache-7ead9e0ad32eb46b.arrow\n", + "Loading cached processed dataset at /home/ubuntu/.cache/huggingface/datasets/amazon_polarity/amazon_polarity/3.0.0/a27b32b7e7b88eb274a8fa8ba0f654f1fe998a87c22547557317793b5d2772dc/cache-02c7e598873e6130.arrow\n", + "Loading cached processed dataset at /home/ubuntu/.cache/huggingface/datasets/amazon_polarity/amazon_polarity/3.0.0/a27b32b7e7b88eb274a8fa8ba0f654f1fe998a87c22547557317793b5d2772dc/cache-43fa79c244a7e35f.arrow\n" + ] }, { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "49d6df0484df4fa68ba822c7f59d17ba", + "model_id": "74a661caec764627802f9c5608f19a16", "version_major": 2, "version_minor": 0 }, "text/plain": [ - "Map: 0%| | 0/1200 [00:00, ? examples/s]" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "3de2092e7709499f85e9160116dda71b", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Map: 0%| | 0/1200 [00:00, ? examples/s]" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "3aa2f57d8e2f48329394032b1a98f55d", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Map: 0%| | 0/1200 [00:00, ? examples/s]" + "Map: 0%| | 0/200 [00:00, ? examples/s]" ] }, "metadata": {}, @@ -460,11 +429,11 @@ "text/plain": [ "Dataset({\n", " features: ['label', 'title', 'content', 'text', 'prompt', 'lie', 'input_ids', 'attention_mask', 'prompt_truncated'],\n", - " num_rows: 1200\n", + " num_rows: 200\n", "})" ] }, - "execution_count": 32, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -489,7 +458,7 @@ " batched=True,\n", " )\n", ")\n", - "ds\n" + "ds" ] }, { @@ -502,18 +471,15 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 10, "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "'../.ds/model-starchat-beta_ds-amazon-polarity_format-guard-prompt_N1200_3shots_8a53f8'" - ] - }, - "execution_count": 33, - "metadata": {}, - "output_type": "execute_result" + "name": "stdout", + "output_type": "stream", + "text": [ + "../.ds/model-starchat-beta_ds-amazon-polarity_format-guard-prompt_N200_3shots_5cc9f5\n" + ] } ], "source": [ @@ -522,19 +488,12 @@ ")\n", "dataset_name = ds_params2fname(dataset_params) + config_hash\n", "f = f\"../.ds/{dataset_name}\"\n", - "f" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Generate dataset" + "print(f)" ] }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -570,13 +529,13 @@ " 'tokenizer': GPT2TokenizerFast(name_or_path='HuggingFaceH4/starchat-beta', vocab_size=49152, model_max_length=1000000000000000019884624838656, is_fast=True, padding_side='left', truncation_side='left', special_tokens={'bos_token': '<|endoftext|>', 'eos_token': '<|endoftext|>', 'unk_token': '<|endoftext|>', 'pad_token': '<|endoftext|>', 'additional_special_tokens': ['<|system|>', '<|user|>', '<|assistant|>', '<|end|>']}, clean_up_tokenization_spaces=True),\n", " 'data': Dataset({\n", " features: ['label', 'title', 'content', 'text', 'prompt', 'lie', 'input_ids', 'attention_mask', 'prompt_truncated'],\n", - " num_rows: 1200\n", + " num_rows: 200\n", " }),\n", - " 'n': 1200,\n", + " 'n': 200,\n", " 'batch_size': 10}" ] }, - "execution_count": 34, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -594,20 +553,20 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 12, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Downloading and preparing dataset None/../.ds/model-starchat-beta_ds-amazon-polarity_format-guard-prompt_N1200_3shots_8a53f8 to /home/ubuntu/.cache/huggingface/datasets/generator/default-24b23d7ca620a1e0/0.0.0...\n" + "Downloading and preparing dataset None/../.ds/model-starchat-beta_ds-amazon-polarity_format-guard-prompt_N200_3shots_5cc9f5 to /home/ubuntu/.cache/huggingface/datasets/generator/default-b5ad8fb70e556200/0.0.0...\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "ba1a8aef02de401c9a3be3076e13355a", + "model_id": "a8bfa75291cf4bc6a6fe1cda7a4395dc", "version_major": 2, "version_minor": 0 }, @@ -621,16 +580,36 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "efbefecc46a24302916e4ac3f0758d2d", + "model_id": "154c0cbf03924fba98114c76a15173ae", "version_major": 2, "version_minor": 0 }, "text/plain": [ - "get hidden states: 0%| | 0/120 [00:00, ?it/s]" + "get hidden states: 0%| | 0/20 [00:00, ?it/s]" ] }, "metadata": {}, "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Dataset generator downloaded and prepared to /home/ubuntu/.cache/huggingface/datasets/generator/default-b5ad8fb70e556200/0.0.0. Subsequent calls will reuse this data.\n" + ] + }, + { + "data": { + "text/plain": [ + "Dataset({\n", + " features: ['hs0', 'scores0', 'hs1', 'scores1', 'true', 'index', 'label', 'prompt', 'lie', 'prompt_truncated'],\n", + " num_rows: 200\n", + "})" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ @@ -642,7 +621,6 @@ " \n", " ),\n", " gen_kwargs=gen_kwargs,\n", - " # config_kwargs={},\n", ").with_format(\"numpy\")\n", "ds1" ] @@ -656,61 +634,92 @@ } }, "source": [ - "## Add labels" + "## Add labels\n", + "\n", + "For our probe. Given next_token scores (logits) we take only the subset the corresponds to our negative tokens (e.g. False, no, ...) and positive tokens (e.g. Yes, yes, affirmative, ...).\n" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "f3fa7d3719e446dfa32b828ef8d968fc", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map: 0%| | 0/200 [00:00, ? examples/s]" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3c4ae2d9df3846a082aa8d9d1b9f08d3", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map: 0%| | 0/200 [00:00, ? examples/s]" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "5e13a047ab2e4e2a96c162e69f9d1174", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map: 0%| | 0/200 [00:00, ? examples/s]" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/plain": [ + "Dataset({\n", + " features: ['hs0', 'scores0', 'hs1', 'scores1', 'true', 'index', 'label', 'prompt', 'lie', 'prompt_truncated', 'choice_probs0', 'ans0', 'choice_probs1', 'ans1', 'txt_ans0', 'txt_ans1'],\n", + " num_rows: 200\n", + "})" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "class2_ids = choice2ids(tokenizer, dataset_params['choices'])\n", + "add_txt_ans0 = lambda r: {'txt_ans0': tokenizer.decode(r['scores0'].argmax(-1))}\n", + "add_txt_ans1 = lambda r: {'txt_ans1': tokenizer.decode(r['scores1'].argmax(-1))}\n", + "\n", + "ds3 = (\n", + " ds1\n", + " .map(lambda r: scores2choice_probs(r, class2_ids))\n", + " .map(add_txt_ans0)\n", + " .map(add_txt_ans1)\n", + ")\n", + "ds3" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮\n", - "│ in <module>:5 │\n", - "│ │\n", - "│ 2 add_txt_ans = lambda r: {'txt_ans': tokenizer.decode(r['scores1'].argmax(-1))} │\n", - "│ 3 │\n", - "│ 4 ds3 = ( │\n", - "│ ❱ 5 │ ds1 │\n", - "│ 6 │ .map(lambda r: scores2choice_probs(r, class2_ids)) │\n", - "│ 7 │ .map(add_txt_ans) │\n", - "│ 8 ) │\n", - "╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\n", - "NameError: name 'ds1' is not defined\n", - "\n" - ], - "text/plain": [ - "\u001b[31m╭─\u001b[0m\u001b[31m──────────────────────────────\u001b[0m\u001b[31m \u001b[0m\u001b[1;31mTraceback \u001b[0m\u001b[1;2;31m(most recent call last)\u001b[0m\u001b[31m \u001b[0m\u001b[31m───────────────────────────────\u001b[0m\u001b[31m─╮\u001b[0m\n", - "\u001b[31m│\u001b[0m in \u001b[92m
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮\n", - "│ in <module>:1 │\n", - "│ │\n", - "│ ❱ 1 ds3.save_to_disk(f) │\n", - "│ 2 f │\n", - "│ 3 │\n", - "╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\n", - "NameError: name 'ds3' is not defined\n", - "\n" - ], + "application/vnd.jupyter.widget-view+json": { + "model_id": "3aff8151fc284fe19acb2c3155f3c288", + "version_major": 2, + "version_minor": 0 + }, "text/plain": [ - "\u001b[31m╭─\u001b[0m\u001b[31m──────────────────────────────\u001b[0m\u001b[31m \u001b[0m\u001b[1;31mTraceback \u001b[0m\u001b[1;2;31m(most recent call last)\u001b[0m\u001b[31m \u001b[0m\u001b[31m───────────────────────────────\u001b[0m\u001b[31m─╮\u001b[0m\n", - "\u001b[31m│\u001b[0m in \u001b[92m
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮\n", - "│ in <module>:1 │\n", - "│ │\n", - "│ ❱ 1 ds4 = load_from_disk(f) │\n", - "│ 2 ds4 │\n", - "│ 3 │\n", - "│ │\n", - "│ /home/ubuntu/mambaforge/envs/dlk2/lib/python3.9/site-packages/datasets/load.py:1886 in │\n", - "│ load_from_disk │\n", - "│ │\n", - "│ 1883 │ │ path_join = os.path.join │\n", - "│ 1884 │ │\n", - "│ 1885 │ if not fs.exists(dest_dataset_path): │\n", - "│ ❱ 1886 │ │ raise FileNotFoundError(f\"Directory {dataset_path} not found\") │\n", - "│ 1887 │ if fs.isfile(path_join(dest_dataset_path, config.DATASET_INFO_FILENAME)) and fs.isfi │\n", - "│ 1888 │ │ path_join(dest_dataset_path, config.DATASET_STATE_JSON_FILENAME) │\n", - "│ 1889 │ ): │\n", - "╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\n", - "FileNotFoundError: Directory ../.ds/model-starchat-beta_ds-amazon-polarity_format-guard-prompt_N1200_3shots_0328e7 \n", - "not found\n", - "\n" - ], "text/plain": [ - "\u001b[31m╭─\u001b[0m\u001b[31m──────────────────────────────\u001b[0m\u001b[31m \u001b[0m\u001b[1;31mTraceback \u001b[0m\u001b[1;2;31m(most recent call last)\u001b[0m\u001b[31m \u001b[0m\u001b[31m───────────────────────────────\u001b[0m\u001b[31m─╮\u001b[0m\n", - "\u001b[31m│\u001b[0m in \u001b[92m
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮\n", - "│ in <module>:2 │\n", - "│ │\n", - "│ 1 # QC, check which answers are most common │\n", - "│ ❱ 2 common_answers = pd.Series(ds4['txt_ans']).value_counts() │\n", - "│ 3 display('Remember it should be binary. Found common LLM answers:', common_answers) │\n", - "│ 4 │\n", - "│ 5 # list unexpected answers │\n", - "╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\n", - "NameError: name 'ds4' is not defined\n", - "\n" - ], "text/plain": [ - "\u001b[31m╭─\u001b[0m\u001b[31m──────────────────────────────\u001b[0m\u001b[31m \u001b[0m\u001b[1;31mTraceback \u001b[0m\u001b[1;2;31m(most recent call last)\u001b[0m\u001b[31m \u001b[0m\u001b[31m───────────────────────────────\u001b[0m\u001b[31m─╮\u001b[0m\n", - "\u001b[31m│\u001b[0m in \u001b[92m
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮\n", - "│ in <module>:1 │\n", - "│ │\n", - "│ ❱ 1 df = ds2df(ds4) │\n", - "│ 2 df │\n", - "│ 3 │\n", - "╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\n", - "NameError: name 'ds4' is not defined\n", - "\n" + "
| \n", + " | true | \n", + "index | \n", + "label | \n", + "prompt | \n", + "lie | \n", + "prompt_truncated | \n", + "choice_probs0 | \n", + "ans0 | \n", + "choice_probs1 | \n", + "ans1 | \n", + "txt_ans0 | \n", + "txt_ans1 | \n", + "dir_true | \n", + "conf | \n", + "llm_prob | \n", + "llm_ans | \n", + "desired_ans | \n", + "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", + "1 | \n", + "0 | \n", + "1 | \n", + "<|system|>You are about to immerse yourself in... | \n", + "True | \n", + "<|endoftext|><|endoftext|><|endoftext|><|endof... | \n", + "[0.078145705, 0.32699254] | \n", + "0.807094 | \n", + "[0.1094421, 0.48459822] | \n", + "0.815753 | \n", + "True | \n", + "True | \n", + "0.008659 | \n", + "0.008659 | \n", + "0.811423 | \n", + "True | \n", + "False | \n", + "
| 1 | \n", + "0 | \n", + "1 | \n", + "1 | \n", + "<|system|>You are about to immerse yourself in... | \n", + "True | \n", + ". You take a role from the classic puzzle of t... | \n", + "[0.60891825, 0.33895335] | \n", + "0.357590 | \n", + "[0.18620293, 0.22872218] | \n", + "0.551224 | \n", + "False | \n", + "True | \n", + "0.193634 | \n", + "0.193634 | \n", + "0.454407 | \n", + "False | \n", + "False | \n", + "
| 2 | \n", + "1 | \n", + "2 | \n", + "0 | \n", + "<|system|>You are about to immerse yourself in... | \n", + "True | \n", + "<|endoftext|><|endoftext|><|endoftext|><|endof... | \n", + "[0.22698066, 0.34947497] | \n", + "0.606237 | \n", + "[0.34118584, 0.5306288] | \n", + "0.608642 | \n", + "True | \n", + "True | \n", + "0.002404 | \n", + "0.002404 | \n", + "0.607440 | \n", + "True | \n", + "True | \n", + "
| 3 | \n", + "0 | \n", + "3 | \n", + "1 | \n", + "<|system|>You are about to immerse yourself in... | \n", + "True | \n", + "<|endoftext|><|endoftext|><|endoftext|><|endof... | \n", + "[0.57587034, 0.24939153] | \n", + "0.302193 | \n", + "[0.46418592, 0.23797682] | \n", + "0.338915 | \n", + "False | \n", + "False | \n", + "0.036722 | \n", + "0.036722 | \n", + "0.320554 | \n", + "False | \n", + "False | \n", + "
| 4 | \n", + "1 | \n", + "4 | \n", + "1 | \n", + "<|system|>You are about to immerse yourself in... | \n", + "True | \n", + "<|endoftext|><|endoftext|><|endoftext|><|endof... | \n", + "[0.31092325, 0.34889498] | \n", + "0.528766 | \n", + "[0.42988867, 0.47642803] | \n", + "0.525669 | \n", + "True | \n", + "True | \n", + "-0.003097 | \n", + "0.003097 | \n", + "0.527218 | \n", + "True | \n", + "False | \n", + "
| ... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "
| 195 | \n", + "0 | \n", + "195 | \n", + "1 | \n", + "<|system|>You are about to immerse yourself in... | \n", + "True | \n", + "<|endoftext|><|endoftext|><|endoftext|><|endof... | \n", + "[0.4364484, 0.41708928] | \n", + "0.488654 | \n", + "[0.44443354, 0.41476423] | \n", + "0.482729 | \n", + "False | \n", + "False | \n", + "-0.005925 | \n", + "0.005925 | \n", + "0.485691 | \n", + "False | \n", + "False | \n", + "
| 196 | \n", + "1 | \n", + "196 | \n", + "0 | \n", + "<|system|>You are about to immerse yourself in... | \n", + "True | \n", + "<|endoftext|><|endoftext|><|endoftext|><|endof... | \n", + "[0.22973666, 0.21817155] | \n", + "0.487079 | \n", + "[0.3398598, 0.32811356] | \n", + "0.491200 | \n", + "False | \n", + "False | \n", + "0.004121 | \n", + "0.004121 | \n", + "0.489140 | \n", + "False | \n", + "True | \n", + "
| 197 | \n", + "1 | \n", + "197 | \n", + "0 | \n", + "<|system|>You are about to immerse yourself in... | \n", + "True | \n", + "<|endoftext|><|endoftext|><|endoftext|><|endof... | \n", + "[0.35407448, 0.24763522] | \n", + "0.411546 | \n", + "[0.2403055, 0.13180408] | \n", + "0.354198 | \n", + "False | \n", + "False | \n", + "-0.057348 | \n", + "0.057348 | \n", + "0.382872 | \n", + "False | \n", + "True | \n", + "
| 198 | \n", + "0 | \n", + "198 | \n", + "0 | \n", + "<|system|>You are about to immerse yourself in... | \n", + "True | \n", + "<|endoftext|><|endoftext|><|endoftext|><|endof... | \n", + "[0.4638396, 0.23526415] | \n", + "0.336518 | \n", + "[0.23999612, 0.32018945] | \n", + "0.571567 | \n", + "False | \n", + "True | \n", + "0.235050 | \n", + "0.235050 | \n", + "0.454042 | \n", + "False | \n", + "True | \n", + "
| 199 | \n", + "0 | \n", + "199 | \n", + "1 | \n", + "<|system|>You are about to immerse yourself in... | \n", + "True | \n", + "<|endoftext|><|endoftext|><|endoftext|><|endof... | \n", + "[0.11185194, 0.19989455] | \n", + "0.641188 | \n", + "[0.08340898, 0.47644642] | \n", + "0.851002 | \n", + "True | \n", + "True | \n", + "0.209814 | \n", + "0.209814 | \n", + "0.746095 | \n", + "True | \n", + "False | \n", + "
200 rows × 17 columns
\n", + "╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮\n", - "│ in <module>:4 │\n", - "│ │\n", - "│ 1 # QC check accuracy │\n", - "│ 2 # it should manage to lie some of the time when asked to lie. Many models wont lie unles │\n", - "│ 3 │\n", - "│ ❱ 4 d = df.query('lie==True') │\n", - "│ 5 acc = (d.desired_ans==d.llm_ans).mean() │\n", - "│ 6 print(f\"when the model tries to lie... we get this acc {acc:2.2f}\") │\n", - "│ 7 assert acc>0.1, f\"should be acc>0.1 but is acc={acc}\" │\n", - "╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\n", - "NameError: name 'df' is not defined\n", - "\n" - ], - "text/plain": [ - "\u001b[31m╭─\u001b[0m\u001b[31m──────────────────────────────\u001b[0m\u001b[31m \u001b[0m\u001b[1;31mTraceback \u001b[0m\u001b[1;2;31m(most recent call last)\u001b[0m\u001b[31m \u001b[0m\u001b[31m───────────────────────────────\u001b[0m\u001b[31m─╮\u001b[0m\n", - "\u001b[31m│\u001b[0m in \u001b[92m
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮\n", - "│ in <module>:2 │\n", - "│ │\n", - "│ 1 # QC by viewing a row │\n", - "│ ❱ 2 r = ds4[0] │\n", - "│ 3 print(r['prompt_truncated'][0]) │\n", - "│ 4 print(r['txt_ans']) │\n", - "│ 5 │\n", - "╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\n", - "NameError: name 'ds4' is not defined\n", - "\n" - ], - "text/plain": [ - "\u001b[31m╭─\u001b[0m\u001b[31m──────────────────────────────\u001b[0m\u001b[31m \u001b[0m\u001b[1;31mTraceback \u001b[0m\u001b[1;2;31m(most recent call last)\u001b[0m\u001b[31m \u001b[0m\u001b[31m───────────────────────────────\u001b[0m\u001b[31m─╮\u001b[0m\n", - "\u001b[31m│\u001b[0m in \u001b[92m