Spaces:
Build error
Build error
File size: 44,118 Bytes
7ff7cf3 |
1 2 |
{"cells":[{"cell_type":"code","execution_count":1,"metadata":{"executionInfo":{"elapsed":476,"status":"ok","timestamp":1720679526275,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"},"user_tz":-480},"id":"uWKRSV6eZsCn"},"outputs":[],"source":["%load_ext autoreload\n","%autoreload 2"]},{"cell_type":"code","execution_count":2,"metadata":{"application/vnd.databricks.v1+cell":{"cellMetadata":{"byteLimit":2048000,"rowLimit":10000},"inputWidgets":{},"nuid":"eb33b19f-1206-41ee-84e2-e6258a12eef7","showTitle":false,"title":""},"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":2534,"status":"ok","timestamp":1720679529344,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"},"user_tz":-480},"id":"xwFh14uiZBrI","outputId":"d767799c-34c2-46a5-f052-378146a55321"},"outputs":[],"source":["from pathlib import Path\n","\n","try:\n"," from google.colab import drive\n","\n"," drive.mount(\"/content/drive\")\n"," workding_dir = \"/content/drive/MyDrive/logical-reasoning/\"\n","except ModuleNotFoundError:\n"," workding_dir = str(Path.cwd().parent)"]},{"cell_type":"code","execution_count":3,"metadata":{"application/vnd.databricks.v1+cell":{"cellMetadata":{"byteLimit":2048000,"rowLimit":10000},"inputWidgets":{},"nuid":"6d394937-6c99-4a7c-9d32-7600a280032f","showTitle":false,"title":""},"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":5,"status":"ok","timestamp":1720679529345,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"},"user_tz":-480},"id":"G5pNu3zgZBrL","outputId":"160a554f-fb08-4aa0-bc00-0422fb7c1fac"},"outputs":[{"name":"stdout","output_type":"stream","text":["workding dir: /home/inflaton/code/projects/courses/logical-reasoning\n"]}],"source":["import os\n","import sys\n","from pathlib import Path\n","\n","os.chdir(workding_dir)\n","sys.path.append(workding_dir)\n","print(\"workding dir:\", workding_dir)"]},{"cell_type":"code","execution_count":4,"metadata":{"application/vnd.databricks.v1+cell":{"cellMetadata":{"byteLimit":2048000,"rowLimit":10000},"inputWidgets":{},"nuid":"9f67ec60-2f24-411c-84eb-0dd664b44775","showTitle":false,"title":""},"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":3,"status":"ok","timestamp":1720679529345,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"},"user_tz":-480},"id":"hPCC-6m7ZBrM","outputId":"c7aa2c96-5e99-440a-c148-201d79465ff9"},"outputs":[{"name":"stdout","output_type":"stream","text":["loading env vars from: /home/inflaton/code/projects/courses/logical-reasoning/.env\n"]},{"data":{"text/plain":["True"]},"execution_count":4,"metadata":{},"output_type":"execute_result"}],"source":["from dotenv import find_dotenv, load_dotenv\n","\n","found_dotenv = find_dotenv(\".env\")\n","\n","if len(found_dotenv) == 0:\n"," found_dotenv = find_dotenv(\".env.example\")\n","print(f\"loading env vars from: {found_dotenv}\")\n","load_dotenv(found_dotenv, override=True)"]},{"cell_type":"code","execution_count":5,"metadata":{"application/vnd.databricks.v1+cell":{"cellMetadata":{"byteLimit":2048000,"rowLimit":10000},"inputWidgets":{},"nuid":"f1597656-8042-4878-9d3b-9ebfb8dd86dc","showTitle":false,"title":""},"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":3,"status":"ok","timestamp":1720679529345,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"},"user_tz":-480},"id":"1M3IraVtZBrM","outputId":"29ab35f6-2970-4ade-d85d-3174acf8cda0"},"outputs":[{"name":"stdout","output_type":"stream","text":["internlm/internlm2_5-7b-chat-1m inflaton-ai/InternLM_2_5-7b_LoRA-Adapter True datasets/mgtv results/mgtv-results_internlm_4bit.csv\n"]}],"source":["import os\n","\n","model_name = os.getenv(\"MODEL_NAME\")\n","adapter_name_or_path = os.getenv(\"ADAPTER_NAME_OR_PATH\")\n","load_in_4bit = os.getenv(\"LOAD_IN_4BIT\") == \"true\"\n","data_path = os.getenv(\"LOGICAL_REASONING_DATA_PATH\")\n","results_path = os.getenv(\"LOGICAL_REASONING_RESULTS_PATH\")\n","use_english_datasets = os.getenv(\"USE_ENGLISH_DATASETS\") == \"true\"\n","\n","print(model_name, adapter_name_or_path, load_in_4bit, data_path, results_path)"]},{"cell_type":"code","execution_count":16,"metadata":{"application/vnd.databricks.v1+cell":{"cellMetadata":{"byteLimit":2048000,"rowLimit":10000},"inputWidgets":{},"nuid":"b2a43943-9324-4839-9a47-cfa72de2244b","showTitle":false,"title":""},"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":564,"status":"ok","timestamp":1720679529907,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"},"user_tz":-480},"id":"UgMvt6dIZBrM","outputId":"ce37581c-fd26-46c2-ad87-d933d99f68f7"},"outputs":[{"name":"stdout","output_type":"stream","text":["Python 3.11.9\n","Name: transformers\n","Version: 4.43.0.dev0\n","Summary: State-of-the-art Machine Learning for JAX, PyTorch and TensorFlow\n","Home-page: https://github.com/huggingface/transformers\n","Author: The Hugging Face team (past and future) with the help of all our contributors (https://github.com/huggingface/transformers/graphs/contributors)\n","Author-email: transformers@huggingface.co\n","License: Apache 2.0 License\n","Location: /home/inflaton/miniconda3/envs/llama-factory/lib/python3.11/site-packages\n","Requires: filelock, huggingface-hub, numpy, packaging, pyyaml, regex, requests, safetensors, tokenizers, tqdm\n","Required-by: llamafactory, peft, trl, vllm\n","CPU times: user 121 ms, sys: 61.4 ms, total: 183 ms\n","Wall time: 4.8 s\n"]}],"source":["%%time\n","os.environ[\"TOKENIZERS_PARALLELISM\"] = \"true\"\n","\n","!python --version\n","!pip show transformers"]},{"cell_type":"code","execution_count":7,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":1685,"status":"ok","timestamp":1720679531591,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"},"user_tz":-480},"id":"ZuS_FsLyZBrN","outputId":"2cba0105-c505-4395-afbd-2f2fee6581d0"},"outputs":[{"name":"stdout","output_type":"stream","text":["loading /home/inflaton/code/projects/courses/logical-reasoning/llm_toolkit/logical_reasoning_utils.py\n","GPU is available\n"]}],"source":["from llm_toolkit.llm_utils import *\n","from llm_toolkit.logical_reasoning_utils import *\n","\n","device = check_gpu()"]},{"cell_type":"code","execution_count":8,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["loading model: internlm/internlm2_5-7b-chat-1m with adapter: inflaton-ai/InternLM_2_5-7b_LoRA-Adapter\n"]},{"data":{"application/vnd.jupyter.widget-view+json":{"model_id":"87acc39044d740678c277ce98df127ae","version_major":2,"version_minor":0},"text/plain":["Loading checkpoint shards: 0%| | 0/8 [00:00<?, ?it/s]"]},"metadata":{},"output_type":"display_data"},{"data":{"application/vnd.jupyter.widget-view+json":{"model_id":"98f2d4b6dcd24bc899c5c68f15b8c583","version_major":2,"version_minor":0},"text/plain":["adapter_config.json: 0%| | 0.00/679 [00:00<?, ?B/s]"]},"metadata":{},"output_type":"display_data"},{"data":{"application/vnd.jupyter.widget-view+json":{"model_id":"8b5282f7c87c484ebd9c56fc321a4a6c","version_major":2,"version_minor":0},"text/plain":["adapter_model.safetensors: 0%| | 0.00/37.8M [00:00<?, ?B/s]"]},"metadata":{},"output_type":"display_data"},{"name":"stdout","output_type":"stream","text":["CPU times: user 2min 18s, sys: 9min 43s, total: 12min 2s\n","Wall time: 1h 41min 28s\n"]}],"source":["%%time\n","\n","model, tokenizer = load_model(model_name, adapter_name_or_path=adapter_name_or_path, load_in_4bit=load_in_4bit, using_llama_factory=False)"]},{"cell_type":"code","execution_count":9,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["loading train/test data files\n"]},{"data":{"application/vnd.jupyter.widget-view+json":{"model_id":"f6a9ee0f310e44249f0360774a1e1585","version_major":2,"version_minor":0},"text/plain":["Map: 0%| | 0/25000 [00:00<?, ? examples/s]"]},"metadata":{},"output_type":"display_data"},{"data":{"application/vnd.jupyter.widget-view+json":{"model_id":"b74a5771a94f4321b0d6862bdcc30207","version_major":2,"version_minor":0},"text/plain":["Map: 0%| | 0/3000 [00:00<?, ? examples/s]"]},"metadata":{},"output_type":"display_data"},{"name":"stdout","output_type":"stream","text":["DatasetDict({\n"," train: Dataset({\n"," features: ['text', 'label', 'answer', 'title', 'puzzle', 'truth', 'train_text', 'prompt'],\n"," num_rows: 25000\n"," })\n"," test: Dataset({\n"," features: ['text', 'label', 'answer', 'title', 'puzzle', 'truth', 'train_text', 'prompt'],\n"," num_rows: 3000\n"," })\n","})\n"]}],"source":["datasets = load_logical_reasoning_dataset(\n"," data_path,\n"," tokenizer=tokenizer,\n"," chinese_prompt=not use_english_datasets,\n"," using_p1=False,\n",")"]},{"cell_type":"code","execution_count":10,"metadata":{},"outputs":[],"source":["import numpy as np\n","\n","\n","def evaluate_model_with_repetition_penalty(\n"," model,\n"," tokenizer,\n"," model_name,\n"," dataset,\n"," start_repetition_penalty=1.0,\n"," end_repetition_penalty=1.15,\n"," step_repetition_penalty=0.01,\n","):\n"," print(f\"Evaluating model: {model_name} on {device}\")\n","\n"," for repetition_penalty in np.arange(\n"," start_repetition_penalty,\n"," end_repetition_penalty + step_repetition_penalty,\n"," step_repetition_penalty,\n"," ):\n"," print(f\"*** Evaluating with repetition_penalty: {repetition_penalty}\")\n"," predictions = eval_model(\n"," model,\n"," tokenizer,\n"," dataset,\n"," device=device,\n"," repetition_penalty=repetition_penalty,\n"," max_new_tokens=8,\n"," )\n","\n"," model_name_with_rp = f\"{model_name}_4bit_rp{repetition_penalty}\"\n","\n"," save_results(\n"," model_name_with_rp,\n"," results_path,\n"," dataset,\n"," predictions,\n"," debug=True,\n"," )\n","\n"," metrics = calc_metrics(dataset[\"label\"], predictions, debug=False)\n"," print(metrics)"]},{"cell_type":"code","execution_count":11,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["Evaluating model: internlm/internlm2_5-7b-chat-1m on cuda\n","*** Evaluating with repetition_penalty: 1.0\n"]},{"name":"stderr","output_type":"stream","text":[" 0%| | 1/3000 [00:17<14:45:44, 17.72s/it]"]},{"name":"stdout","output_type":"stream","text":["--------\n","step 1: 不是\n","--------\n","step 2: 不是\n","--------\n","step 3: 不是\n","--------\n","step 4: 不是\n","--------\n","step 5: 不是\n"]},{"name":"stderr","output_type":"stream","text":["100%|██████████| 3000/3000 [2:23:40<00:00, 2.87s/it] \n"]},{"name":"stdout","output_type":"stream","text":[" text label title puzzle \\\n","0 甄加索是自杀吗 不是 海岸之谜 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任... \n","\n"," truth \\\n","0 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在... \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.0 \n","0 不是 \n","{'accuracy': 0.783}\n","*** Evaluating with repetition_penalty: 1.01\n"]},{"name":"stderr","output_type":"stream","text":[" 0%| | 1/3000 [00:01<54:45, 1.10s/it]"]},{"name":"stdout","output_type":"stream","text":["--------\n","step 1: 不是\n","--------\n","step 2: 不是\n","--------\n","step 3: 不是\n","--------\n","step 4: 不是\n","--------\n","step 5: 不是\n"]},{"name":"stderr","output_type":"stream","text":["100%|██████████| 3000/3000 [53:34<00:00, 1.07s/it] \n"]},{"name":"stdout","output_type":"stream","text":[" text label title puzzle \\\n","0 甄加索是自杀吗 不是 海岸之谜 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任... \n","\n"," truth \\\n","0 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在... \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.0 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.01 \n","0 不是 \n","{'accuracy': 0.783}\n","*** Evaluating with repetition_penalty: 1.02\n"]},{"name":"stderr","output_type":"stream","text":[" 0%| | 1/3000 [00:01<52:52, 1.06s/it]"]},{"name":"stdout","output_type":"stream","text":["--------\n","step 1: 不是\n","--------\n","step 2: 不是\n","--------\n","step 3: 不是\n","--------\n","step 4: 不是\n","--------\n","step 5: 不是\n"]},{"name":"stderr","output_type":"stream","text":["100%|██████████| 3000/3000 [53:33<00:00, 1.07s/it] \n"]},{"name":"stdout","output_type":"stream","text":[" text label title puzzle \\\n","0 甄加索是自杀吗 不是 海岸之谜 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任... \n","\n"," truth \\\n","0 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在... \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.0 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.01 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.02 \n","0 不是 \n","{'accuracy': 0.783}\n","*** Evaluating with repetition_penalty: 1.03\n"]},{"name":"stderr","output_type":"stream","text":[" 0%| | 1/3000 [00:01<52:45, 1.06s/it]"]},{"name":"stdout","output_type":"stream","text":["--------\n","step 1: 不是\n","--------\n","step 2: 不是\n","--------\n","step 3: 不是\n","--------\n","step 4: 不是\n","--------\n","step 5: 不是\n"]},{"name":"stderr","output_type":"stream","text":["100%|██████████| 3000/3000 [53:32<00:00, 1.07s/it] \n"]},{"name":"stdout","output_type":"stream","text":[" text label title puzzle \\\n","0 甄加索是自杀吗 不是 海岸之谜 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任... \n","\n"," truth \\\n","0 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在... \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.0 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.01 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.02 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.03 \n","0 不是 \n","{'accuracy': 0.783}\n","*** Evaluating with repetition_penalty: 1.04\n"]},{"name":"stderr","output_type":"stream","text":[" 0%| | 1/3000 [00:01<52:21, 1.05s/it]"]},{"name":"stdout","output_type":"stream","text":["--------\n","step 1: 不是\n","--------\n","step 2: 不是\n","--------\n","step 3: 不是\n","--------\n","step 4: 不是\n","--------\n","step 5: 不是\n"]},{"name":"stderr","output_type":"stream","text":["100%|██████████| 3000/3000 [53:36<00:00, 1.07s/it] \n"]},{"name":"stdout","output_type":"stream","text":[" text label title puzzle \\\n","0 甄加索是自杀吗 不是 海岸之谜 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任... \n","\n"," truth \\\n","0 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在... \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.0 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.01 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.02 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.03 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.04 \n","0 不是 \n","{'accuracy': 0.783}\n","*** Evaluating with repetition_penalty: 1.05\n"]},{"name":"stderr","output_type":"stream","text":[" 0%| | 1/3000 [00:01<51:10, 1.02s/it]"]},{"name":"stdout","output_type":"stream","text":["--------\n","step 1: 不是\n","--------\n","step 2: 不是\n","--------\n","step 3: 不是\n","--------\n","step 4: 不是\n","--------\n","step 5: 不是\n"]},{"name":"stderr","output_type":"stream","text":["100%|██████████| 3000/3000 [51:51<00:00, 1.04s/it] \n"]},{"name":"stdout","output_type":"stream","text":[" text label title puzzle \\\n","0 甄加索是自杀吗 不是 海岸之谜 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任... \n","\n"," truth \\\n","0 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在... \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.0 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.01 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.02 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.03 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.04 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.05 \n","0 不是 \n","{'accuracy': 0.783}\n","*** Evaluating with repetition_penalty: 1.06\n"]},{"name":"stderr","output_type":"stream","text":[" 0%| | 1/3000 [00:01<52:24, 1.05s/it]"]},{"name":"stdout","output_type":"stream","text":["--------\n","step 1: 不是\n","--------\n","step 2: 不是\n","--------\n","step 3: 不是\n","--------\n","step 4: 不是\n","--------\n","step 5: 不是\n"]},{"name":"stderr","output_type":"stream","text":["100%|██████████| 3000/3000 [51:39<00:00, 1.03s/it] \n"]},{"name":"stdout","output_type":"stream","text":[" text label title puzzle \\\n","0 甄加索是自杀吗 不是 海岸之谜 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任... \n","\n"," truth \\\n","0 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在... \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.0 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.01 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.02 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.03 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.04 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.05 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.06 \n","0 不是 \n","{'accuracy': 0.783}\n","*** Evaluating with repetition_penalty: 1.07\n"]},{"name":"stderr","output_type":"stream","text":[" 0%| | 1/3000 [00:01<50:37, 1.01s/it]"]},{"name":"stdout","output_type":"stream","text":["--------\n","step 1: 不是\n","--------\n","step 2: 不是\n","--------\n","step 3: 不是\n","--------\n","step 4: 不是\n","--------\n","step 5: 不是\n"]},{"name":"stderr","output_type":"stream","text":["100%|██████████| 3000/3000 [51:43<00:00, 1.03s/it] \n"]},{"name":"stdout","output_type":"stream","text":[" text label title puzzle \\\n","0 甄加索是自杀吗 不是 海岸之谜 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任... \n","\n"," truth \\\n","0 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在... \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.0 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.01 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.02 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.03 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.04 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.05 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.06 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.07 \n","0 不是 \n","{'accuracy': 0.783}\n","*** Evaluating with repetition_penalty: 1.08\n"]},{"name":"stderr","output_type":"stream","text":[" 0%| | 1/3000 [00:01<51:32, 1.03s/it]"]},{"name":"stdout","output_type":"stream","text":["--------\n","step 1: 不是\n","--------\n","step 2: 不是\n","--------\n","step 3: 不是\n","--------\n","step 4: 不是\n","--------\n","step 5: 不是\n"]},{"name":"stderr","output_type":"stream","text":["100%|██████████| 3000/3000 [51:40<00:00, 1.03s/it] \n"]},{"name":"stdout","output_type":"stream","text":[" text label title puzzle \\\n","0 甄加索是自杀吗 不是 海岸之谜 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任... \n","\n"," truth \\\n","0 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在... \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.0 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.01 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.02 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.03 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.04 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.05 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.06 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.07 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.08 \n","0 不是 \n","{'accuracy': 0.7796666666666666}\n","*** Evaluating with repetition_penalty: 1.09\n"]},{"name":"stderr","output_type":"stream","text":[" 0%| | 1/3000 [00:01<53:33, 1.07s/it]"]},{"name":"stdout","output_type":"stream","text":["--------\n","step 1: 不是\n","--------\n","step 2: 不是\n","--------\n","step 3: 不是\n","--------\n","step 4: 不是\n","--------\n","step 5: 不是\n"]},{"name":"stderr","output_type":"stream","text":["100%|██████████| 3000/3000 [51:40<00:00, 1.03s/it] \n"]},{"name":"stdout","output_type":"stream","text":[" text label title puzzle \\\n","0 甄加索是自杀吗 不是 海岸之谜 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任... \n","\n"," truth \\\n","0 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在... \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.0 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.01 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.02 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.03 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.04 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.05 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.06 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.07 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.08 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.09 \n","0 不是 \n","{'accuracy': 0.694}\n","*** Evaluating with repetition_penalty: 1.1\n"]},{"name":"stderr","output_type":"stream","text":[" 0%| | 1/3000 [00:01<50:35, 1.01s/it]"]},{"name":"stdout","output_type":"stream","text":["--------\n","step 1: 不是\n","--------\n","step 2: 不是\n","--------\n","step 3: 不是\n","--------\n","step 4: 不是\n","--------\n","step 5: 不是\n"]},{"name":"stderr","output_type":"stream","text":["100%|██████████| 3000/3000 [51:39<00:00, 1.03s/it] \n"]},{"name":"stdout","output_type":"stream","text":[" text label title puzzle \\\n","0 甄加索是自杀吗 不是 海岸之谜 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任... \n","\n"," truth \\\n","0 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在... \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.0 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.01 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.02 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.03 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.04 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.05 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.06 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.07 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.08 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.09 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.1 \n","0 不是 \n","{'accuracy': 0.532}\n","*** Evaluating with repetition_penalty: 1.11\n"]},{"name":"stderr","output_type":"stream","text":[" 0%| | 1/3000 [00:01<51:02, 1.02s/it]"]},{"name":"stdout","output_type":"stream","text":["--------\n","step 1: 不是\n","--------\n","step 2: 不是\n","--------\n","step 3: 不是\n","--------\n","step 4: 不是\n","--------\n","step 5: 不是\n"]},{"name":"stderr","output_type":"stream","text":["100%|██████████| 3000/3000 [51:34<00:00, 1.03s/it] \n"]},{"name":"stdout","output_type":"stream","text":[" text label title puzzle \\\n","0 甄加索是自杀吗 不是 海岸之谜 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任... \n","\n"," truth \\\n","0 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在... \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.0 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.01 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.02 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.03 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.04 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.05 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.06 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.07 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.08 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.09 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.1 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.11 \n","0 不是 \n","{'accuracy': 0.4703333333333333}\n","*** Evaluating with repetition_penalty: 1.12\n"]},{"name":"stderr","output_type":"stream","text":[" 0%| | 1/3000 [00:01<50:52, 1.02s/it]"]},{"name":"stdout","output_type":"stream","text":["--------\n","step 1: 不是\n","--------\n","step 2: 不是\n","--------\n","step 3: 不是\n","--------\n","step 4: 不是\n","--------\n","step 5: 不是\n"]},{"name":"stderr","output_type":"stream","text":["100%|██████████| 3000/3000 [53:35<00:00, 1.07s/it] \n"]},{"name":"stdout","output_type":"stream","text":[" text label title puzzle \\\n","0 甄加索是自杀吗 不是 海岸之谜 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任... \n","\n"," truth \\\n","0 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在... \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.0 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.01 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.02 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.03 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.04 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.05 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.06 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.07 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.08 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.09 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.1 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.11 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.12 \n","0 不是 \n","{'accuracy': 0.438}\n","*** Evaluating with repetition_penalty: 1.1300000000000001\n"]},{"name":"stderr","output_type":"stream","text":[" 0%| | 1/3000 [00:01<53:19, 1.07s/it]"]},{"name":"stdout","output_type":"stream","text":["--------\n","step 1: 不是\n","--------\n","step 2: 不是\n","--------\n","step 3: 不是\n","--------\n","step 4: 不是\n","--------\n","step 5: 不是\n"]},{"name":"stderr","output_type":"stream","text":["100%|██████████| 3000/3000 [52:44<00:00, 1.05s/it] \n"]},{"name":"stdout","output_type":"stream","text":[" text label title puzzle \\\n","0 甄加索是自杀吗 不是 海岸之谜 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任... \n","\n"," truth \\\n","0 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在... \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.0 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.01 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.02 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.03 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.04 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.05 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.06 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.07 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.08 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.09 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.1 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.11 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.12 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.1300000000000001 \n","0 不是 \n","{'accuracy': 0.4076666666666667}\n","*** Evaluating with repetition_penalty: 1.1400000000000001\n"]},{"name":"stderr","output_type":"stream","text":[" 0%| | 1/3000 [00:01<51:16, 1.03s/it]"]},{"name":"stdout","output_type":"stream","text":["--------\n","step 1: 不是\n","--------\n","step 2: 不是\n","--------\n","step 3: 不是\n","--------\n","step 4: 不是\n","--------\n","step 5: 不是\n"]},{"name":"stderr","output_type":"stream","text":["100%|██████████| 3000/3000 [52:24<00:00, 1.05s/it] \n"]},{"name":"stdout","output_type":"stream","text":[" text label title puzzle \\\n","0 甄加索是自杀吗 不是 海岸之谜 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任... \n","\n"," truth \\\n","0 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在... \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.0 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.01 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.02 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.03 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.04 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.05 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.06 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.07 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.08 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.09 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.1 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.11 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.12 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.1300000000000001 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.1400000000000001 \n","0 不是 \n","{'accuracy': 0.35933333333333334}\n","*** Evaluating with repetition_penalty: 1.1500000000000001\n"]},{"name":"stderr","output_type":"stream","text":[" 0%| | 1/3000 [00:01<51:49, 1.04s/it]"]},{"name":"stdout","output_type":"stream","text":["--------\n","step 1: 不是\n","--------\n","step 2: 不是\n","--------\n","step 3: 不是\n","--------\n","step 4: 不是\n","--------\n","step 5: 不是\n"]},{"name":"stderr","output_type":"stream","text":["100%|██████████| 3000/3000 [53:06<00:00, 1.06s/it] \n"]},{"name":"stdout","output_type":"stream","text":[" text label title puzzle \\\n","0 甄加索是自杀吗 不是 海岸之谜 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任... \n","\n"," truth \\\n","0 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在... \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.0 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.01 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.02 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.03 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.04 ... \\\n","0 不是 ... \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.06 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.07 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.08 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.09 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.1 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.11 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.12 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.1300000000000001 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.1400000000000001 \\\n","0 不是 \n","\n"," internlm/internlm2_5-7b-chat-1m_4bit_rp1.1500000000000001 \n","0 不是 \n","\n","[1 rows x 21 columns]\n","{'accuracy': 0.301}\n","CPU times: user 14h 58min 15s, sys: 35min 2s, total: 15h 33min 18s\n","Wall time: 15h 31min 41s\n"]}],"source":["%%time\n","\n","evaluate_model_with_repetition_penalty(model, tokenizer, model_name, datasets[\"test\"])"]}],"metadata":{"accelerator":"GPU","application/vnd.databricks.v1+notebook":{"dashboards":[],"environmentMetadata":null,"language":"python","notebookMetadata":{"mostRecentlyExecutedCommandWithImplicitDF":{"commandId":-1,"dataframes":["_sqldf"]},"pythonIndentUnit":4},"notebookName":"10_eval-lf-medium-py3.11","widgets":{}},"colab":{"gpuType":"L4","provenance":[]},"kernelspec":{"display_name":"Python 3","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.9"}},"nbformat":4,"nbformat_minor":0}
|