diff --git "a/competition/09a_InterLM_finetuning_colab_p2.ipynb" "b/competition/09a_InterLM_finetuning_colab_p2.ipynb"
new file mode 100644--- /dev/null
+++ "b/competition/09a_InterLM_finetuning_colab_p2.ipynb"
@@ -0,0 +1 @@
+{"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"," instruction | \n"," input | \n"," output | \n","
\n"," \n"," \n"," \n"," 0 | \n"," 你是一个情景猜谜游戏的主持人。游戏规则如下:\\n\\n1. 参与者会得到一个谜面,谜面会描述一... | \n"," | \n"," 不是 | \n","
\n"," \n"," 1 | \n"," 你是一个情景猜谜游戏的主持人。游戏规则如下:\\n\\n1. 参与者会得到一个谜面,谜面会描述一... | \n"," | \n"," 不是 | \n","
\n"," \n"," 2 | \n"," 你是一个情景猜谜游戏的主持人。游戏规则如下:\\n\\n1. 参与者会得到一个谜面,谜面会描述一... | \n"," | \n"," 不重要 | \n","
\n"," \n"," 3 | \n"," 你是一个情景猜谜游戏的主持人。游戏规则如下:\\n\\n1. 参与者会得到一个谜面,谜面会描述一... | \n"," | \n"," 不是 | \n","
\n"," \n"," 4 | \n"," 你是一个情景猜谜游戏的主持人。游戏规则如下:\\n\\n1. 参与者会得到一个谜面,谜面会描述一... | \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":["