{"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/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/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 False datasets/mgtv results/mgtv-results_nv4090.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":6,"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.41.2\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/llm-finetuning/lib/python3.11/site-packages\n","Requires: filelock, huggingface-hub, numpy, packaging, pyyaml, regex, requests, safetensors, tokenizers, tqdm\n","Required-by: llamafactory, peft, trl\n","---\n","Name: torch\n","Version: 2.3.1\n","Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration\n","Home-page: https://pytorch.org/\n","Author: PyTorch Team\n","Author-email: packages@pytorch.org\n","License: BSD-3\n","Location: /home/inflaton/miniconda3/envs/llm-finetuning/lib/python3.11/site-packages\n","Requires: filelock, fsspec, jinja2, networkx, nvidia-cublas-cu12, nvidia-cuda-cupti-cu12, nvidia-cuda-nvrtc-cu12, nvidia-cuda-runtime-cu12, nvidia-cudnn-cu12, nvidia-cufft-cu12, nvidia-curand-cu12, nvidia-cusolver-cu12, nvidia-cusparse-cu12, nvidia-nccl-cu12, nvidia-nvtx-cu12, sympy, triton, typing-extensions\n","Required-by: accelerate, bitsandbytes, peft, trl\n","---\n","Name: bitsandbytes\n","Version: 0.43.1\n","Summary: k-bit optimizers and matrix multiplication routines.\n","Home-page: https://github.com/TimDettmers/bitsandbytes\n","Author: Tim Dettmers\n","Author-email: dettmers@cs.washington.edu\n","License: MIT\n","Location: /home/inflaton/miniconda3/envs/llm-finetuning/lib/python3.11/site-packages\n","Requires: numpy, torch\n","Required-by: \n","CPU times: user 23.7 ms, sys: 493 μs, total: 24.1 ms\n","Wall time: 2.5 s\n"]}],"source":["%%time\n","!python --version\n","!pip show transformers torch bitsandbytes"]},{"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/logical-reasoning/llm_toolkit/logical_reasoning_utils.py\n","CUDA is available, we have found 1 GPU(s)\n","NVIDIA GeForce RTX 4090\n","CUDA version: 12.1\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":["Current Directory:\n","/home/inflaton/code/logical-reasoning\n","Mon Jul 22 23:01:18 2024 \n","+---------------------------------------------------------------------------------------+\n","| NVIDIA-SMI 535.54.04 Driver Version: 536.25 CUDA Version: 12.2 |\n","|-----------------------------------------+----------------------+----------------------+\n","| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |\n","| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |\n","| | | MIG M. |\n","|=========================================+======================+======================|\n","| 0 NVIDIA GeForce RTX 4090 On | 00000000:01:00.0 Off | Off |\n","| 0% 48C P8 16W / 450W | 1483MiB / 24564MiB | 4% Default |\n","| | | N/A |\n","+-----------------------------------------+----------------------+----------------------+\n"," \n","+---------------------------------------------------------------------------------------+\n","| Processes: |\n","| GPU GI CI PID Type Process name GPU Memory |\n","| ID ID Usage |\n","|=======================================================================================|\n","| No running processes found |\n","+---------------------------------------------------------------------------------------+\n","Linux Gen-AI 5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct 5 21:02:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux\n","PRETTY_NAME=\"Ubuntu 22.04.2 LTS\"\n","NAME=\"Ubuntu\"\n","VERSION_ID=\"22.04\"\n","VERSION=\"22.04.2 LTS (Jammy Jellyfish)\"\n","VERSION_CODENAME=jammy\n","ID=ubuntu\n","ID_LIKE=debian\n","HOME_URL=\"https://www.ubuntu.com/\"\n","SUPPORT_URL=\"https://help.ubuntu.com/\"\n","BUG_REPORT_URL=\"https://bugs.launchpad.net/ubuntu/\"\n","PRIVACY_POLICY_URL=\"https://www.ubuntu.com/legal/terms-and-policies/privacy-policy\"\n","UBUNTU_CODENAME=jammy\n","Architecture: x86_64\n"," CPU op-mode(s): 32-bit, 64-bit\n"," Address sizes: 39 bits physical, 48 bits virtual\n"," Byte Order: Little Endian\n","CPU(s): 32\n"," On-line CPU(s) list: 0-31\n","Vendor ID: GenuineIntel\n"," Model name: 13th Gen Intel(R) Core(TM) i9-13900KF\n"," CPU family: 6\n"," Model: 183\n"," Thread(s) per core: 2\n"," Core(s) per socket: 16\n"," Socket(s): 1\n"," Stepping: 1\n"," BogoMIPS: 5990.40\n"," Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mc\n"," a cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscal\n"," l nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopo\n"," logy tsc_reliable nonstop_tsc cpuid pni pclmulqdq vmx s\n"," sse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt tsc_dea\n"," dline_timer aes xsave avx f16c rdrand hypervisor lahf_l\n"," m abm 3dnowprefetch ssbd ibrs ibpb stibp ibrs_enhanced \n"," tpr_shadow vnmi ept vpid ept_ad fsgsbase tsc_adjust bmi\n"," 1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushop\n"," t clwb sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni u\n"," mip waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64\n"," b fsrm md_clear serialize flush_l1d arch_capabilities\n","Virtualization features: \n"," Virtualization: VT-x\n"," Hypervisor vendor: Microsoft\n"," Virtualization type: full\n","Caches (sum of all): \n"," L1d: 768 KiB (16 instances)\n"," L1i: 512 KiB (16 instances)\n"," L2: 32 MiB (16 instances)\n"," L3: 36 MiB (1 instance)\n","Vulnerabilities: \n"," Gather data sampling: Not affected\n"," Itlb multihit: Not affected\n"," L1tf: Not affected\n"," Mds: Not affected\n"," Meltdown: Not affected\n"," Mmio stale data: Not affected\n"," Retbleed: Mitigation; Enhanced IBRS\n"," Spec rstack overflow: Not affected\n"," Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl\n"," and seccomp\n"," Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer\n"," sanitization\n"," Spectre v2: Mitigation; Enhanced IBRS, IBPB conditional, RSB fillin\n"," g, PBRSB-eIBRS SW sequence\n"," Srbds: Not affected\n"," Tsx async abort: Not affected\n","MemTotal: 49330020 kB\n","Eval internlm/internlm2_5-7b-chat-1m with inflaton-ai/InternLM_2_5-7b_LoRA-Adapter\n","loading env vars from: /home/inflaton/code/logical-reasoning/.env\n","Adding /home/inflaton/code/logical-reasoning to sys.path\n","loading /home/inflaton/code/logical-reasoning/llm_toolkit/logical_reasoning_utils.py\n","internlm/internlm2_5-7b-chat-1m inflaton-ai/InternLM_2_5-7b_LoRA-Adapter True datasets/mgtv results/mgtv-results_internlm_nv4090.csv\n","(1) GPU = NVIDIA GeForce RTX 4090. Max memory = 23.988 GB.\n","0.0 GB of memory reserved.\n","loading model: internlm/internlm2_5-7b-chat-1m with adapter: inflaton-ai/InternLM_2_5-7b_LoRA-Adapter\n","[INFO|tokenization_utils_base.py:2108] 2024-07-22 23:01:35,039 >> loading file ./tokenizer.model from cache at /home/inflaton/.cache/huggingface/hub/models--internlm--internlm2_5-7b-chat-1m/snapshots/8d1a709a04d71440ef3df6ebbe204672f411c8b6/./tokenizer.model\n","[INFO|tokenization_utils_base.py:2108] 2024-07-22 23:01:35,039 >> loading file added_tokens.json from cache at None\n","[INFO|tokenization_utils_base.py:2108] 2024-07-22 23:01:35,039 >> loading file special_tokens_map.json from cache at /home/inflaton/.cache/huggingface/hub/models--internlm--internlm2_5-7b-chat-1m/snapshots/8d1a709a04d71440ef3df6ebbe204672f411c8b6/special_tokens_map.json\n","[INFO|tokenization_utils_base.py:2108] 2024-07-22 23:01:35,039 >> loading file tokenizer_config.json from cache at /home/inflaton/.cache/huggingface/hub/models--internlm--internlm2_5-7b-chat-1m/snapshots/8d1a709a04d71440ef3df6ebbe204672f411c8b6/tokenizer_config.json\n","[INFO|tokenization_utils_base.py:2108] 2024-07-22 23:01:35,039 >> loading file tokenizer.json from cache at None\n","07/22/2024 23:01:35 - INFO - llamafactory.data.template - Add <|im_end|> to stop words.\n","/home/inflaton/miniconda3/envs/llm-finetuning/lib/python3.11/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","[INFO|configuration_utils.py:733] 2024-07-22 23:01:42,888 >> loading configuration file config.json from cache at /home/inflaton/.cache/huggingface/hub/models--internlm--internlm2_5-7b-chat-1m/snapshots/8d1a709a04d71440ef3df6ebbe204672f411c8b6/config.json\n","[INFO|configuration_utils.py:733] 2024-07-22 23:01:55,539 >> loading configuration file config.json from cache at /home/inflaton/.cache/huggingface/hub/models--internlm--internlm2_5-7b-chat-1m/snapshots/8d1a709a04d71440ef3df6ebbe204672f411c8b6/config.json\n","[INFO|configuration_utils.py:796] 2024-07-22 23:01:55,540 >> Model config InternLM2Config {\n"," \"_name_or_path\": \"internlm/internlm2_5-7b-chat-1m\",\n"," \"architectures\": [\n"," \"InternLM2ForCausalLM\"\n"," ],\n"," \"attn_implementation\": \"eager\",\n"," \"auto_map\": {\n"," \"AutoConfig\": \"internlm/internlm2_5-7b-chat-1m--configuration_internlm2.InternLM2Config\",\n"," \"AutoModel\": \"internlm/internlm2_5-7b-chat-1m--modeling_internlm2.InternLM2ForCausalLM\",\n"," \"AutoModelForCausalLM\": \"internlm/internlm2_5-7b-chat-1m--modeling_internlm2.InternLM2ForCausalLM\"\n"," },\n"," \"bias\": false,\n"," \"bos_token_id\": 1,\n"," \"eos_token_id\": 2,\n"," \"hidden_act\": \"silu\",\n"," \"hidden_size\": 4096,\n"," \"initializer_range\": 0.02,\n"," \"intermediate_size\": 14336,\n"," \"max_position_embeddings\": 262144,\n"," \"model_type\": \"internlm2\",\n"," \"num_attention_heads\": 32,\n"," \"num_hidden_layers\": 32,\n"," \"num_key_value_heads\": 8,\n"," \"pad_token_id\": 2,\n"," \"pretraining_tp\": 1,\n"," \"rms_norm_eps\": 1e-05,\n"," \"rope_scaling\": {\n"," \"factor\": 2.5,\n"," \"type\": \"dynamic\"\n"," },\n"," \"rope_theta\": 50000000,\n"," \"tie_word_embeddings\": false,\n"," \"torch_dtype\": \"bfloat16\",\n"," \"transformers_version\": \"4.41.2\",\n"," \"use_cache\": true,\n"," \"vocab_size\": 92544\n","}\n","\n","07/22/2024 23:01:55 - INFO - llamafactory.model.model_utils.quantization - Quantizing model to 4 bit with bitsandbytes.\n","07/22/2024 23:01:55 - INFO - llamafactory.model.patcher - Using KV cache for faster generation.\n","[INFO|modeling_utils.py:3474] 2024-07-22 23:02:00,408 >> loading weights file model.safetensors from cache at /home/inflaton/.cache/huggingface/hub/models--internlm--internlm2_5-7b-chat-1m/snapshots/8d1a709a04d71440ef3df6ebbe204672f411c8b6/model.safetensors.index.json\n","[INFO|modeling_utils.py:1519] 2024-07-22 23:02:00,408 >> Instantiating InternLM2ForCausalLM model under default dtype torch.bfloat16.\n","[INFO|configuration_utils.py:962] 2024-07-22 23:02:00,409 >> Generate config GenerationConfig {\n"," \"bos_token_id\": 1,\n"," \"eos_token_id\": 2,\n"," \"pad_token_id\": 2\n","}\n","\n","Loading checkpoint shards: 100%|██████████████████| 8/8 [00:03<00:00, 2.36it/s]\n","[INFO|modeling_utils.py:4280] 2024-07-22 23:02:04,006 >> All model checkpoint weights were used when initializing InternLM2ForCausalLM.\n","\n","[INFO|modeling_utils.py:4288] 2024-07-22 23:02:04,006 >> All the weights of InternLM2ForCausalLM were initialized from the model checkpoint at internlm/internlm2_5-7b-chat-1m.\n","If your task is similar to the task the model of the checkpoint was trained on, you can already use InternLM2ForCausalLM for predictions without further training.\n","[INFO|configuration_utils.py:917] 2024-07-22 23:02:14,018 >> loading configuration file generation_config.json from cache at /home/inflaton/.cache/huggingface/hub/models--internlm--internlm2_5-7b-chat-1m/snapshots/8d1a709a04d71440ef3df6ebbe204672f411c8b6/generation_config.json\n","[INFO|configuration_utils.py:962] 2024-07-22 23:02:14,018 >> Generate config GenerationConfig {\n"," \"bos_token_id\": 1,\n"," \"eos_token_id\": [\n"," 2,\n"," 92542\n"," ],\n"," \"pad_token_id\": 2\n","}\n","\n","07/22/2024 23:02:14 - INFO - llamafactory.model.model_utils.attention - Using vanilla attention implementation.\n","07/22/2024 23:02:43 - INFO - llamafactory.model.adapter - Loaded adapter(s): inflaton-ai/InternLM_2_5-7b_LoRA-Adapter\n","07/22/2024 23:02:43 - INFO - llamafactory.model.loader - all params: 7,756,582,912\n","(2) GPU = NVIDIA GeForce RTX 4090. Max memory = 23.988 GB.\n","4.859 GB of memory reserved.\n","loading train/test data files\n","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","--------------------------------------------------\n","text: 甄加索是自杀吗\n","--------------------------------------------------\n","label: 不是\n","--------------------------------------------------\n","answer: nan\n","--------------------------------------------------\n","title: 海岸之谜\n","--------------------------------------------------\n","puzzle: 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任何打斗的迹象。请问甄加索的死因是什么?\n","--------------------------------------------------\n","truth: 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在创作一幅描绘海洋生物的画作。在画即将完成的前一天晚上,他骑着自行车外出,打算在海边观赏夜景。然而,他在沙滩上意外发现了一只搁浅的海豚,为了救助这只海豚,他耗费了极大的体力,最终成功将其送回海中。筋疲力尽的甄加索在沙滩上睡着了,由于他患有严重的心脏病,却未告知旁人,在寒冷的海风中,他的心脏停止了跳动。因此,警方在现场只发现了车轮痕迹和未完成的画作,而没有发现任何他杀的迹象。\n","--------------------------------------------------\n","train_text: <|im_start|>system\n","You are an expert in logical reasoning.<|im_end|>\n","<|im_start|>user\n","你是一个情景猜谜游戏的主持人。游戏规则如下:\n","\n","1. 参与者会得到一个谜面,谜面会描述一个简单又难以理解的事件。\n","2. 主持人知道谜底,谜底是谜面的答案。\n","3. 参与者可以询问任何封闭式问题来找寻事件的真相。\n","4. 对于每个问题,主持人将根据实际情况回答以下五个选项之一:是、不是、不重要、回答正确、问法错误。各回答的判断标准如下:\n"," - 若谜面和谜底能找到问题的答案,回答:是或者不是\n"," - 若谜面和谜底不能直接或者间接推断出问题的答案,回答:不重要\n"," - 若参与者提问不是一个封闭式问题或者问题难以理解,回答:问法错误\n"," - 若参与者提问基本还原了谜底真相,回答:回答正确\n","5. 回答中不能添加任何其它信息,也不能省略选项中的任何一个字。例如,不可以把“不是”省略成“不”。\n","\n","请严格按照这些规则回答参与者提出的问题。\n","\n","**谜面:** 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任何打斗的迹象。请问甄加索的死因是什么?\n","\n","**谜底:** 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在创作一幅描绘海洋生物的画作。在画即将完成的前一天晚上,他骑着自行车外出,打算在海边观赏夜景。然而,他在沙滩上意外发现了一只搁浅的海豚,为了救助这只海豚,他耗费了极大的体力,最终成功将其送回海中。筋疲力尽的甄加索在沙滩上睡着了,由于他患有严重的心脏病,却未告知旁人,在寒冷的海风中,他的心脏停止了跳动。因此,警方在现场只发现了车轮痕迹和未完成的画作,而没有发现任何他杀的迹象。\n","\n","**参与者提出的问题:** 甄加索是自杀吗\n","<|im_end|>\n","<|im_start|>assistant\n","不是\n","--------------------------------------------------\n","prompt: <|im_start|>system\n","You are an expert in logical reasoning.<|im_end|>\n","<|im_start|>user\n","你是一个情景猜谜游戏的主持人。游戏规则如下:\n","\n","1. 参与者会得到一个谜面,谜面会描述一个简单又难以理解的事件。\n","2. 主持人知道谜底,谜底是谜面的答案。\n","3. 参与者可以询问任何封闭式问题来找寻事件的真相。\n","4. 对于每个问题,主持人将根据实际情况回答以下五个选项之一:是、不是、不重要、回答正确、问法错误。各回答的判断标准如下:\n"," - 若谜面和谜底能找到问题的答案,回答:是或者不是\n"," - 若谜面和谜底不能直接或者间接推断出问题的答案,回答:不重要\n"," - 若参与者提问不是一个封闭式问题或者问题难以理解,回答:问法错误\n"," - 若参与者提问基本还原了谜底真相,回答:回答正确\n","5. 回答中不能添加任何其它信息,也不能省略选项中的任何一个字。例如,不可以把“不是”省略成“不”。\n","\n","请严格按照这些规则回答参与者提出的问题。\n","\n","**谜面:** 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任何打斗的迹象。请问甄加索的死因是什么?\n","\n","**谜底:** 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在创作一幅描绘海洋生物的画作。在画即将完成的前一天晚上,他骑着自行车外出,打算在海边观赏夜景。然而,他在沙滩上意外发现了一只搁浅的海豚,为了救助这只海豚,他耗费了极大的体力,最终成功将其送回海中。筋疲力尽的甄加索在沙滩上睡着了,由于他患有严重的心脏病,却未告知旁人,在寒冷的海风中,他的心脏停止了跳动。因此,警方在现场只发现了车轮痕迹和未完成的画作,而没有发现任何他杀的迹象。\n","\n","**参与者提出的问题:** 甄加索是自杀吗\n","<|im_end|>\n","<|im_start|>assistant\n","\n","--------------------------------------------------\n","text: 死者受伤了吗\n","--------------------------------------------------\n","label: 不是\n","--------------------------------------------------\n","answer: nan\n","--------------------------------------------------\n","title: 甄庄哭声\n","--------------------------------------------------\n","puzzle: 在一个安静的夜晚,小村庄的湖边突然传来了阵阵哭泣声。第二天早晨,村长甄锐发现湖边的石头上放着一顶破旧的帽子,但没有人知道这顶帽子是从哪里来的,哭泣声又是为何。请还原故事真相。\n","--------------------------------------------------\n","truth: 原来,这顶破旧的帽子属于一个小男孩,他小时候与爷爷在湖边生活。爷爷教他钓鱼、游泳,还告诉他湖中的海龟是他们的朋友。后来,小男孩随父母去了城市生活,但每年夏天都会回到村子探望爷爷。然而,去年夏天,爷爷因病去世,小男孩伤心欲绝。今年夏天,他回到村子,来到湖边,想起和爷爷的美好回忆,忍不住哭泣。他将爷爷的帽子放在湖边的石头上,希望能让爷爷的在天之灵得到安慰。那晚的哭泣声正是小男孩在祭莫他亲爱的爷爷。\n","--------------------------------------------------\n","train_text: <|im_start|>system\n","You are an expert in logical reasoning.<|im_end|>\n","<|im_start|>user\n","你是一个情景猜谜游戏的主持人。游戏规则如下:\n","\n","1. 参与者会得到一个谜面,谜面会描述一个简单又难以理解的事件。\n","2. 主持人知道谜底,谜底是谜面的答案。\n","3. 参与者可以询问任何封闭式问题来找寻事件的真相。\n","4. 对于每个问题,主持人将根据实际情况回答以下五个选项之一:是、不是、不重要、回答正确、问法错误。各回答的判断标准如下:\n"," - 若谜面和谜底能找到问题的答案,回答:是或者不是\n"," - 若谜面和谜底不能直接或者间接推断出问题的答案,回答:不重要\n"," - 若参与者提问不是一个封闭式问题或者问题难以理解,回答:问法错误\n"," - 若参与者提问基本还原了谜底真相,回答:回答正确\n","5. 回答中不能添加任何其它信息,也不能省略选项中的任何一个字。例如,不可以把“不是”省略成“不”。\n","\n","请严格按照这些规则回答参与者提出的问题。\n","\n","**谜面:** 在一个安静的夜晚,小村庄的湖边突然传来了阵阵哭泣声。第二天早晨,村长甄锐发现湖边的石头上放着一顶破旧的帽子,但没有人知道这顶帽子是从哪里来的,哭泣声又是为何。请还原故事真相。\n","\n","**谜底:** 原来,这顶破旧的帽子属于一个小男孩,他小时候与爷爷在湖边生活。爷爷教他钓鱼、游泳,还告诉他湖中的海龟是他们的朋友。后来,小男孩随父母去了城市生活,但每年夏天都会回到村子探望爷爷。然而,去年夏天,爷爷因病去世,小男孩伤心欲绝。今年夏天,他回到村子,来到湖边,想起和爷爷的美好回忆,忍不住哭泣。他将爷爷的帽子放在湖边的石头上,希望能让爷爷的在天之灵得到安慰。那晚的哭泣声正是小男孩在祭莫他亲爱的爷爷。\n","\n","**参与者提出的问题:** 死者受伤了吗\n","<|im_end|>\n","<|im_start|>assistant\n","不是\n","--------------------------------------------------\n","prompt: <|im_start|>system\n","You are an expert in logical reasoning.<|im_end|>\n","<|im_start|>user\n","你是一个情景猜谜游戏的主持人。游戏规则如下:\n","\n","1. 参与者会得到一个谜面,谜面会描述一个简单又难以理解的事件。\n","2. 主持人知道谜底,谜底是谜面的答案。\n","3. 参与者可以询问任何封闭式问题来找寻事件的真相。\n","4. 对于每个问题,主持人将根据实际情况回答以下五个选项之一:是、不是、不重要、回答正确、问法错误。各回答的判断标准如下:\n"," - 若谜面和谜底能找到问题的答案,回答:是或者不是\n"," - 若谜面和谜底不能直接或者间接推断出问题的答案,回答:不重要\n"," - 若参与者提问不是一个封闭式问题或者问题难以理解,回答:问法错误\n"," - 若参与者提问基本还原了谜底真相,回答:回答正确\n","5. 回答中不能添加任何其它信息,也不能省略选项中的任何一个字。例如,不可以把“不是”省略成“不”。\n","\n","请严格按照这些规则回答参与者提出的问题。\n","\n","**谜面:** 在一个安静的夜晚,小村庄的湖边突然传来了阵阵哭泣声。第二天早晨,村长甄锐发现湖边的石头上放着一顶破旧的帽子,但没有人知道这顶帽子是从哪里来的,哭泣声又是为何。请还原故事真相。\n","\n","**谜底:** 原来,这顶破旧的帽子属于一个小男孩,他小时候与爷爷在湖边生活。爷爷教他钓鱼、游泳,还告诉他湖中的海龟是他们的朋友。后来,小男孩随父母去了城市生活,但每年夏天都会回到村子探望爷爷。然而,去年夏天,爷爷因病去世,小男孩伤心欲绝。今年夏天,他回到村子,来到湖边,想起和爷爷的美好回忆,忍不住哭泣。他将爷爷的帽子放在湖边的石头上,希望能让爷爷的在天之灵得到安慰。那晚的哭泣声正是小男孩在祭莫他亲爱的爷爷。\n","\n","**参与者提出的问题:** 死者受伤了吗\n","<|im_end|>\n","<|im_start|>assistant\n","\n","Evaluating model: internlm/internlm2_5-7b-chat-1m\n"," 0%| | 0/3000 [00:00, ?it/s]Batch output: ['不是']\n","100%|███████████████████████████████████████| 3000/3000 [10:38<00:00, 4.70it/s]\n","(3) GPU = NVIDIA GeForce RTX 4090. Max memory = 23.988 GB.\n","6.988 GB of memory reserved.\n"," text ... internlm/internlm2_5-7b-chat-1m/InternLM_2_5-7b_LoRA-Adapter_torch.bfloat16_4bit_lf\n","0 甄加索是自杀吗 ... 不是 \n","\n","[1 rows x 15 columns]\n","{'accuracy': 0.8033333333333333, 'incorrect_ids': [6, 9, 16, 18, 29, 36, 55, 58, 59, 61, 65, 66, 67, 78, 81, 83, 84, 88, 91, 99, 103, 104, 106, 112, 115, 121, 128, 129, 135, 139, 143, 149, 150, 153, 155, 161, 164, 170, 173, 190, 199, 200, 202, 222, 224, 228, 236, 240, 245, 250, 252, 259, 260, 269, 271, 275, 276, 284, 286, 293, 299, 304, 314, 317, 318, 320, 323, 325, 328, 330, 334, 335, 337, 338, 346, 350, 353, 355, 356, 360, 361, 368, 370, 373, 377, 383, 384, 386, 389, 397, 410, 428, 429, 430, 432, 438, 445, 447, 450, 452, 454, 456, 457, 458, 465, 469, 470, 471, 472, 476, 479, 481, 490, 495, 497, 501, 502, 506, 507, 508, 510, 511, 514, 517, 518, 519, 520, 530, 536, 538, 540, 560, 566, 570, 571, 579, 581, 589, 591, 593, 597, 601, 613, 614, 621, 622, 625, 628, 632, 636, 644, 647, 650, 666, 671, 682, 686, 690, 695, 702, 708, 720, 721, 727, 729, 730, 734, 739, 740, 754, 758, 760, 770, 774, 778, 788, 791, 795, 798, 801, 805, 809, 817, 819, 820, 821, 823, 824, 826, 828, 832, 837, 840, 841, 847, 856, 861, 866, 869, 870, 875, 886, 889, 890, 894, 899, 901, 904, 927, 935, 937, 942, 945, 952, 962, 964, 966, 969, 980, 982, 991, 994, 998, 1001, 1003, 1006, 1011, 1012, 1014, 1015, 1019, 1022, 1036, 1038, 1043, 1051, 1057, 1061, 1077, 1080, 1087, 1089, 1096, 1120, 1125, 1126, 1129, 1158, 1161, 1166, 1172, 1174, 1177, 1178, 1180, 1181, 1185, 1198, 1203, 1212, 1228, 1232, 1239, 1240, 1241, 1251, 1252, 1254, 1258, 1259, 1266, 1282, 1289, 1298, 1305, 1308, 1311, 1313, 1315, 1317, 1324, 1331, 1332, 1339, 1342, 1349, 1353, 1363, 1364, 1365, 1367, 1379, 1385, 1387, 1388, 1389, 1400, 1406, 1409, 1412, 1417, 1420, 1422, 1426, 1440, 1451, 1453, 1454, 1455, 1459, 1462, 1469, 1476, 1478, 1486, 1490, 1493, 1494, 1496, 1501, 1504, 1512, 1517, 1518, 1525, 1526, 1547, 1554, 1560, 1562, 1585, 1590, 1593, 1594, 1603, 1604, 1605, 1613, 1622, 1627, 1633, 1636, 1637, 1641, 1645, 1647, 1650, 1654, 1655, 1658, 1659, 1662, 1665, 1672, 1673, 1674, 1679, 1686, 1691, 1695, 1712, 1716, 1718, 1721, 1726, 1727, 1731, 1734, 1736, 1751, 1755, 1756, 1766, 1769, 1780, 1786, 1791, 1798, 1809, 1812, 1816, 1835, 1858, 1860, 1867, 1869, 1877, 1879, 1880, 1888, 1894, 1897, 1907, 1914, 1915, 1919, 1945, 1953, 1958, 1963, 1964, 1971, 1973, 1978, 1981, 1984, 1986, 1989, 1990, 1995, 2017, 2021, 2028, 2029, 2035, 2036, 2044, 2046, 2049, 2054, 2064, 2067, 2070, 2076, 2077, 2106, 2109, 2110, 2119, 2120, 2121, 2126, 2133, 2147, 2159, 2160, 2161, 2162, 2164, 2172, 2174, 2177, 2185, 2186, 2192, 2193, 2194, 2195, 2196, 2197, 2199, 2212, 2222, 2223, 2226, 2233, 2237, 2240, 2243, 2250, 2262, 2265, 2274, 2278, 2280, 2281, 2285, 2297, 2304, 2311, 2317, 2320, 2322, 2324, 2330, 2333, 2339, 2344, 2348, 2349, 2352, 2354, 2360, 2364, 2366, 2367, 2378, 2389, 2395, 2396, 2400, 2404, 2406, 2409, 2410, 2423, 2429, 2440, 2442, 2454, 2463, 2488, 2511, 2512, 2515, 2517, 2522, 2529, 2530, 2532, 2535, 2538, 2546, 2548, 2549, 2553, 2556, 2559, 2560, 2562, 2575, 2581, 2589, 2590, 2616, 2629, 2632, 2644, 2663, 2664, 2667, 2676, 2678, 2714, 2716, 2731, 2736, 2742, 2745, 2746, 2749, 2754, 2757, 2758, 2762, 2766, 2770, 2777, 2787, 2788, 2791, 2797, 2798, 2806, 2807, 2815, 2816, 2820, 2823, 2837, 2843, 2854, 2857, 2860, 2861, 2877, 2880, 2882, 2884, 2899, 2902, 2905, 2912, 2913, 2916, 2921, 2933, 2937, 2942, 2944, 2949, 2953, 2964, 2968, 2969, 2977, 2979, 2985, 2995, 2998]}\n","CPU times: user 4.95 s, sys: 1.69 s, total: 6.64 s\n","Wall time: 12min 8s\n"]}],"source":["%%time\n","\n","os.environ[\"USING_LLAMA_FACTORY\"] = \"true\"\n","!./scripts/eval-mgtv-nv4090.sh"]},{"cell_type":"code","execution_count":10,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["Current Directory:\n","/home/inflaton/code/logical-reasoning\n","Mon Jul 22 23:23:06 2024 \n","+---------------------------------------------------------------------------------------+\n","| NVIDIA-SMI 535.54.04 Driver Version: 536.25 CUDA Version: 12.2 |\n","|-----------------------------------------+----------------------+----------------------+\n","| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |\n","| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |\n","| | | MIG M. |\n","|=========================================+======================+======================|\n","| 0 NVIDIA GeForce RTX 4090 On | 00000000:01:00.0 Off | Off |\n","| 0% 44C P8 13W / 450W | 1498MiB / 24564MiB | 3% Default |\n","| | | N/A |\n","+-----------------------------------------+----------------------+----------------------+\n"," \n","+---------------------------------------------------------------------------------------+\n","| Processes: |\n","| GPU GI CI PID Type Process name GPU Memory |\n","| ID ID Usage |\n","|=======================================================================================|\n","| No running processes found |\n","+---------------------------------------------------------------------------------------+\n","Linux Gen-AI 5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct 5 21:02:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux\n","PRETTY_NAME=\"Ubuntu 22.04.2 LTS\"\n","NAME=\"Ubuntu\"\n","VERSION_ID=\"22.04\"\n","VERSION=\"22.04.2 LTS (Jammy Jellyfish)\"\n","VERSION_CODENAME=jammy\n","ID=ubuntu\n","ID_LIKE=debian\n","HOME_URL=\"https://www.ubuntu.com/\"\n","SUPPORT_URL=\"https://help.ubuntu.com/\"\n","BUG_REPORT_URL=\"https://bugs.launchpad.net/ubuntu/\"\n","PRIVACY_POLICY_URL=\"https://www.ubuntu.com/legal/terms-and-policies/privacy-policy\"\n","UBUNTU_CODENAME=jammy\n","Architecture: x86_64\n"," CPU op-mode(s): 32-bit, 64-bit\n"," Address sizes: 39 bits physical, 48 bits virtual\n"," Byte Order: Little Endian\n","CPU(s): 32\n"," On-line CPU(s) list: 0-31\n","Vendor ID: GenuineIntel\n"," Model name: 13th Gen Intel(R) Core(TM) i9-13900KF\n"," CPU family: 6\n"," Model: 183\n"," Thread(s) per core: 2\n"," Core(s) per socket: 16\n"," Socket(s): 1\n"," Stepping: 1\n"," BogoMIPS: 5990.40\n"," Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mc\n"," a cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscal\n"," l nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopo\n"," logy tsc_reliable nonstop_tsc cpuid pni pclmulqdq vmx s\n"," sse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt tsc_dea\n"," dline_timer aes xsave avx f16c rdrand hypervisor lahf_l\n"," m abm 3dnowprefetch ssbd ibrs ibpb stibp ibrs_enhanced \n"," tpr_shadow vnmi ept vpid ept_ad fsgsbase tsc_adjust bmi\n"," 1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushop\n"," t clwb sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni u\n"," mip waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64\n"," b fsrm md_clear serialize flush_l1d arch_capabilities\n","Virtualization features: \n"," Virtualization: VT-x\n"," Hypervisor vendor: Microsoft\n"," Virtualization type: full\n","Caches (sum of all): \n"," L1d: 768 KiB (16 instances)\n"," L1i: 512 KiB (16 instances)\n"," L2: 32 MiB (16 instances)\n"," L3: 36 MiB (1 instance)\n","Vulnerabilities: \n"," Gather data sampling: Not affected\n"," Itlb multihit: Not affected\n"," L1tf: Not affected\n"," Mds: Not affected\n"," Meltdown: Not affected\n"," Mmio stale data: Not affected\n"," Retbleed: Mitigation; Enhanced IBRS\n"," Spec rstack overflow: Not affected\n"," Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl\n"," and seccomp\n"," Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer\n"," sanitization\n"," Spectre v2: Mitigation; Enhanced IBRS, IBPB conditional, RSB fillin\n"," g, PBRSB-eIBRS SW sequence\n"," Srbds: Not affected\n"," Tsx async abort: Not affected\n","MemTotal: 49330020 kB\n","Eval internlm/internlm2_5-7b-chat-1m with inflaton-ai/InternLM_2_5-7b_LoRA-Adapter\n","loading env vars from: /home/inflaton/code/logical-reasoning/.env\n","Adding /home/inflaton/code/logical-reasoning to sys.path\n","loading /home/inflaton/code/logical-reasoning/llm_toolkit/logical_reasoning_utils.py\n","internlm/internlm2_5-7b-chat-1m inflaton-ai/InternLM_2_5-7b_LoRA-Adapter True datasets/mgtv results/mgtv-results_internlm_nv4090.csv\n","(1) GPU = NVIDIA GeForce RTX 4090. Max memory = 23.988 GB.\n","0.0 GB of memory reserved.\n","loading model: internlm/internlm2_5-7b-chat-1m with adapter: inflaton-ai/InternLM_2_5-7b_LoRA-Adapter\n","Loading checkpoint shards: 100%|██████████████████| 8/8 [00:02<00:00, 3.18it/s]\n","(2) GPU = NVIDIA GeForce RTX 4090. Max memory = 23.988 GB.\n","5.201 GB of memory reserved.\n","loading train/test data files\n","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","--------------------------------------------------\n","text: 甄加索是自杀吗\n","--------------------------------------------------\n","label: 不是\n","--------------------------------------------------\n","answer: nan\n","--------------------------------------------------\n","title: 海岸之谜\n","--------------------------------------------------\n","puzzle: 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任何打斗的迹象。请问甄加索的死因是什么?\n","--------------------------------------------------\n","truth: 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在创作一幅描绘海洋生物的画作。在画即将完成的前一天晚上,他骑着自行车外出,打算在海边观赏夜景。然而,他在沙滩上意外发现了一只搁浅的海豚,为了救助这只海豚,他耗费了极大的体力,最终成功将其送回海中。筋疲力尽的甄加索在沙滩上睡着了,由于他患有严重的心脏病,却未告知旁人,在寒冷的海风中,他的心脏停止了跳动。因此,警方在现场只发现了车轮痕迹和未完成的画作,而没有发现任何他杀的迹象。\n","--------------------------------------------------\n","train_text: <|im_start|>system\n","You are an expert in logical reasoning.<|im_end|>\n","<|im_start|>user\n","你是一个情景猜谜游戏的主持人。游戏规则如下:\n","\n","1. 参与者会得到一个谜面,谜面会描述一个简单又难以理解的事件。\n","2. 主持人知道谜底,谜底是谜面的答案。\n","3. 参与者可以询问任何封闭式问题来找寻事件的真相。\n","4. 对于每个问题,主持人将根据实际情况回答以下五个选项之一:是、不是、不重要、回答正确、问法错误。各回答的判断标准如下:\n"," - 若谜面和谜底能找到问题的答案,回答:是或者不是\n"," - 若谜面和谜底不能直接或者间接推断出问题的答案,回答:不重要\n"," - 若参与者提问不是一个封闭式问题或者问题难以理解,回答:问法错误\n"," - 若参与者提问基本还原了谜底真相,回答:回答正确\n","5. 回答中不能添加任何其它信息,也不能省略选项中的任何一个字。例如,不可以把“不是”省略成“不”。\n","\n","请严格按照这些规则回答参与者提出的问题。\n","\n","**谜面:** 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任何打斗的迹象。请问甄加索的死因是什么?\n","\n","**谜底:** 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在创作一幅描绘海洋生物的画作。在画即将完成的前一天晚上,他骑着自行车外出,打算在海边观赏夜景。然而,他在沙滩上意外发现了一只搁浅的海豚,为了救助这只海豚,他耗费了极大的体力,最终成功将其送回海中。筋疲力尽的甄加索在沙滩上睡着了,由于他患有严重的心脏病,却未告知旁人,在寒冷的海风中,他的心脏停止了跳动。因此,警方在现场只发现了车轮痕迹和未完成的画作,而没有发现任何他杀的迹象。\n","\n","**参与者提出的问题:** 甄加索是自杀吗\n","<|im_end|>\n","<|im_start|>assistant\n","不是\n","--------------------------------------------------\n","prompt: <|im_start|>system\n","You are an expert in logical reasoning.<|im_end|>\n","<|im_start|>user\n","你是一个情景猜谜游戏的主持人。游戏规则如下:\n","\n","1. 参与者会得到一个谜面,谜面会描述一个简单又难以理解的事件。\n","2. 主持人知道谜底,谜底是谜面的答案。\n","3. 参与者可以询问任何封闭式问题来找寻事件的真相。\n","4. 对于每个问题,主持人将根据实际情况回答以下五个选项之一:是、不是、不重要、回答正确、问法错误。各回答的判断标准如下:\n"," - 若谜面和谜底能找到问题的答案,回答:是或者不是\n"," - 若谜面和谜底不能直接或者间接推断出问题的答案,回答:不重要\n"," - 若参与者提问不是一个封闭式问题或者问题难以理解,回答:问法错误\n"," - 若参与者提问基本还原了谜底真相,回答:回答正确\n","5. 回答中不能添加任何其它信息,也不能省略选项中的任何一个字。例如,不可以把“不是”省略成“不”。\n","\n","请严格按照这些规则回答参与者提出的问题。\n","\n","**谜面:** 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任何打斗的迹象。请问甄加索的死因是什么?\n","\n","**谜底:** 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在创作一幅描绘海洋生物的画作。在画即将完成的前一天晚上,他骑着自行车外出,打算在海边观赏夜景。然而,他在沙滩上意外发现了一只搁浅的海豚,为了救助这只海豚,他耗费了极大的体力,最终成功将其送回海中。筋疲力尽的甄加索在沙滩上睡着了,由于他患有严重的心脏病,却未告知旁人,在寒冷的海风中,他的心脏停止了跳动。因此,警方在现场只发现了车轮痕迹和未完成的画作,而没有发现任何他杀的迹象。\n","\n","**参与者提出的问题:** 甄加索是自杀吗\n","<|im_end|>\n","<|im_start|>assistant\n","\n","--------------------------------------------------\n","text: 死者受伤了吗\n","--------------------------------------------------\n","label: 不是\n","--------------------------------------------------\n","answer: nan\n","--------------------------------------------------\n","title: 甄庄哭声\n","--------------------------------------------------\n","puzzle: 在一个安静的夜晚,小村庄的湖边突然传来了阵阵哭泣声。第二天早晨,村长甄锐发现湖边的石头上放着一顶破旧的帽子,但没有人知道这顶帽子是从哪里来的,哭泣声又是为何。请还原故事真相。\n","--------------------------------------------------\n","truth: 原来,这顶破旧的帽子属于一个小男孩,他小时候与爷爷在湖边生活。爷爷教他钓鱼、游泳,还告诉他湖中的海龟是他们的朋友。后来,小男孩随父母去了城市生活,但每年夏天都会回到村子探望爷爷。然而,去年夏天,爷爷因病去世,小男孩伤心欲绝。今年夏天,他回到村子,来到湖边,想起和爷爷的美好回忆,忍不住哭泣。他将爷爷的帽子放在湖边的石头上,希望能让爷爷的在天之灵得到安慰。那晚的哭泣声正是小男孩在祭莫他亲爱的爷爷。\n","--------------------------------------------------\n","train_text: <|im_start|>system\n","You are an expert in logical reasoning.<|im_end|>\n","<|im_start|>user\n","你是一个情景猜谜游戏的主持人。游戏规则如下:\n","\n","1. 参与者会得到一个谜面,谜面会描述一个简单又难以理解的事件。\n","2. 主持人知道谜底,谜底是谜面的答案。\n","3. 参与者可以询问任何封闭式问题来找寻事件的真相。\n","4. 对于每个问题,主持人将根据实际情况回答以下五个选项之一:是、不是、不重要、回答正确、问法错误。各回答的判断标准如下:\n"," - 若谜面和谜底能找到问题的答案,回答:是或者不是\n"," - 若谜面和谜底不能直接或者间接推断出问题的答案,回答:不重要\n"," - 若参与者提问不是一个封闭式问题或者问题难以理解,回答:问法错误\n"," - 若参与者提问基本还原了谜底真相,回答:回答正确\n","5. 回答中不能添加任何其它信息,也不能省略选项中的任何一个字。例如,不可以把“不是”省略成“不”。\n","\n","请严格按照这些规则回答参与者提出的问题。\n","\n","**谜面:** 在一个安静的夜晚,小村庄的湖边突然传来了阵阵哭泣声。第二天早晨,村长甄锐发现湖边的石头上放着一顶破旧的帽子,但没有人知道这顶帽子是从哪里来的,哭泣声又是为何。请还原故事真相。\n","\n","**谜底:** 原来,这顶破旧的帽子属于一个小男孩,他小时候与爷爷在湖边生活。爷爷教他钓鱼、游泳,还告诉他湖中的海龟是他们的朋友。后来,小男孩随父母去了城市生活,但每年夏天都会回到村子探望爷爷。然而,去年夏天,爷爷因病去世,小男孩伤心欲绝。今年夏天,他回到村子,来到湖边,想起和爷爷的美好回忆,忍不住哭泣。他将爷爷的帽子放在湖边的石头上,希望能让爷爷的在天之灵得到安慰。那晚的哭泣声正是小男孩在祭莫他亲爱的爷爷。\n","\n","**参与者提出的问题:** 死者受伤了吗\n","<|im_end|>\n","<|im_start|>assistant\n","不是\n","--------------------------------------------------\n","prompt: <|im_start|>system\n","You are an expert in logical reasoning.<|im_end|>\n","<|im_start|>user\n","你是一个情景猜谜游戏的主持人。游戏规则如下:\n","\n","1. 参与者会得到一个谜面,谜面会描述一个简单又难以理解的事件。\n","2. 主持人知道谜底,谜底是谜面的答案。\n","3. 参与者可以询问任何封闭式问题来找寻事件的真相。\n","4. 对于每个问题,主持人将根据实际情况回答以下五个选项之一:是、不是、不重要、回答正确、问法错误。各回答的判断标准如下:\n"," - 若谜面和谜底能找到问题的答案,回答:是或者不是\n"," - 若谜面和谜底不能直接或者间接推断出问题的答案,回答:不重要\n"," - 若参与者提问不是一个封闭式问题或者问题难以理解,回答:问法错误\n"," - 若参与者提问基本还原了谜底真相,回答:回答正确\n","5. 回答中不能添加任何其它信息,也不能省略选项中的任何一个字。例如,不可以把“不是”省略成“不”。\n","\n","请严格按照这些规则回答参与者提出的问题。\n","\n","**谜面:** 在一个安静的夜晚,小村庄的湖边突然传来了阵阵哭泣声。第二天早晨,村长甄锐发现湖边的石头上放着一顶破旧的帽子,但没有人知道这顶帽子是从哪里来的,哭泣声又是为何。请还原故事真相。\n","\n","**谜底:** 原来,这顶破旧的帽子属于一个小男孩,他小时候与爷爷在湖边生活。爷爷教他钓鱼、游泳,还告诉他湖中的海龟是他们的朋友。后来,小男孩随父母去了城市生活,但每年夏天都会回到村子探望爷爷。然而,去年夏天,爷爷因病去世,小男孩伤心欲绝。今年夏天,他回到村子,来到湖边,想起和爷爷的美好回忆,忍不住哭泣。他将爷爷的帽子放在湖边的石头上,希望能让爷爷的在天之灵得到安慰。那晚的哭泣声正是小男孩在祭莫他亲爱的爷爷。\n","\n","**参与者提出的问题:** 死者受伤了吗\n","<|im_end|>\n","<|im_start|>assistant\n","\n","Evaluating model: internlm/internlm2_5-7b-chat-1m\n"," 0%| | 0/3000 [00:00, ?it/s]Batch output: ['不是']\n","100%|███████████████████████████████████████| 3000/3000 [11:15<00:00, 4.44it/s]\n","(3) GPU = NVIDIA GeForce RTX 4090. Max memory = 23.988 GB.\n","7.357 GB of memory reserved.\n"," text ... internlm/internlm2_5-7b-chat-1m/InternLM_2_5-7b_LoRA-Adapter_torch.bfloat16_4bit\n","0 甄加索是自杀吗 ... 不是 \n","\n","[1 rows x 16 columns]\n","{'accuracy': 0.8043333333333333, 'incorrect_ids': [6, 9, 18, 25, 29, 34, 36, 55, 58, 59, 61, 65, 66, 67, 78, 81, 83, 84, 88, 91, 93, 99, 103, 104, 106, 112, 121, 128, 129, 135, 136, 143, 149, 150, 153, 155, 161, 164, 170, 173, 190, 199, 200, 202, 222, 224, 228, 234, 236, 245, 248, 250, 252, 259, 260, 269, 271, 275, 276, 279, 284, 286, 293, 299, 304, 314, 318, 325, 328, 330, 334, 335, 337, 338, 346, 350, 353, 355, 356, 360, 361, 368, 370, 373, 377, 383, 384, 389, 397, 410, 428, 429, 430, 432, 438, 445, 447, 450, 452, 454, 456, 457, 458, 465, 469, 470, 471, 472, 479, 481, 490, 495, 497, 501, 502, 506, 507, 510, 511, 517, 518, 519, 520, 530, 536, 538, 540, 560, 566, 570, 571, 579, 581, 589, 593, 596, 597, 601, 613, 614, 621, 622, 625, 628, 632, 636, 644, 647, 666, 671, 682, 686, 690, 695, 702, 708, 718, 720, 721, 727, 729, 730, 734, 739, 740, 754, 758, 770, 773, 774, 778, 788, 791, 795, 798, 801, 805, 817, 819, 820, 823, 824, 826, 828, 832, 837, 840, 841, 847, 856, 861, 866, 869, 870, 875, 886, 889, 890, 894, 899, 901, 904, 927, 935, 937, 945, 952, 962, 964, 966, 969, 980, 982, 991, 994, 998, 1001, 1003, 1006, 1011, 1012, 1014, 1015, 1019, 1022, 1036, 1038, 1043, 1051, 1057, 1061, 1075, 1077, 1080, 1087, 1089, 1096, 1120, 1125, 1126, 1129, 1158, 1161, 1166, 1172, 1174, 1178, 1180, 1181, 1185, 1198, 1203, 1212, 1228, 1232, 1239, 1240, 1241, 1251, 1252, 1254, 1258, 1259, 1266, 1282, 1289, 1298, 1305, 1308, 1311, 1313, 1315, 1317, 1324, 1331, 1332, 1339, 1342, 1349, 1353, 1363, 1364, 1365, 1367, 1379, 1385, 1387, 1388, 1400, 1406, 1409, 1417, 1420, 1422, 1426, 1440, 1444, 1451, 1453, 1454, 1459, 1462, 1469, 1476, 1478, 1486, 1490, 1493, 1494, 1496, 1501, 1504, 1512, 1515, 1517, 1518, 1525, 1526, 1547, 1554, 1560, 1562, 1580, 1585, 1590, 1593, 1594, 1603, 1604, 1605, 1613, 1622, 1627, 1633, 1636, 1637, 1641, 1645, 1647, 1650, 1654, 1655, 1659, 1662, 1665, 1672, 1673, 1674, 1679, 1686, 1691, 1695, 1712, 1716, 1718, 1721, 1726, 1727, 1731, 1734, 1736, 1738, 1751, 1755, 1756, 1769, 1780, 1786, 1791, 1796, 1798, 1809, 1812, 1814, 1835, 1858, 1860, 1867, 1869, 1877, 1879, 1880, 1888, 1894, 1897, 1907, 1914, 1915, 1919, 1941, 1945, 1953, 1958, 1963, 1964, 1971, 1973, 1978, 1981, 1984, 1986, 1989, 1990, 1995, 2017, 2021, 2028, 2029, 2035, 2036, 2046, 2049, 2054, 2064, 2067, 2070, 2076, 2077, 2100, 2106, 2109, 2110, 2119, 2120, 2121, 2126, 2133, 2147, 2159, 2160, 2161, 2162, 2164, 2172, 2174, 2177, 2185, 2186, 2192, 2193, 2194, 2195, 2196, 2197, 2199, 2212, 2222, 2223, 2226, 2233, 2237, 2240, 2243, 2250, 2262, 2265, 2274, 2278, 2280, 2281, 2285, 2297, 2304, 2311, 2317, 2320, 2324, 2330, 2333, 2339, 2344, 2348, 2349, 2360, 2364, 2366, 2367, 2370, 2378, 2389, 2395, 2396, 2400, 2404, 2406, 2409, 2410, 2420, 2423, 2429, 2437, 2440, 2442, 2454, 2463, 2469, 2511, 2512, 2515, 2517, 2522, 2529, 2530, 2532, 2535, 2538, 2546, 2548, 2549, 2553, 2556, 2559, 2562, 2575, 2577, 2581, 2589, 2590, 2592, 2616, 2629, 2632, 2644, 2663, 2664, 2667, 2676, 2678, 2714, 2716, 2721, 2731, 2736, 2742, 2745, 2746, 2749, 2754, 2757, 2758, 2762, 2766, 2770, 2777, 2788, 2791, 2794, 2797, 2798, 2801, 2807, 2815, 2816, 2820, 2823, 2837, 2843, 2854, 2857, 2860, 2861, 2867, 2877, 2880, 2882, 2884, 2899, 2902, 2905, 2912, 2913, 2916, 2921, 2933, 2937, 2942, 2944, 2949, 2953, 2955, 2968, 2969, 2977, 2979, 2985, 2995, 2998]}\n","CPU times: user 4.87 s, sys: 1.44 s, total: 6.31 s\n","Wall time: 11min 36s\n"]}],"source":["%%time\n","\n","os.environ[\"USING_LLAMA_FACTORY\"] = \"false\"\n","!./scripts/eval-mgtv-nv4090.sh"]}],"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}