{"cells":[{"cell_type":"code","source":["%load_ext autoreload\n","%autoreload 2"],"metadata":{"id":"uWKRSV6eZsCn","executionInfo":{"status":"ok","timestamp":1720711613956,"user_tz":-480,"elapsed":2,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"}},"colab":{"base_uri":"https://localhost:8080/"},"outputId":"10de0285-c19b-4aff-b2cd-b89e259adc47"},"execution_count":21,"outputs":[{"output_type":"stream","name":"stdout","text":["The autoreload extension is already loaded. To reload it, use:\n"," %reload_ext autoreload\n"]}]},{"cell_type":"code","execution_count":22,"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/"},"id":"xwFh14uiZBrI","executionInfo":{"status":"ok","timestamp":1720711640125,"user_tz":-480,"elapsed":13209,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"}},"outputId":"a308789f-8ca4-46ca-b535-a662dfb45082"},"outputs":[{"output_type":"stream","name":"stdout","text":["Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount(\"/content/drive\", force_remount=True).\n"]}],"source":["from google.colab import drive\n","drive.mount('/content/drive')"]},{"cell_type":"code","execution_count":23,"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/"},"id":"G5pNu3zgZBrL","executionInfo":{"status":"ok","timestamp":1720711640125,"user_tz":-480,"elapsed":9,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"}},"outputId":"e0f0ac3f-6bbb-4381-a527-5c679b67300f"},"outputs":[{"output_type":"stream","name":"stdout","text":["workding dir: /content/drive/MyDrive/logical-reasoning/\n"]}],"source":["import os\n","import sys\n","from pathlib import Path\n","\n","workding_dir = \"/content/drive/MyDrive/logical-reasoning/\"\n","os.chdir(workding_dir)\n","sys.path.append(workding_dir)\n","print(\"workding dir:\", workding_dir)"]},{"cell_type":"code","execution_count":24,"metadata":{"application/vnd.databricks.v1+cell":{"cellMetadata":{"byteLimit":2048000,"rowLimit":10000},"inputWidgets":{},"nuid":"ac667aba-076e-4de6-9984-8f6a67cb09cd","showTitle":false,"title":""},"colab":{"base_uri":"https://localhost:8080/"},"id":"0dVRAabNZBrL","executionInfo":{"status":"ok","timestamp":1720711640125,"user_tz":-480,"elapsed":7,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"}},"outputId":"d97dd29b-ab43-4fc3-8e38-571280e598de"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["False"]},"metadata":{},"execution_count":24}],"source":["need_to_setup_env = False\n","need_to_setup_env"]},{"cell_type":"code","execution_count":25,"metadata":{"application/vnd.databricks.v1+cell":{"cellMetadata":{"byteLimit":2048000,"rowLimit":10000},"inputWidgets":{},"nuid":"72f9cf79-7b0d-4d9e-90a0-1fa5251b947f","showTitle":false,"title":""},"id":"hKUOfP2HZBrL","executionInfo":{"status":"ok","timestamp":1720711640126,"user_tz":-480,"elapsed":7,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"}}},"outputs":[],"source":["if need_to_setup_env:\n"," %pip install -r requirements.txt\n"," %cd /content/\n"," %rm -rf LLaMA-Factory\n"," !git clone https://github.com/hiyouga/LLaMA-Factory.git\n"," %cd LLaMA-Factory\n"," %ls\n"," %pip install -e .[torch,bitsandbytes]"]},{"cell_type":"code","execution_count":26,"metadata":{"application/vnd.databricks.v1+cell":{"cellMetadata":{"byteLimit":2048000,"rowLimit":10000},"inputWidgets":{},"nuid":"c06c61fd-4c6f-4099-bd3b-46188ab835d7","showTitle":false,"title":""},"colab":{"base_uri":"https://localhost:8080/"},"id":"txOgnjwYZBrL","executionInfo":{"status":"ok","timestamp":1720711640126,"user_tz":-480,"elapsed":7,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"}},"outputId":"21f082c1-5cf8-4292-c18d-868f03fc5d8d"},"outputs":[{"output_type":"stream","name":"stdout","text":["workding dir: /content/drive/MyDrive/logical-reasoning/\n"]}],"source":["os.chdir(workding_dir)\n","sys.path.append(workding_dir)\n","print(\"workding dir:\", workding_dir)"]},{"cell_type":"code","execution_count":27,"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/"},"id":"hPCC-6m7ZBrM","executionInfo":{"status":"ok","timestamp":1720711640126,"user_tz":-480,"elapsed":7,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"}},"outputId":"96d5a6cf-988d-4f21-dc30-bfeb52d61dd1"},"outputs":[{"output_type":"stream","name":"stdout","text":["loading env vars from: /content/drive/MyDrive/logical-reasoning/.env\n"]},{"output_type":"execute_result","data":{"text/plain":["True"]},"metadata":{},"execution_count":27}],"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":28,"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/"},"id":"1M3IraVtZBrM","executionInfo":{"status":"ok","timestamp":1720711640126,"user_tz":-480,"elapsed":6,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"}},"outputId":"9f129c9e-7293-4c25-cca5-7ae4fdcab979"},"outputs":[{"output_type":"stream","name":"stdout","text":["internlm/internlm2_5-7b-chat-1m None True datasets/mgtv results/mgtv-results_colab_p2.csv False\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, use_english_datasets)"]},{"cell_type":"code","execution_count":29,"metadata":{"application/vnd.databricks.v1+cell":{"cellMetadata":{"byteLimit":2048000,"rowLimit":10000},"inputWidgets":{},"nuid":"e3ab54ba-7b6d-4817-bf2e-c5d711508b58","showTitle":false,"title":""},"colab":{"base_uri":"https://localhost:8080/"},"id":"mrVEz6UsZBrM","executionInfo":{"status":"ok","timestamp":1720711640126,"user_tz":-480,"elapsed":6,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"}},"outputId":"57e472ec-cdee-47d3-b1da-5a5ca3e58131"},"outputs":[{"output_type":"stream","name":"stdout","text":["Thu Jul 11 15:27:19 2024 \n","+---------------------------------------------------------------------------------------+\n","| NVIDIA-SMI 535.104.05 Driver Version: 535.104.05 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 L4 Off | 00000000:00:03.0 Off | 0 |\n","| N/A 39C P8 12W / 72W | 1MiB / 23034MiB | 0% 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"]}],"source":["!nvidia-smi"]},{"cell_type":"code","execution_count":30,"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/"},"id":"UgMvt6dIZBrM","executionInfo":{"status":"ok","timestamp":1720711640126,"user_tz":-480,"elapsed":5,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"}},"outputId":"f7790506-b806-43ca-89eb-24c7f5471bfc"},"outputs":[{"output_type":"stream","name":"stdout","text":["Python 3.10.12\n","\u001b[33mWARNING: Package(s) not found: flash-attn\u001b[0m\u001b[33m\n","\u001b[0mCPU times: user 10.1 ms, sys: 1.94 ms, total: 12 ms\n","Wall time: 610 ms\n"]}],"source":["%%time\n","!python --version\n","!pip show flash-attn"]},{"cell_type":"code","execution_count":31,"metadata":{"id":"ZuS_FsLyZBrN","executionInfo":{"status":"ok","timestamp":1720711640126,"user_tz":-480,"elapsed":4,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"}}},"outputs":[],"source":["from llm_toolkit.logical_reasoning_utils import *"]},{"cell_type":"code","execution_count":32,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":224},"id":"muFDE9DpZBrN","executionInfo":{"status":"ok","timestamp":1720711642271,"user_tz":-480,"elapsed":2149,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"}},"outputId":"00ed5651-ae27-4292-a23c-f1c9952b9197"},"outputs":[{"output_type":"stream","name":"stdout","text":["loading existing data from: llama-factory/data/alpaca_mgtv_p2.json\n"]},{"output_type":"execute_result","data":{"text/plain":[" instruction input output\n","0 你是一个情景猜谜游戏的主持人。游戏规则如下:\\n\\n1. 参与者会得到一个谜面,谜面会描述一... 不是\n","1 你是一个情景猜谜游戏的主持人。游戏规则如下:\\n\\n1. 参与者会得到一个谜面,谜面会描述一... 不是\n","2 你是一个情景猜谜游戏的主持人。游戏规则如下:\\n\\n1. 参与者会得到一个谜面,谜面会描述一... 不重要\n","3 你是一个情景猜谜游戏的主持人。游戏规则如下:\\n\\n1. 参与者会得到一个谜面,谜面会描述一... 不是\n","4 你是一个情景猜谜游戏的主持人。游戏规则如下:\\n\\n1. 参与者会得到一个谜面,谜面会描述一... 是"],"text/html":["\n","
\n","
\n","\n","\n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n","
instructioninputoutput
0你是一个情景猜谜游戏的主持人。游戏规则如下:\\n\\n1. 参与者会得到一个谜面,谜面会描述一...不是
1你是一个情景猜谜游戏的主持人。游戏规则如下:\\n\\n1. 参与者会得到一个谜面,谜面会描述一...不是
2你是一个情景猜谜游戏的主持人。游戏规则如下:\\n\\n1. 参与者会得到一个谜面,谜面会描述一...不重要
3你是一个情景猜谜游戏的主持人。游戏规则如下:\\n\\n1. 参与者会得到一个谜面,谜面会描述一...不是
4你是一个情景猜谜游戏的主持人。游戏规则如下:\\n\\n1. 参与者会得到一个谜面,谜面会描述一...
\n","
\n","
\n","\n","
\n"," \n","\n"," \n","\n"," \n","
\n","\n","\n","
\n"," \n","\n","\n","\n"," \n","
\n","\n","
\n","
\n"],"application/vnd.google.colaboratory.intrinsic+json":{"type":"dataframe","variable_name":"df_alpaca","summary":"{\n \"name\": \"df_alpaca\",\n \"rows\": 25000,\n \"fields\": [\n {\n \"column\": \"instruction\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 20112,\n \"samples\": [\n \"\\u4f60\\u662f\\u4e00\\u4e2a\\u60c5\\u666f\\u731c\\u8c1c\\u6e38\\u620f\\u7684\\u4e3b\\u6301\\u4eba\\u3002\\u6e38\\u620f\\u89c4\\u5219\\u5982\\u4e0b\\uff1a\\n\\n1. \\u53c2\\u4e0e\\u8005\\u4f1a\\u5f97\\u5230\\u4e00\\u4e2a\\u8c1c\\u9762\\uff0c\\u8c1c\\u9762\\u4f1a\\u63cf\\u8ff0\\u4e00\\u4e2a\\u7b80\\u5355\\u53c8\\u96be\\u4ee5\\u7406\\u89e3\\u7684\\u4e8b\\u4ef6\\u3002\\n2. \\u4e3b\\u6301\\u4eba\\u77e5\\u9053\\u8c1c\\u5e95\\uff0c\\u8c1c\\u5e95\\u662f\\u8c1c\\u9762\\u7684\\u7b54\\u6848\\u3002\\n3. \\u53c2\\u4e0e\\u8005\\u53ef\\u4ee5\\u8be2\\u95ee\\u4efb\\u4f55\\u5c01\\u95ed\\u5f0f\\u95ee\\u9898\\u6765\\u627e\\u5bfb\\u4e8b\\u4ef6\\u7684\\u771f\\u76f8\\u3002\\n4. \\u5bf9\\u4e8e\\u6bcf\\u4e2a\\u95ee\\u9898\\uff0c\\u4e3b\\u6301\\u4eba\\u5c06\\u6839\\u636e\\u5b9e\\u9645\\u60c5\\u51b5\\u56de\\u7b54\\u4ee5\\u4e0b\\u4e94\\u4e2a\\u9009\\u9879\\u4e4b\\u4e00\\uff1a\\u662f\\u3001\\u4e0d\\u662f\\u3001\\u4e0d\\u91cd\\u8981\\u3001\\u56de\\u7b54\\u6b63\\u786e\\u3001\\u95ee\\u6cd5\\u9519\\u8bef\\u3002\\u5404\\u56de\\u7b54\\u7684\\u5224\\u65ad\\u6807\\u51c6\\u5982\\u4e0b\\uff1a\\n - \\u82e5\\u8c1c\\u9762\\u548c\\u8c1c\\u5e95\\u80fd\\u627e\\u5230\\u95ee\\u9898\\u7684\\u7b54\\u6848\\uff0c\\u56de\\u7b54\\uff1a\\u662f\\u6216\\u8005\\u4e0d\\u662f\\n - \\u82e5\\u8c1c\\u9762\\u548c\\u8c1c\\u5e95\\u4e0d\\u80fd\\u76f4\\u63a5\\u6216\\u8005\\u95f4\\u63a5\\u63a8\\u65ad\\u51fa\\u95ee\\u9898\\u7684\\u7b54\\u6848\\uff0c\\u56de\\u7b54\\uff1a\\u4e0d\\u91cd\\u8981\\n - \\u82e5\\u53c2\\u4e0e\\u8005\\u63d0\\u95ee\\u4e0d\\u662f\\u4e00\\u4e2a\\u5c01\\u95ed\\u5f0f\\u95ee\\u9898\\u6216\\u8005\\u95ee\\u9898\\u96be\\u4ee5\\u7406\\u89e3\\uff0c\\u56de\\u7b54\\uff1a\\u95ee\\u6cd5\\u9519\\u8bef\\n - \\u82e5\\u53c2\\u4e0e\\u8005\\u63d0\\u95ee\\u57fa\\u672c\\u8fd8\\u539f\\u4e86\\u8c1c\\u5e95\\u771f\\u76f8\\uff0c\\u56de\\u7b54\\uff1a\\u56de\\u7b54\\u6b63\\u786e\\n5. \\u56de\\u7b54\\u4e2d\\u4e0d\\u80fd\\u6dfb\\u52a0\\u4efb\\u4f55\\u5176\\u5b83\\u4fe1\\u606f\\uff0c\\u4e5f\\u4e0d\\u80fd\\u7701\\u7565\\u9009\\u9879\\u4e2d\\u7684\\u4efb\\u4f55\\u4e00\\u4e2a\\u5b57\\u3002\\u4f8b\\u5982\\uff0c\\u4e0d\\u53ef\\u4ee5\\u628a\\u201c\\u4e0d\\u662f\\u201d\\u7701\\u7565\\u6210\\u201c\\u4e0d\\u201d\\u3002\\n\\n\\u8bf7\\u4e25\\u683c\\u6309\\u7167\\u8fd9\\u4e9b\\u89c4\\u5219\\u56de\\u7b54\\u53c2\\u4e0e\\u8005\\u63d0\\u51fa\\u7684\\u95ee\\u9898\\u3002\\n\\n**\\u8c1c\\u9762:** \\u5728\\u4e00\\u680b\\u8001\\u65e7\\u5c45\\u6c11\\u697c\\u7684\\u5730\\u4e0b\\u5ba4\\u3002\\u4e00\\u5929\\uff0c\\u8b66\\u65b9\\u63a5\\u5230\\u62a5\\u6848\\uff0c\\u6709\\u4eba\\u5728\\u5730\\u4e0b\\u5ba4\\u4e2d\\u53d1\\u73b0\\u4e86\\u7504\\u597d\\u5947\\u7684\\u9057\\u4f53\\u3002\\u73b0\\u573a\\u6ca1\\u6709\\u6253\\u6597\\u7684\\u75d5\\u8ff9\\uff0c\\u4e5f\\u6ca1\\u6709\\u660e\\u663e\\u7684\\u81ea\\u6740\\u5de5\\u5177\\u3002\\u6b7b\\u8005\\u88ab\\u53d1\\u73b0\\u65f6\\u5750\\u5728\\u4e00\\u628a\\u6905\\u5b50\\u4e0a\\uff0c\\u8868\\u60c5\\u5e73\\u9759\\uff0c\\u4f3c\\u4e4e\\u5728\\u6b7b\\u524d\\u5e76\\u672a\\u7ecf\\u5386\\u75db\\u82e6\\u3002\\u5730\\u4e0b\\u5ba4\\u9664\\u4e86\\u4e00\\u53f0\\u7535\\u89c6\\u548c\\u4e00\\u5f20\\u684c\\u5b50\\u5916\\uff0c\\u6ca1\\u6709\\u5176\\u4ed6\\u7269\\u54c1\\u3002\\u684c\\u4e0a\\u6709\\u4e00\\u676f\\u6c34\\uff0c\\u7535\\u89c6\\u8fd8\\u5f00\\u7740\\u3002\\u7a76\\u7adf\\u662f\\u4ec0\\u4e48\\u539f\\u56e0\\u5bfc\\u81f4\\u4e86\\u7504\\u597d\\u5947\\u7684\\u6b7b\\u4ea1\\uff1f\\n\\n**\\u8c1c\\u5e95:** \\u7504\\u597d\\u5947\\u5176\\u5b9e\\u662f\\u4e00\\u4f4d\\u79d1\\u5e7b\\u5c0f\\u8bf4\\u4f5c\\u5bb6\\uff0c\\u60a3\\u6709\\u4e25\\u91cd\\u7684\\u5e7d\\u95ed\\u6050\\u60e7\\u75c7\\u3002\\u4ed6\\u4e3a\\u4e86\\u5bfb\\u627e\\u5199\\u4f5c\\u7684\\u7075\\u611f\\uff0c\\u5e38\\u5e38\\u72ec\\u81ea\\u4e00\\u4eba\\u6765\\u5230\\u8fd9\\u4e2a\\u5730\\u4e0b\\u5ba4\\u89c2\\u770b\\u79d1\\u5e7b\\u7535\\u5f71\\u3002\\u4e0d\\u5e78\\u7684\\u662f\\uff0c\\u6709\\u4e00\\u5929\\u4ed6\\u5728\\u89c2\\u770b\\u7535\\u5f71\\u65f6\\u7a81\\u7136\\u906d\\u9047\\u505c\\u7535\\uff0c\\u5730\\u4e0b\\u5ba4\\u4e00\\u7247\\u6f06\\u9ed1\\u3002\\u4ed6\\u7684\\u5e7d\\u95ed\\u6050\\u60e7\\u75c7\\u53d1\\u4f5c\\uff0c\\u6781\\u5ea6\\u6050\\u614c\\u4e2d\\u8bef\\u4ee5\\u4e3a\\u81ea\\u5df1\\u88ab\\u56f0\\u5728\\u4e00\\u4e2a\\u672a\\u77e5\\u7684\\u5b87\\u5b99\\u7a7a\\u95f4\\u3002\\u5728\\u8fd9\\u79cd\\u6781\\u7aef\\u6050\\u60e7\\u7684\\u72b6\\u6001\\u4e0b\\uff0c\\u4ed6\\u7a81\\u53d1\\u5fc3\\u810f\\u75c5\\uff0c\\u5e73\\u9759\\u5730\\u79bb\\u5f00\\u4e86\\u4eba\\u4e16\\u3002\\u7531\\u4e8e\\u5fc3\\u810f\\u75c5\\u53d1\\u4f5c\\u65f6\\u6ca1\\u6709\\u75db\\u82e6\\uff0c\\u6240\\u4ee5\\u4ed6\\u7684\\u8868\\u60c5\\u770b\\u8d77\\u6765\\u5f88\\u5e73\\u9759\\u3002\\u800c\\u684c\\u4e0a\\u7684\\u6c34\\u548c\\u5f00\\u7740\\u7684\\u7535\\u89c6\\uff0c\\u53ea\\u662f\\u4ed6\\u65e5\\u5e38\\u5728\\u5730\\u4e0b\\u5ba4\\u5199\\u4f5c\\u65f6\\u7684\\u4e60\\u60ef\\u3002\\n\\n**\\u53c2\\u4e0e\\u8005\\u63d0\\u51fa\\u7684\\u95ee\\u9898:** \\u6c34\\u6709\\u6bd2\\n\",\n \"\\u4f60\\u662f\\u4e00\\u4e2a\\u60c5\\u666f\\u731c\\u8c1c\\u6e38\\u620f\\u7684\\u4e3b\\u6301\\u4eba\\u3002\\u6e38\\u620f\\u89c4\\u5219\\u5982\\u4e0b\\uff1a\\n\\n1. \\u53c2\\u4e0e\\u8005\\u4f1a\\u5f97\\u5230\\u4e00\\u4e2a\\u8c1c\\u9762\\uff0c\\u8c1c\\u9762\\u4f1a\\u63cf\\u8ff0\\u4e00\\u4e2a\\u7b80\\u5355\\u53c8\\u96be\\u4ee5\\u7406\\u89e3\\u7684\\u4e8b\\u4ef6\\u3002\\n2. \\u4e3b\\u6301\\u4eba\\u77e5\\u9053\\u8c1c\\u5e95\\uff0c\\u8c1c\\u5e95\\u662f\\u8c1c\\u9762\\u7684\\u7b54\\u6848\\u3002\\n3. \\u53c2\\u4e0e\\u8005\\u53ef\\u4ee5\\u8be2\\u95ee\\u4efb\\u4f55\\u5c01\\u95ed\\u5f0f\\u95ee\\u9898\\u6765\\u627e\\u5bfb\\u4e8b\\u4ef6\\u7684\\u771f\\u76f8\\u3002\\n4. \\u5bf9\\u4e8e\\u6bcf\\u4e2a\\u95ee\\u9898\\uff0c\\u4e3b\\u6301\\u4eba\\u5c06\\u6839\\u636e\\u5b9e\\u9645\\u60c5\\u51b5\\u56de\\u7b54\\u4ee5\\u4e0b\\u4e94\\u4e2a\\u9009\\u9879\\u4e4b\\u4e00\\uff1a\\u662f\\u3001\\u4e0d\\u662f\\u3001\\u4e0d\\u91cd\\u8981\\u3001\\u56de\\u7b54\\u6b63\\u786e\\u3001\\u95ee\\u6cd5\\u9519\\u8bef\\u3002\\u5404\\u56de\\u7b54\\u7684\\u5224\\u65ad\\u6807\\u51c6\\u5982\\u4e0b\\uff1a\\n - \\u82e5\\u8c1c\\u9762\\u548c\\u8c1c\\u5e95\\u80fd\\u627e\\u5230\\u95ee\\u9898\\u7684\\u7b54\\u6848\\uff0c\\u56de\\u7b54\\uff1a\\u662f\\u6216\\u8005\\u4e0d\\u662f\\n - \\u82e5\\u8c1c\\u9762\\u548c\\u8c1c\\u5e95\\u4e0d\\u80fd\\u76f4\\u63a5\\u6216\\u8005\\u95f4\\u63a5\\u63a8\\u65ad\\u51fa\\u95ee\\u9898\\u7684\\u7b54\\u6848\\uff0c\\u56de\\u7b54\\uff1a\\u4e0d\\u91cd\\u8981\\n - \\u82e5\\u53c2\\u4e0e\\u8005\\u63d0\\u95ee\\u4e0d\\u662f\\u4e00\\u4e2a\\u5c01\\u95ed\\u5f0f\\u95ee\\u9898\\u6216\\u8005\\u95ee\\u9898\\u96be\\u4ee5\\u7406\\u89e3\\uff0c\\u56de\\u7b54\\uff1a\\u95ee\\u6cd5\\u9519\\u8bef\\n - \\u82e5\\u53c2\\u4e0e\\u8005\\u63d0\\u95ee\\u57fa\\u672c\\u8fd8\\u539f\\u4e86\\u8c1c\\u5e95\\u771f\\u76f8\\uff0c\\u56de\\u7b54\\uff1a\\u56de\\u7b54\\u6b63\\u786e\\n5. \\u56de\\u7b54\\u4e2d\\u4e0d\\u80fd\\u6dfb\\u52a0\\u4efb\\u4f55\\u5176\\u5b83\\u4fe1\\u606f\\uff0c\\u4e5f\\u4e0d\\u80fd\\u7701\\u7565\\u9009\\u9879\\u4e2d\\u7684\\u4efb\\u4f55\\u4e00\\u4e2a\\u5b57\\u3002\\u4f8b\\u5982\\uff0c\\u4e0d\\u53ef\\u4ee5\\u628a\\u201c\\u4e0d\\u662f\\u201d\\u7701\\u7565\\u6210\\u201c\\u4e0d\\u201d\\u3002\\n\\n\\u8bf7\\u4e25\\u683c\\u6309\\u7167\\u8fd9\\u4e9b\\u89c4\\u5219\\u56de\\u7b54\\u53c2\\u4e0e\\u8005\\u63d0\\u51fa\\u7684\\u95ee\\u9898\\u3002\\n\\n**\\u8c1c\\u9762:** \\u5728\\u4e00\\u4e2a\\u5bc2\\u9759\\u7684\\u591c\\u665a\\uff0c\\u7504\\u8d3e\\u8d3e\\u5306\\u5306\\u5fd9\\u5fd9\\u5730\\u4ece\\u5c0f\\u5df7\\u5b50\\u91cc\\u8dd1\\u4e86\\u51fa\\u6765\\uff0c\\u8138\\u4e0a\\u6ee1\\u662f\\u60ca\\u6050\\u3002\\u5728\\u4ed6\\u8eab\\u540e\\uff0c\\u4e00\\u53ea\\u7a7a\\u8361\\u8361\\u7684\\u5783\\u573e\\u6876\\u7ffb\\u5012\\u5728\\u5730\\u3002\\u7504\\u8d3e\\u8d3e\\u5e76\\u975e\\u5c0f\\u5df7\\u91cc\\u7684\\u5c45\\u6c11\\uff0c\\u4e5f\\u6ca1\\u6709\\u4e0e\\u4eba\\u7ed3\\u6028\\u3002\\u7a76\\u7adf\\u662f\\u4ec0\\u4e48\\u539f\\u56e0\\u8ba9\\u4ed6\\u5982\\u6b64\\u60ca\\u614c\\u5931\\u63aa\\uff1f\\n\\n**\\u8c1c\\u5e95:** \\u539f\\u6765\\uff0c\\u7504\\u8d3e\\u8d3e\\u662f\\u4e00\\u540d\\u6b63\\u5728\\u6f5c\\u9003\\u7684\\u5c0f\\u5077\\u3002\\u5f53\\u665a\\uff0c\\u4ed6\\u4f01\\u56fe\\u5728\\u5df7\\u5b50\\u91cc\\u5bfb\\u627e\\u53ef\\u4ee5\\u76d7\\u7a83\\u7684\\u76ee\\u6807\\uff0c\\u5374\\u4e0d\\u6599\\u5783\\u573e\\u6876\\u91cc\\u7a81\\u7136\\u7a9c\\u51fa\\u4e00\\u53ea\\u91ce\\u732b\\uff0c\\u5c06\\u4ed6\\u5413\\u4e86\\u4e00\\u8df3\\u3002\\u4ed6\\u4ee5\\u4e3a\\u662f\\u88ab\\u8b66\\u65b9\\u53d1\\u73b0\\u4e86\\uff0c\\u4e8e\\u662f\\u60ca\\u614c\\u5931\\u63aa\\u5730\\u9003\\u8dd1\\u4e86\\u3002\\u800c\\u90a3\\u53ea\\u5783\\u573e\\u6876\\uff0c\\u6b63\\u662f\\u4ed6\\u7ffb\\u627e\\u4e1c\\u897f\\u65f6\\u4e0d\\u5c0f\\u5fc3\\u5f04\\u7ffb\\u7684\\u3002\\n\\n**\\u53c2\\u4e0e\\u8005\\u63d0\\u51fa\\u7684\\u95ee\\u9898:** \\u4ed6\\u770b\\u5230\\u4e86\\u4e0d\\u8be5\\u770b\\u7684\\u4e1c\\u897f\\u5417\\n\",\n \"\\u4f60\\u662f\\u4e00\\u4e2a\\u60c5\\u666f\\u731c\\u8c1c\\u6e38\\u620f\\u7684\\u4e3b\\u6301\\u4eba\\u3002\\u6e38\\u620f\\u89c4\\u5219\\u5982\\u4e0b\\uff1a\\n\\n1. \\u53c2\\u4e0e\\u8005\\u4f1a\\u5f97\\u5230\\u4e00\\u4e2a\\u8c1c\\u9762\\uff0c\\u8c1c\\u9762\\u4f1a\\u63cf\\u8ff0\\u4e00\\u4e2a\\u7b80\\u5355\\u53c8\\u96be\\u4ee5\\u7406\\u89e3\\u7684\\u4e8b\\u4ef6\\u3002\\n2. \\u4e3b\\u6301\\u4eba\\u77e5\\u9053\\u8c1c\\u5e95\\uff0c\\u8c1c\\u5e95\\u662f\\u8c1c\\u9762\\u7684\\u7b54\\u6848\\u3002\\n3. \\u53c2\\u4e0e\\u8005\\u53ef\\u4ee5\\u8be2\\u95ee\\u4efb\\u4f55\\u5c01\\u95ed\\u5f0f\\u95ee\\u9898\\u6765\\u627e\\u5bfb\\u4e8b\\u4ef6\\u7684\\u771f\\u76f8\\u3002\\n4. \\u5bf9\\u4e8e\\u6bcf\\u4e2a\\u95ee\\u9898\\uff0c\\u4e3b\\u6301\\u4eba\\u5c06\\u6839\\u636e\\u5b9e\\u9645\\u60c5\\u51b5\\u56de\\u7b54\\u4ee5\\u4e0b\\u4e94\\u4e2a\\u9009\\u9879\\u4e4b\\u4e00\\uff1a\\u662f\\u3001\\u4e0d\\u662f\\u3001\\u4e0d\\u91cd\\u8981\\u3001\\u56de\\u7b54\\u6b63\\u786e\\u3001\\u95ee\\u6cd5\\u9519\\u8bef\\u3002\\u5404\\u56de\\u7b54\\u7684\\u5224\\u65ad\\u6807\\u51c6\\u5982\\u4e0b\\uff1a\\n - \\u82e5\\u8c1c\\u9762\\u548c\\u8c1c\\u5e95\\u80fd\\u627e\\u5230\\u95ee\\u9898\\u7684\\u7b54\\u6848\\uff0c\\u56de\\u7b54\\uff1a\\u662f\\u6216\\u8005\\u4e0d\\u662f\\n - \\u82e5\\u8c1c\\u9762\\u548c\\u8c1c\\u5e95\\u4e0d\\u80fd\\u76f4\\u63a5\\u6216\\u8005\\u95f4\\u63a5\\u63a8\\u65ad\\u51fa\\u95ee\\u9898\\u7684\\u7b54\\u6848\\uff0c\\u56de\\u7b54\\uff1a\\u4e0d\\u91cd\\u8981\\n - \\u82e5\\u53c2\\u4e0e\\u8005\\u63d0\\u95ee\\u4e0d\\u662f\\u4e00\\u4e2a\\u5c01\\u95ed\\u5f0f\\u95ee\\u9898\\u6216\\u8005\\u95ee\\u9898\\u96be\\u4ee5\\u7406\\u89e3\\uff0c\\u56de\\u7b54\\uff1a\\u95ee\\u6cd5\\u9519\\u8bef\\n - \\u82e5\\u53c2\\u4e0e\\u8005\\u63d0\\u95ee\\u57fa\\u672c\\u8fd8\\u539f\\u4e86\\u8c1c\\u5e95\\u771f\\u76f8\\uff0c\\u56de\\u7b54\\uff1a\\u56de\\u7b54\\u6b63\\u786e\\n5. \\u56de\\u7b54\\u4e2d\\u4e0d\\u80fd\\u6dfb\\u52a0\\u4efb\\u4f55\\u5176\\u5b83\\u4fe1\\u606f\\uff0c\\u4e5f\\u4e0d\\u80fd\\u7701\\u7565\\u9009\\u9879\\u4e2d\\u7684\\u4efb\\u4f55\\u4e00\\u4e2a\\u5b57\\u3002\\u4f8b\\u5982\\uff0c\\u4e0d\\u53ef\\u4ee5\\u628a\\u201c\\u4e0d\\u662f\\u201d\\u7701\\u7565\\u6210\\u201c\\u4e0d\\u201d\\u3002\\n\\n\\u8bf7\\u4e25\\u683c\\u6309\\u7167\\u8fd9\\u4e9b\\u89c4\\u5219\\u56de\\u7b54\\u53c2\\u4e0e\\u8005\\u63d0\\u51fa\\u7684\\u95ee\\u9898\\u3002\\n\\n**\\u8c1c\\u9762:** \\u5728\\u4e00\\u4e2a\\u5bc2\\u9759\\u7684\\u591c\\u665a\\uff0c\\u7504\\u8d3e\\u8d3e\\u5306\\u5306\\u5fd9\\u5fd9\\u5730\\u4ece\\u5c0f\\u5df7\\u5b50\\u91cc\\u8dd1\\u4e86\\u51fa\\u6765\\uff0c\\u8138\\u4e0a\\u6ee1\\u662f\\u60ca\\u6050\\u3002\\u5728\\u4ed6\\u8eab\\u540e\\uff0c\\u4e00\\u53ea\\u7a7a\\u8361\\u8361\\u7684\\u5783\\u573e\\u6876\\u7ffb\\u5012\\u5728\\u5730\\u3002\\u7504\\u8d3e\\u8d3e\\u5e76\\u975e\\u5c0f\\u5df7\\u91cc\\u7684\\u5c45\\u6c11\\uff0c\\u4e5f\\u6ca1\\u6709\\u4e0e\\u4eba\\u7ed3\\u6028\\u3002\\u7a76\\u7adf\\u662f\\u4ec0\\u4e48\\u539f\\u56e0\\u8ba9\\u4ed6\\u5982\\u6b64\\u60ca\\u614c\\u5931\\u63aa\\uff1f\\n\\n**\\u8c1c\\u5e95:** \\u539f\\u6765\\uff0c\\u7504\\u8d3e\\u8d3e\\u662f\\u4e00\\u540d\\u6b63\\u5728\\u6f5c\\u9003\\u7684\\u5c0f\\u5077\\u3002\\u5f53\\u665a\\uff0c\\u4ed6\\u4f01\\u56fe\\u5728\\u5df7\\u5b50\\u91cc\\u5bfb\\u627e\\u53ef\\u4ee5\\u76d7\\u7a83\\u7684\\u76ee\\u6807\\uff0c\\u5374\\u4e0d\\u6599\\u5783\\u573e\\u6876\\u91cc\\u7a81\\u7136\\u7a9c\\u51fa\\u4e00\\u53ea\\u91ce\\u732b\\uff0c\\u5c06\\u4ed6\\u5413\\u4e86\\u4e00\\u8df3\\u3002\\u4ed6\\u4ee5\\u4e3a\\u662f\\u88ab\\u8b66\\u65b9\\u53d1\\u73b0\\u4e86\\uff0c\\u4e8e\\u662f\\u60ca\\u614c\\u5931\\u63aa\\u5730\\u9003\\u8dd1\\u4e86\\u3002\\u800c\\u90a3\\u53ea\\u5783\\u573e\\u6876\\uff0c\\u6b63\\u662f\\u4ed6\\u7ffb\\u627e\\u4e1c\\u897f\\u65f6\\u4e0d\\u5c0f\\u5fc3\\u5f04\\u7ffb\\u7684\\u3002\\n\\n**\\u53c2\\u4e0e\\u8005\\u63d0\\u51fa\\u7684\\u95ee\\u9898:** \\u6d41\\u6d6a\\u732b\\u5417\\uff1f\\n\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"input\",\n \"properties\": {\n \"dtype\": \"object\",\n \"num_unique_values\": 1,\n \"samples\": [\n \"\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"output\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 5,\n \"samples\": [\n \"\\u4e0d\\u91cd\\u8981\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}"}},"metadata":{},"execution_count":32}],"source":["df_alpaca = load_alpaca_data(data_path, using_p1=False)\n","df_alpaca.head()"]},{"source":["# @title output\n","\n","from matplotlib import pyplot as plt\n","import seaborn as sns\n","df_alpaca.groupby('output').size().plot(kind='barh', color=sns.palettes.mpl_palette('Dark2'))\n","plt.gca().spines[['top', 'right',]].set_visible(False)"],"cell_type":"code","execution_count":33,"outputs":[{"output_type":"stream","name":"stderr","text":["/usr/local/lib/python3.10/dist-packages/IPython/core/events.py:89: UserWarning: Glyph 19981 (\\N{CJK UNIFIED IDEOGRAPH-4E0D}) missing from current font.\n"," func(*args, **kwargs)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/events.py:89: UserWarning: Glyph 26159 (\\N{CJK UNIFIED IDEOGRAPH-662F}) missing from current font.\n"," func(*args, **kwargs)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/events.py:89: UserWarning: Glyph 37325 (\\N{CJK UNIFIED IDEOGRAPH-91CD}) missing from current font.\n"," func(*args, **kwargs)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/events.py:89: UserWarning: Glyph 35201 (\\N{CJK UNIFIED IDEOGRAPH-8981}) missing from current font.\n"," func(*args, **kwargs)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/events.py:89: UserWarning: Glyph 22238 (\\N{CJK UNIFIED IDEOGRAPH-56DE}) missing from current font.\n"," func(*args, **kwargs)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/events.py:89: UserWarning: Glyph 31572 (\\N{CJK UNIFIED IDEOGRAPH-7B54}) missing from current font.\n"," func(*args, **kwargs)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/events.py:89: UserWarning: Glyph 27491 (\\N{CJK UNIFIED IDEOGRAPH-6B63}) missing from current font.\n"," func(*args, **kwargs)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/events.py:89: UserWarning: Glyph 30830 (\\N{CJK UNIFIED IDEOGRAPH-786E}) missing from current font.\n"," func(*args, **kwargs)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/events.py:89: UserWarning: Glyph 38382 (\\N{CJK UNIFIED IDEOGRAPH-95EE}) missing from current font.\n"," func(*args, **kwargs)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/events.py:89: UserWarning: Glyph 27861 (\\N{CJK UNIFIED IDEOGRAPH-6CD5}) missing from current font.\n"," func(*args, **kwargs)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/events.py:89: UserWarning: Glyph 38169 (\\N{CJK UNIFIED IDEOGRAPH-9519}) missing from current font.\n"," func(*args, **kwargs)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/events.py:89: UserWarning: Glyph 35823 (\\N{CJK UNIFIED IDEOGRAPH-8BEF}) missing from current font.\n"," func(*args, **kwargs)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 19981 (\\N{CJK UNIFIED IDEOGRAPH-4E0D}) missing from current font.\n"," fig.canvas.print_figure(bytes_io, **kw)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 26159 (\\N{CJK UNIFIED IDEOGRAPH-662F}) missing from current font.\n"," fig.canvas.print_figure(bytes_io, **kw)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 37325 (\\N{CJK UNIFIED IDEOGRAPH-91CD}) missing from current font.\n"," fig.canvas.print_figure(bytes_io, **kw)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 35201 (\\N{CJK UNIFIED IDEOGRAPH-8981}) missing from current font.\n"," fig.canvas.print_figure(bytes_io, **kw)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 22238 (\\N{CJK UNIFIED IDEOGRAPH-56DE}) missing from current font.\n"," fig.canvas.print_figure(bytes_io, **kw)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 31572 (\\N{CJK UNIFIED IDEOGRAPH-7B54}) missing from current font.\n"," fig.canvas.print_figure(bytes_io, **kw)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 27491 (\\N{CJK UNIFIED IDEOGRAPH-6B63}) missing from current font.\n"," fig.canvas.print_figure(bytes_io, **kw)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 30830 (\\N{CJK UNIFIED IDEOGRAPH-786E}) missing from current font.\n"," fig.canvas.print_figure(bytes_io, **kw)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 38382 (\\N{CJK UNIFIED IDEOGRAPH-95EE}) missing from current font.\n"," fig.canvas.print_figure(bytes_io, **kw)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 27861 (\\N{CJK UNIFIED IDEOGRAPH-6CD5}) missing from current font.\n"," fig.canvas.print_figure(bytes_io, **kw)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 38169 (\\N{CJK UNIFIED IDEOGRAPH-9519}) missing from current font.\n"," fig.canvas.print_figure(bytes_io, **kw)\n","/usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 35823 (\\N{CJK UNIFIED IDEOGRAPH-8BEF}) missing from current font.\n"," fig.canvas.print_figure(bytes_io, **kw)\n"]},{"output_type":"display_data","data":{"text/plain":["
"],"image/png":"iVBORw0KGgoAAAANSUhEUgAAAkkAAAGdCAYAAAAGx+eQAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAdzklEQVR4nO3de5CV9X348c8uy+6y1T3gBQiyBCIqidKUuJFLYmFGpsTa2jRpIwyJxpgWjU60qReQpqIdC2My0USjTfNrQ2LSYJxqmm5tMhYJxoxKIGDkUmKqCElBp+JeGLbLZb+/PzKceNivUJZlnwVfr5kz4z7Pc85+nu+w7nuec9mqlFIKAAAqVBc9AADAQCSSAAAyRBIAQIZIAgDIEEkAABkiCQAgQyQBAGSIJACADJF0GCmlaG9vD5+5CQBvLSLpMDo6OqJUKkVHR0fRowAA/UgkAQBkiCQAgAyRBACQIZIAADJEEgBAhkgCAMgQSQAAGSIJACBDJAEAZIgkAIAMkQQAkCGSAAAyRBIAQIZIAgDIEEkAABkiCQAgQyQBAGTUFD3A8eL6h8+N2oaB05RfmfNy0SMAwAlt4PzWBwAYQEQSAECGSAIAyBBJAAAZIgkAIEMkAQBkiCQAgAyRBACQIZIAADJEEgBAhkgCAMgQSQAAGSIJACCjpqhvvHLlypg3b17U19dXbO/u7o7p06fHqlWroqurq8f9du3aFRs2bIh77rknHnzwwaipqTyFPXv2xMKFC2PKlClx8cUXR0NDQ4/HGDduXDz66KN9e0IAwAmlsEjq7OyM2bNnx6JFiyq2b9myJebPnx9VVVWxbt26HvebMWNGpJTi9ddfj/vuuy9mzJhRsX/p0qXR0dERe/fujWnTpsXSpUt7PMaUKVP67kQAgBOSp9sAADJEEgBAR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IAADJEEgBAhkgCAMgQSQAAGSIJACBDJAEAZIgkAIAMkQQAkCGSAAAyRBIAQIZIAgDIEEkAABkiCQAgQyQBAGSIJACADJEEAJAhkgAAMkQSAECGSAIAyBBJAAAZIgkAIEMkAQBkiCQAgAyRBACQIZIAADJEEgBAhkgCAMgQSQAAGSIJACBDJAEAZPQqku64447YvXt3j+2dnZ1xxx13HPVQAABFq0oppSO906BBg2L79u0xfPjwiu2vvfZaDB8+PPbv399nAxatvb09SqVStLW1RWNjY9HjAAD9pKY3d0opRVVVVY/tzz33XJxyyilHPdRA9Nn534+6uoZj9vh33f0Hx+yxAYAjd0SRNGzYsKiqqoqqqqo4++yzK0Jp//79sWvXrrj66qv7fEgAgP52RJF0zz33REopPvGJT8Ttt98epVKpvK+2tjbGjh0bU6dO7fMhAQD62xFF0hVXXBEREePGjYtp06bF4MGDj8lQAABF69VrksaNGxfbt29/0/1jxozp9UAAAANBryJp7Nix2RduH3AivbsNAHhr6lUkrV27tuLrvXv3xtq1a+MLX/hC3HnnnX0yGABAkXoVSe9+97t7bGtubo5Ro0bF5z73ufjQhz501IMBABSpT/8syTnnnBM/+clP+vIhAQAK0asrSe3t7RVfp5Ri+/btsWjRojjrrLP6ZDAAgCL1KpKGDh3a44XbKaVoamqKZcuW9clgAABF6lUkrVixouLr6urqOP3002P8+PFRU9OrhwQAGFB6VTTTp0/v6zkAAAaUXl/22bx5c9x7772xadOmiIh45zvfGdddd11MmDChz4YDAChKryLpn//5n2P27NnR3Nxc/lttzzzzTEycODGWLVsWH/7whw/7GCtXrox58+ZFfX19xfbu7u6YPn16rFq1Krq6unrcb9euXbFhw4a455574sEHH+zx9N6ePXti4cKFMWXKlLj44oujoaGhx2OMGzcuHn300SM5ZQDgLaZXkXTzzTfHggUL4o477qjYftttt8XNN9/8f4qkzs7OmD17dixatKhi+5YtW2L+/PlRVVUV69at63G/GTNmREopXn/99bjvvvtixowZFfuXLl0aHR0dsXfv3pg2bVosXbq0x2NMmTLlsPMBAG9tvfqcpO3bt8fll1/eY/tHP/rRQ/5NNwCA40WvImnGjBnxox/9qMf2p556Ki688MKjHqpIXV1d0d7eXnEDAN56evV026WXXhq33HJLrFmzpvzU1TPPPBMPP/xw3H777fG9732v4tjjyeLFi+P2228vegwAoGC9iqRPfepTERFx//33x/3335/dFxFRVVUV+/fvP4rx+t+CBQviM5/5TPnr9vb2aGpqKnAiAKAIvYqk7u7uvp5jwKirq4u6urqixwAACtar1yR94xvfyL49f8+ePfGNb3zjqIcCACharyLpyiuvjLa2th7bOzo64sorrzzqoQAAitarSEop9fgDtxERv/zlL6NUKh31UAAARTui1yRNmjQpqqqqoqqqKi666KKKT7vev39/vPTSS/GBD3ygz4cEAOhvRxRJH/zgByMiYt26dTFr1qw46aSTyvtqa2tj7Nix/6dP2wYAGOiOKJJuu+22iIgYO3ZsXHbZZT3+7tqRKJVK0dLSEi0tLT32zZo1K1pbW6O5uTl73+rq6hg9enTceOON2f233nprDBkyJNavX599jIkTJ/Z6bgDgraEqpZSKHmIga29vj1KpFJ++5qGoq+v5x3L7yl13/8Exe2wA4Mj16nOSqqursy/cPuB4+wBJAICD9SqSHnnkkYpI2rt3b6xduza+/vWv+5MeAMAJoVeRdOAF3G/0J3/yJ3HuuefGQw89FFddddXRzgUAUKhefU7Sm5kyZUosX768Lx8SAKAQfRZJnZ2d8aUvfSnOOOOMvnpIAIDC9OrptmHDhlW8JimlFB0dHdHQ0BDf/OY3+2w4AICi9CqS7r777opIqq6ujtNPPz0mT54cw4YN67PhAACK0qtI+vjHPx6tra3xD//wD7Fp06aIiHjXu94VU6dO7dPhAACK0qvXJK1evTrGjx8fd999d+zcuTN27twZd999d5x55pnx05/+tK9nBADod736xO0LL7wwxo8fH1/96lfLf+R237598clPfjJefPHFePLJJ/t80KIc+MTttra2aGxsLHocAKCf9CqShgwZEmvXro0JEyZUbN+4cWM0NzfH7t27+2zAookkAHhr6tXTbY2NjbF169Ye27dt2xYnn3zyUQ8FAFC0XkXSZZddFldddVU89N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UyePDlWrVpV9Ej9bvHixfHe9743Tj755Bg+fHh88IMfjM2bN1cc87//+79x7bXXxqmnnhonnXRSfPjDH45XXnml4pitW7fGJZdcEg0NDTF8+PC46aabYt++fRXH/PCHP4z3vOc9UVdXF+PHj4+lS5ce69Prd0uWLImqqqq44YYbytus3+H96le/io9+9KNx6qmnxpAhQ2LixImxevXq8v6UUvz1X/91vO1tb4shQ4bEzJkz44UXXqh4jJ07d8bcuXOjsbExhg4dGldddVXs2rWr4pif/exnceGFF0Z9fX00NTXFXXfd1S/ndyzt378/PvvZz8a4ceNiyJAhceaZZ8bf/M3fxBvfs2P9fuPJJ5+MP/zDP4xRo0ZFVVVVfPe7363Y359r9fDDD8eECROivr4+Jk6cGI899lifn29fO9T67d27N2655ZaYOHFi/NZv/VaMGjUqLr/88vjv//7viscYUOuXyFq2bFmqra1N//iP/5g2bNiQ/uzP/iwNHTo0vfLKK0WP1q9mzZqVvva1r6X169endevWpd///d9PY8aMSbt27Sofc/XVV6empqa0fPnytHr16jRlypQ0bdq08v59+/al8847L82cOTOtXbs2PfbYY+m0005LCxYsKB/z4osvpoaGhvSZz3wmbdy4Md17771p0KBB6fvf/36/nu+xtGrVqjR27Nj027/92+n6668vb7d+h7Zz58709re/PX384x9Pzz77bHrxxRfTD37wg/SLX/yifMySJUtSqVRK3/3ud9Nzzz2XLr300jRu3LjU2dlZPuYDH/hAeve7352eeeaZ9KMf/SiNHz8+zZkzp7y/ra0tjRgxIs2dOzetX78+ffvb305DhgxJX/nKV/r1fPvanXfemU499dTU0tKSXnrppfTwww+nk046KX3xi18sH2P9fuOxxx5LCxcuTI888kiKiPToo49W7O+vtfrxj3+cBg0alO666660cePG9Fd/9Vdp8ODB6fnnnz/ma3A0DrV+ra2taebMmemhhx5K//mf/5mefvrpdMEFF6Tzzz+/4jEG0vqJpDdxwQUXpGuvvbb89f79+9OoUaPS4sWLC5yqeK+++mqKiLRy5cqU0q//0Q8ePDg9/PDD5WM2bdqUIiI9/fTTKaVf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pEO699940ZsyYVFtbmy644IL0zDPPFD1Sv4uI7O1rX/ta+ZjOzs70qU99Kg0bNiw1NDSkP/7jP07bt2+veJwtW7akiy++OA0ZMiSddtpp6S//8i/T3r17K45ZsWJF+p3f+Z1UW1ub3vGOd1R8jxPJwZFk/Q7vX//1X9N5552X6urq0oQJE9Lf//3fV+zv7u5On/3sZ9OIESNSXV1duuiii9LmzZsrjnnttdfSnDlz0kknnZQaGxvTlVdemTo6OiqOee6559L73//+VFdXl84444y0ZMmSY35ux1p7e3u6/vrr05gxY1J9fX16xzvekRYuXFjxS8n6/caKFSuy/8+74oorUkr9u1bf+c530tlnn51qa2vTueeem/7t3/7tmJ13XznU+r300ktv+jtlxYoV5ccYSOtXldIbPnYVAICI8JokAIAskQQAkCGSAAAyRBIAQIZIAgDIEEkAABkiCQAgQyQBAGSIJACADJEEAJAhkgAAMkQSAEDG/wcBuu6n8K4FKAAAAABJRU5ErkJggg==\n"},"metadata":{}}],"metadata":{"cellView":"form","colab":{"base_uri":"https://localhost:8080/","height":1000},"id":"_ofVQITbZiTI","executionInfo":{"status":"ok","timestamp":1720711642271,"user_tz":-480,"elapsed":8,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"}},"outputId":"9c08e305-5e54-4a62-8ed7-4bdf78e1866f"}},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"xPVpy6WpZBrN","outputId":"b5dc593a-8da5-4dfb-e056-192d0325f299"},"outputs":[{"output_type":"stream","name":"stdout","text":["Current Directory:\n","/content/drive/MyDrive/logical-reasoning/llama-factory\n","config/internlm2_5_7b_lora_sft_bf16_p2.yaml:\n"," {\n"," \"model_name_or_path\": \"internlm/internlm2_5-7b-chat-1m\",\n"," \"stage\": \"sft\",\n"," \"do_train\": true,\n"," \"finetuning_type\": \"lora\",\n"," \"lora_target\": \"all\",\n"," \"loraplus_lr_ratio\": 16.0,\n"," \"upcast_layernorm\": true,\n"," \"dataset\": \"alpaca_mgtv_p2\",\n"," \"template\": \"chatml\",\n"," \"cutoff_len\": 1024,\n"," \"max_samples\": 5000,\n"," \"overwrite_cache\": true,\n"," \"preprocessing_num_workers\": 16,\n"," \"output_dir\": \"saves/internlm2_5_7b/lora/sft_bf16_p2\",\n"," \"logging_steps\": 100,\n"," \"save_steps\": 562,\n"," \"plot_loss\": true,\n"," \"overwrite_output_dir\": true,\n"," \"per_device_train_batch_size\": 1,\n"," \"gradient_accumulation_steps\": 8,\n"," \"learning_rate\": 0.0001,\n"," \"num_train_epochs\": 4.0,\n"," \"lr_scheduler_type\": \"cosine\",\n"," \"warmup_ratio\": 0.1,\n"," \"bf16\": true,\n"," \"ddp_timeout\": 180000000,\n"," \"val_size\": 0.1,\n"," \"per_device_eval_batch_size\": 1,\n"," \"eval_strategy\": \"steps\",\n"," \"eval_steps\": 562,\n"," \"report_to\": \"wandb\",\n"," \"run_name\": \"internlm2_5_7b\"\n","}\n","2024-07-11 15:27:28.654916: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.\n","2024-07-11 15:27:28.706836: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\n","2024-07-11 15:27:28.706879: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\n","2024-07-11 15:27:28.708441: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\n","2024-07-11 15:27:28.716261: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.\n","To enable the following instructions: AVX2 AVX512F AVX512_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.\n","2024-07-11 15:27:29.959219: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT\n","07/11/2024 15:27:37 - INFO - llamafactory.hparams.parser - Process rank: 0, device: cuda:0, n_gpu: 1, distributed training: False, compute dtype: torch.bfloat16\n","tokenizer_config.json: 100% 2.51k/2.51k [00:00<00:00, 17.1MB/s]\n","tokenization_internlm2_fast.py: 100% 7.80k/7.80k [00:00<00:00, 37.5MB/s]\n","tokenization_internlm2.py: 100% 8.81k/8.81k [00:00<00:00, 42.6MB/s]\n","tokenizer.model: 100% 1.48M/1.48M [00:00<00:00, 123MB/s]\n","special_tokens_map.json: 100% 713/713 [00:00<00:00, 4.85MB/s]\n","[INFO|tokenization_utils_base.py:2108] 2024-07-11 15:27:41,196 >> loading file ./tokenizer.model from cache at /root/.cache/huggingface/hub/models--internlm--internlm2_5-7b-chat-1m/snapshots/8d1a709a04d71440ef3df6ebbe204672f411c8b6/./tokenizer.model\n","[INFO|tokenization_utils_base.py:2108] 2024-07-11 15:27:41,196 >> loading file added_tokens.json from cache at None\n","[INFO|tokenization_utils_base.py:2108] 2024-07-11 15:27:41,196 >> loading file special_tokens_map.json from cache at /root/.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-11 15:27:41,196 >> loading file tokenizer_config.json from cache at /root/.cache/huggingface/hub/models--internlm--internlm2_5-7b-chat-1m/snapshots/8d1a709a04d71440ef3df6ebbe204672f411c8b6/tokenizer_config.json\n","[INFO|tokenization_utils_base.py:2108] 2024-07-11 15:27:41,196 >> loading file tokenizer.json from cache at None\n","07/11/2024 15:27:42 - INFO - llamafactory.data.template - Replace eos token: <|im_end|>\n","07/11/2024 15:27:42 - INFO - llamafactory.data.template - Add <|im_start|> to stop words.\n","07/11/2024 15:27:43 - INFO - llamafactory.data.loader - Loading dataset alpaca_mgtv_p2.json...\n","Generating train split: 25000 examples [00:00, 35807.97 examples/s]\n","/usr/local/lib/python3.10/dist-packages/multiprocess/popen_fork.py:66: RuntimeWarning: os.fork() was called. os.fork() is incompatible with multithreaded code, and JAX is multithreaded, so this will likely lead to a deadlock.\n"," self.pid = os.fork()\n","Converting format of dataset (num_proc=16): 100% 5000/5000 [00:00<00:00, 20104.28 examples/s]\n","Running tokenizer on dataset (num_proc=16): 100% 5000/5000 [00:02<00:00, 1757.57 examples/s]\n","input_ids:\n","[92543, 1008, 364, 60403, 68625, 77794, 62591, 63352, 68309, 69323, 60687, 60364, 60355, 68309, 69776, 68411, 60387, 402, 312, 281, 262, 69102, 60497, 60382, 89428, 63352, 60388, 60353, 63352, 60388, 60382, 69401, 68252, 87114, 70436, 68865, 82168, 60355, 364, 314, 281, 262, 74243, 68290, 63352, 60930, 60353, 63352, 60930, 60357, 63352, 68421, 69059, 60355, 364, 308, 281, 262, 69102, 60497, 68251, 73477, 68574, 74004, 60550, 68287, 89214, 61683, 88840, 73687, 60355, 364, 319, 281, 262, 68390, 68772, 68287, 60353, 74243, 60530, 68420, 74740, 68855, 68544, 72719, 68423, 68538, 60387, 60357, 60359, 68278, 60359, 82568, 60359, 68855, 69077, 60359, 60593, 60408, 69583, 60355, 60684, 68855, 60354, 69844, 68559, 68411, 60387, 364, 393, 285, 262, 61369, 63352, 81953, 63352, 60930, 91085, 70670, 69059, 60353, 68855, 60387, 60357, 68319, 68278, 364, 393, 285, 262, 61369, 63352, 81953, 63352, 60930, 68336, 68376, 68319, 80078, 60876, 61015, 60389, 70670, 69059, 60353, 68855, 60387, 82568, 364, 393, 285, 262, 61369, 69102, 60497, 73912, 79865, 74004, 60550, 68287, 68319, 68287, 70436, 68865, 60353, 68855, 60387, 60593, 60408, 69583, 364, 393, 285, 262, 61369, 69102, 60497, 73912, 68406, 71940, 60362, 63352, 60930, 73687, 60353, 68855, 60387, 68855, 69077, 364, 317, 281, 262, 68855, 60366, 68336, 68535, 68574, 69344, 68347, 60353, 71452, 81256, 68423, 68322, 78818, 60666, 60355, 69192, 60353, 73263, 60581, 60419, 68278, 60420, 81256, 60397, 60419, 60358, 60420, 60355, 402, 60836, 86910, 68374, 69776, 68855, 69102, 60497, 74743, 68287, 60355, 402, 465, 63352, 60388, 334, 465, 262, 60361, 63840, 60396, 78165, 60353, 68935, 79406, 70952, 60387, 69731, 71150, 88982, 82620, 60353, 71150, 61329, 60425, 60649, 68935, 69410, 71150, 60382, 60358, 62273, 60458, 61217, 60353, 71479, 60400, 72593, 69380, 79594, 90209, 60355, 60836, 75326, 71150, 82066, 79202, 68540, 60355, 402, 465, 63352, 60930, 334, 465, 262, 73687, 69607, 60510, 70226, 60372, 62650, 60354, 61044, 61066, 69045, 60355, 71389, 61044, 61066, 89463, 60353, 61002, 60510, 70226, 73027, 70134, 60544, 61422, 60355, 68310, 74907, 60361, 71150, 88982, 82620, 68980, 60355, 69104, 60353, 71062, 61976, 60364, 60353, 70134, 60361, 72325, 60463, 68294, 60612, 70623, 60366, 60877, 60668, 60355, 74726, 60354, 61044, 61066, 68394, 70367, 60447, 69126, 70134, 60353, 69731, 68549, 60530, 69410, 71150, 61882, 60825, 60353, 70395, 70134, 60354, 62296, 60463, 60353, 72069, 86407, 68304, 63024, 60880, 60355, 68597, 68891, 73936, 60362, 69372, 60353, 71093, 72276, 60425, 68252, 82569, 70952, 60355, 402, 465, 69102, 60497, 74743, 68287, 334, 465, 262, 61882, 68279, 60548, 60780, 61076, 364, 92542, 364, 92543, 525, 11353, 364, 68278, 92542]\n","inputs:\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","不是<|im_end|>\n","label_ids:\n","[-100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, 68278, 92542]\n","labels:\n","不是<|im_end|>\n","/usr/local/lib/python3.10/dist-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","config.json: 100% 895/895 [00:00<00:00, 6.35MB/s]\n","[INFO|configuration_utils.py:733] 2024-07-11 15:27:48,939 >> loading configuration file config.json from cache at /root/.cache/huggingface/hub/models--internlm--internlm2_5-7b-chat-1m/snapshots/8d1a709a04d71440ef3df6ebbe204672f411c8b6/config.json\n","configuration_internlm2.py: 100% 8.84k/8.84k [00:00<00:00, 39.3MB/s]\n","[INFO|configuration_utils.py:733] 2024-07-11 15:27:49,809 >> loading configuration file config.json from cache at /root/.cache/huggingface/hub/models--internlm--internlm2_5-7b-chat-1m/snapshots/8d1a709a04d71440ef3df6ebbe204672f411c8b6/config.json\n","[INFO|configuration_utils.py:796] 2024-07-11 15:27:49,810 >> 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","modeling_internlm2.py: 100% 80.7k/80.7k [00:00<00:00, 363kB/s]\n","model.safetensors.index.json: 100% 18.2k/18.2k [00:00<00:00, 76.9MB/s]\n","[INFO|modeling_utils.py:3474] 2024-07-11 15:27:51,751 >> loading weights file model.safetensors from cache at /root/.cache/huggingface/hub/models--internlm--internlm2_5-7b-chat-1m/snapshots/8d1a709a04d71440ef3df6ebbe204672f411c8b6/model.safetensors.index.json\n","Downloading shards: 0% 0/8 [00:00> Instantiating InternLM2ForCausalLM model under default dtype torch.bfloat16.\n","[INFO|configuration_utils.py:962] 2024-07-11 15:28:57,307 >> 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:07<00:00, 1.12it/s]\n","[INFO|modeling_utils.py:4280] 2024-07-11 15:29:04,587 >> All model checkpoint weights were used when initializing InternLM2ForCausalLM.\n","\n","[INFO|modeling_utils.py:4288] 2024-07-11 15:29:04,587 >> 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","generation_config.json: 100% 123/123 [00:00<00:00, 902kB/s]\n","[INFO|configuration_utils.py:917] 2024-07-11 15:29:05,100 >> loading configuration file generation_config.json from cache at /root/.cache/huggingface/hub/models--internlm--internlm2_5-7b-chat-1m/snapshots/8d1a709a04d71440ef3df6ebbe204672f411c8b6/generation_config.json\n","[INFO|configuration_utils.py:962] 2024-07-11 15:29:05,101 >> 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/11/2024 15:29:05 - INFO - llamafactory.model.model_utils.checkpointing - Upcasting layernorm weights in float32.\n","07/11/2024 15:29:05 - INFO - llamafactory.model.model_utils.checkpointing - Gradient checkpointing enabled.\n","07/11/2024 15:29:05 - INFO - llamafactory.model.model_utils.attention - Using vanilla attention implementation.\n","07/11/2024 15:29:05 - INFO - llamafactory.model.adapter - Upcasting trainable params to float32.\n","07/11/2024 15:29:05 - INFO - llamafactory.model.adapter - Fine-tuning method: LoRA\n","07/11/2024 15:29:05 - INFO - llamafactory.model.model_utils.misc - Found linear modules: wo,w3,wqkv,w2,w1\n","07/11/2024 15:29:05 - INFO - llamafactory.model.loader - trainable params: 18,874,368 || all params: 7,756,582,912 || trainable%: 0.2433\n","[INFO|trainer.py:641] 2024-07-11 15:29:05,979 >> Using auto half precision backend\n","07/11/2024 15:29:07 - INFO - llamafactory.train.trainer_utils - Using LoRA+ optimizer with loraplus lr ratio 16.00.\n","[INFO|trainer.py:2078] 2024-07-11 15:29:07,222 >> ***** Running training *****\n","[INFO|trainer.py:2079] 2024-07-11 15:29:07,222 >> Num examples = 4,500\n","[INFO|trainer.py:2080] 2024-07-11 15:29:07,222 >> Num Epochs = 4\n","[INFO|trainer.py:2081] 2024-07-11 15:29:07,222 >> Instantaneous batch size per device = 1\n","[INFO|trainer.py:2084] 2024-07-11 15:29:07,222 >> Total train batch size (w. parallel, distributed & accumulation) = 8\n","[INFO|trainer.py:2085] 2024-07-11 15:29:07,222 >> Gradient Accumulation steps = 8\n","[INFO|trainer.py:2086] 2024-07-11 15:29:07,222 >> Total optimization steps = 2,248\n","[INFO|trainer.py:2087] 2024-07-11 15:29:07,226 >> Number of trainable parameters = 18,874,368\n","[INFO|integration_utils.py:723] 2024-07-11 15:29:07,230 >> Automatic Weights & Biases logging enabled, to disable set os.environ[\"WANDB_DISABLED\"] = \"true\"\n","\u001b[34m\u001b[1mwandb\u001b[0m: Currently logged in as: \u001b[33minflaton-sg\u001b[0m (\u001b[33minflaton-ai\u001b[0m). Use \u001b[1m`wandb login --relogin`\u001b[0m to force relogin\n","\u001b[34m\u001b[1mwandb\u001b[0m: Tracking run with wandb version 0.17.4\n","\u001b[34m\u001b[1mwandb\u001b[0m: Run data is saved locally in \u001b[35m\u001b[1m/content/drive/MyDrive/logical-reasoning/llama-factory/wandb/run-20240711_152908-qhb0out3\u001b[0m\n","\u001b[34m\u001b[1mwandb\u001b[0m: Run \u001b[1m`wandb offline`\u001b[0m to turn off syncing.\n","\u001b[34m\u001b[1mwandb\u001b[0m: Syncing run \u001b[33minternlm2_5_7b\u001b[0m\n","\u001b[34m\u001b[1mwandb\u001b[0m: ⭐️ View project at \u001b[34m\u001b[4mhttps://wandb.ai/inflaton-ai/huggingface\u001b[0m\n","\u001b[34m\u001b[1mwandb\u001b[0m: 🚀 View run at \u001b[34m\u001b[4mhttps://wandb.ai/inflaton-ai/huggingface/runs/qhb0out3\u001b[0m\n","{'loss': 0.4683, 'grad_norm': 3.4465599060058594, 'learning_rate': 4.4444444444444447e-05, 'epoch': 0.18}\n"," 8% 174/2248 [17:06<3:24:19, 5.91s/it]"]}],"source":["%%time\n","\n","!sh ./scripts/tune-lf.sh config/internlm2_5_7b_lora_sft_bf16_p2.yaml"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"L370pvGTZBrN"},"outputs":[],"source":["def evaluate_model_all_epochs(model_name, adapter_path_base, num_train_epochs, start_epoch=0, load_in_4bit=True, num_of_entries=-1):\n"," os.environ[\"MODEL_NAME\"] = model_name\n"," os.environ[\"LOAD_IN_4BIT\"] = \"true\" if load_in_4bit else \"false\"\n"," for i in range(start_epoch, num_train_epochs + 1):\n"," print(f\"Epoch {i}\")\n"," if i == 0:\n"," os.unsetenv(\"ADAPTER_NAME_OR_PATH\")\n"," else:\n"," adapter_path = f\"{adapter_path_base}/checkpoint-{562 * i}\"\n"," os.environ[\"ADAPTER_NAME_OR_PATH\"] = adapter_path\n","\n"," !python llm_toolkit/eval_logical_reasoning.py {num_of_entries}"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"WUFjhxmiZBrN"},"outputs":[],"source":["%%time\n","\n","evaluate_model_all_epochs(\"internlm/internlm2_5-7b-chat-1m\", \"llama-factory/saves/internlm2_5_7b/lora/sft_bf16_p2\", 4, start_epoch=0, load_in_4bit=False, num_of_entries=-1)"]}],"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}