inflaton commited on
Commit
16ec7f8
·
1 Parent(s): 0bdc732

merged epoch 1 of internlm2_5-7b-chat-1m_sft_bf16_p2_full

Browse files
competition/12a_InterLM_Merged_Model_NV4080.ipynb CHANGED
@@ -1 +1 @@
1
- {"cells":[{"cell_type":"code","execution_count":1,"metadata":{"executionInfo":{"elapsed":476,"status":"ok","timestamp":1720679526275,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"},"user_tz":-480},"id":"uWKRSV6eZsCn"},"outputs":[],"source":["%load_ext autoreload\n","%autoreload 2"]},{"cell_type":"code","execution_count":2,"metadata":{"application/vnd.databricks.v1+cell":{"cellMetadata":{"byteLimit":2048000,"rowLimit":10000},"inputWidgets":{},"nuid":"eb33b19f-1206-41ee-84e2-e6258a12eef7","showTitle":false,"title":""},"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":2534,"status":"ok","timestamp":1720679529344,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"},"user_tz":-480},"id":"xwFh14uiZBrI","outputId":"d767799c-34c2-46a5-f052-378146a55321"},"outputs":[],"source":["from pathlib import Path\n","\n","try:\n"," from google.colab import drive\n","\n"," drive.mount(\"/content/drive\")\n"," workding_dir = \"/content/drive/MyDrive/logical-reasoning/\"\n","except ModuleNotFoundError:\n"," workding_dir = str(Path.cwd().parent)"]},{"cell_type":"code","execution_count":3,"metadata":{"application/vnd.databricks.v1+cell":{"cellMetadata":{"byteLimit":2048000,"rowLimit":10000},"inputWidgets":{},"nuid":"6d394937-6c99-4a7c-9d32-7600a280032f","showTitle":false,"title":""},"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":5,"status":"ok","timestamp":1720679529345,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"},"user_tz":-480},"id":"G5pNu3zgZBrL","outputId":"160a554f-fb08-4aa0-bc00-0422fb7c1fac"},"outputs":[{"name":"stdout","output_type":"stream","text":["workding dir: /home/inflaton/code/projects/courses/logical-reasoning\n"]}],"source":["import os\n","import sys\n","from pathlib import Path\n","\n","os.chdir(workding_dir)\n","sys.path.append(workding_dir)\n","print(\"workding dir:\", workding_dir)"]},{"cell_type":"code","execution_count":4,"metadata":{"application/vnd.databricks.v1+cell":{"cellMetadata":{"byteLimit":2048000,"rowLimit":10000},"inputWidgets":{},"nuid":"9f67ec60-2f24-411c-84eb-0dd664b44775","showTitle":false,"title":""},"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":3,"status":"ok","timestamp":1720679529345,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"},"user_tz":-480},"id":"hPCC-6m7ZBrM","outputId":"c7aa2c96-5e99-440a-c148-201d79465ff9"},"outputs":[{"name":"stdout","output_type":"stream","text":["loading env vars from: /home/inflaton/code/projects/courses/logical-reasoning/.env\n"]},{"data":{"text/plain":["True"]},"execution_count":4,"metadata":{},"output_type":"execute_result"}],"source":["from dotenv import find_dotenv, load_dotenv\n","\n","found_dotenv = find_dotenv(\".env\")\n","\n","if len(found_dotenv) == 0:\n"," found_dotenv = find_dotenv(\".env.example\")\n","print(f\"loading env vars from: {found_dotenv}\")\n","load_dotenv(found_dotenv, override=True)"]},{"cell_type":"code","execution_count":5,"metadata":{"application/vnd.databricks.v1+cell":{"cellMetadata":{"byteLimit":2048000,"rowLimit":10000},"inputWidgets":{},"nuid":"f1597656-8042-4878-9d3b-9ebfb8dd86dc","showTitle":false,"title":""},"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":3,"status":"ok","timestamp":1720679529345,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"},"user_tz":-480},"id":"1M3IraVtZBrM","outputId":"29ab35f6-2970-4ade-d85d-3174acf8cda0"},"outputs":[{"name":"stdout","output_type":"stream","text":["llama-factory/merged_models/internlm2_5-7b-chat-1m_sft_bf16_p2_full None False datasets/mgtv results/mgtv-results_merged_model.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","\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","\u001b[33mWARNING: Package(s) not found: flash-attn\u001b[0m\u001b[33m\n","\u001b[0mCPU times: user 0 ns, sys: 15.8 ms, total: 15.8 ms\n","Wall time: 568 ms\n"]}],"source":["%%time\n","!python --version\n","!pip show flash-attn"]},{"cell_type":"code","execution_count":7,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":1685,"status":"ok","timestamp":1720679531591,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"},"user_tz":-480},"id":"ZuS_FsLyZBrN","outputId":"2cba0105-c505-4395-afbd-2f2fee6581d0"},"outputs":[{"name":"stdout","output_type":"stream","text":["loading /home/inflaton/code/projects/courses/logical-reasoning/llm_toolkit/logical_reasoning_utils.py\n","GPU is available\n"]}],"source":["from llm_toolkit.llm_utils import *\n","from llm_toolkit.logical_reasoning_utils import *\n","\n","device = check_gpu()"]},{"cell_type":"code","execution_count":8,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["loading model: llama-factory/merged_models/internlm2_5-7b-chat-1m_sft_bf16_p2_full\n"]},{"name":"stderr","output_type":"stream","text":["Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.\n"]},{"data":{"application/vnd.jupyter.widget-view+json":{"model_id":"faba8876dfdd40df88069ce03a87e508","version_major":2,"version_minor":0},"text/plain":["Loading checkpoint shards: 0%| | 0/8 [00:00<?, ?it/s]"]},"metadata":{},"output_type":"display_data"},{"name":"stderr","output_type":"stream","text":["WARNING:root:Some parameters are on the meta device device because they were offloaded to the cpu.\n"]},{"name":"stdout","output_type":"stream","text":["CPU times: user 8.36 s, sys: 447 ms, total: 8.8 s\n","Wall time: 11.6 s\n"]}],"source":["%%time\n","\n","model, tokenizer = load_model(model_name)"]},{"cell_type":"code","execution_count":9,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["loading train/test data files\n"]},{"data":{"application/vnd.jupyter.widget-view+json":{"model_id":"d9dbf05937d7464cb0e2a14e184704ff","version_major":2,"version_minor":0},"text/plain":["Map: 0%| | 0/25000 [00:00<?, ? examples/s]"]},"metadata":{},"output_type":"display_data"},{"data":{"application/vnd.jupyter.widget-view+json":{"model_id":"503bb5909f3940768613d16795bca179","version_major":2,"version_minor":0},"text/plain":["Map: 0%| | 0/3000 [00:00<?, ? examples/s]"]},"metadata":{},"output_type":"display_data"},{"name":"stdout","output_type":"stream","text":["DatasetDict({\n"," train: Dataset({\n"," features: ['text', 'label', 'answer', 'title', 'puzzle', 'truth', 'train_text', 'prompt'],\n"," num_rows: 25000\n"," })\n"," test: Dataset({\n"," features: ['text', 'label', 'answer', 'title', 'puzzle', 'truth', 'train_text', 'prompt'],\n"," num_rows: 3000\n"," })\n","})\n"]}],"source":["datasets = load_logical_reasoning_dataset(\n"," data_path,\n"," tokenizer=tokenizer,\n"," chinese_prompt=not use_english_datasets,\n"," using_p1=False,\n",")"]},{"cell_type":"code","execution_count":10,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["<s><|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","<s><s><|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","是</s>\n","CPU times: user 3.4 s, sys: 437 ms, total: 3.83 s\n","Wall time: 4.56 s\n"]}],"source":["%%time\n","\n","prompt1 = datasets[\"test\"][\"prompt\"][1000]\n","print(prompt1)\n","print(\"--\" * 20)\n","test_model(model, tokenizer, prompt1, device=device)"]},{"cell_type":"code","execution_count":11,"metadata":{},"outputs":[{"name":"stderr","output_type":"stream","text":[" 12%|█▎ | 1/8 [00:01<00:13, 1.91s/it]"]},{"name":"stdout","output_type":"stream","text":["--------\n","step 1: 不是</s>\n","--------\n","step 2: 不是\n","--------\n","step 3: 不是\n","--------\n","step 4: 不是\n","--------\n","step 5: 不是\n"]},{"name":"stderr","output_type":"stream","text":["100%|██████████| 8/8 [00:12<00:00, 1.60s/it]"]},{"name":"stdout","output_type":"stream","text":["CPU times: user 12.2 s, sys: 271 ms, total: 12.4 s\n","Wall time: 12.9 s\n"]},{"name":"stderr","output_type":"stream","text":["\n"]},{"data":{"text/plain":["['不是', '是', '是', '是', '不是', '是', '是', '不是']"]},"execution_count":11,"metadata":{},"output_type":"execute_result"}],"source":["%%time\n","\n","eval_model(model, tokenizer, datasets[\"test\"][:10], device=device)"]},{"cell_type":"code","execution_count":17,"metadata":{"id":"L370pvGTZBrN"},"outputs":[],"source":["def evaluate_model(model, tokenizer, model_name, dataset):\n"," print(f\"Evaluating model: {model_name} on {device}\")\n"," predictions = eval_model(model, tokenizer, dataset, device=device)\n","\n"," model_name += \"_NV4080\"\n","\n"," save_results(\n"," model_name,\n"," results_path,\n"," dataset,\n"," predictions,\n"," debug=True,\n"," )\n","\n"," metrics = calc_metrics(dataset[\"label\"], predictions, debug=True)\n"," print(metrics)"]},{"cell_type":"code","execution_count":18,"metadata":{"id":"WUFjhxmiZBrN"},"outputs":[{"name":"stdout","output_type":"stream","text":["Evaluating model: llama-factory/merged_models/internlm2_5-7b-chat-1m_sft_bf16_p2_full on cuda\n"]},{"name":"stderr","output_type":"stream","text":[" 0%| | 1/3000 [00:02<1:48:12, 2.16s/it]"]},{"name":"stdout","output_type":"stream","text":["--------\n","step 1: 不是</s>\n","--------\n","step 2: 不是\n","--------\n","step 3: 不是\n","--------\n","step 4: 不是\n","--------\n","step 5: 不是\n"]},{"name":"stderr","output_type":"stream","text":["100%|██████████| 3000/3000 [1:51:51<00:00, 2.24s/it] \n"]},{"name":"stdout","output_type":"stream","text":[" text label title puzzle \\\n","0 甄加索是自杀吗 不是 海岸之谜 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任... \n","\n"," truth \\\n","0 甄加索是一位热爱自然的��家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在... \n","\n"," llama-factory/merged_models/internlm2_5-7b-chat-1m_sft_bf16_p2_full_NV4080 \n","0 不是 \n","{'accuracy': 0.7086666666666667, 'incorrect_ids': [6, 9, 24, 25, 29, 31, 33, 34, 35, 36, 38, 55, 57, 58, 59, 61, 65, 66, 67, 70, 77, 78, 82, 83, 84, 88, 91, 93, 96, 97, 99, 104, 105, 106, 108, 109, 112, 114, 117, 119, 121, 124, 128, 129, 131, 135, 136, 137, 138, 139, 143, 149, 150, 153, 155, 160, 164, 171, 172, 173, 179, 190, 191, 192, 199, 200, 202, 207, 218, 222, 224, 225, 226, 228, 230, 234, 236, 245, 248, 250, 253, 256, 257, 259, 260, 265, 269, 271, 275, 276, 284, 286, 293, 299, 301, 303, 304, 309, 311, 314, 316, 317, 318, 321, 323, 326, 330, 334, 335, 337, 338, 339, 341, 342, 347, 350, 351, 353, 354, 355, 356, 357, 360, 368, 371, 373, 374, 377, 383, 386, 389, 395, 397, 404, 409, 410, 414, 416, 421, 423, 425, 428, 429, 430, 438, 440, 445, 447, 452, 454, 456, 457, 465, 471, 472, 473, 474, 476, 478, 479, 480, 482, 488, 492, 493, 494, 495, 497, 500, 501, 502, 504, 506, 507, 508, 510, 511, 512, 514, 517, 518, 520, 530, 534, 536, 540, 553, 560, 561, 566, 570, 571, 579, 581, 589, 591, 592, 593, 597, 599, 601, 612, 613, 614, 621, 625, 626, 627, 628, 632, 636, 644, 647, 657, 663, 665, 666, 671, 678, 680, 682, 683, 686, 695, 701, 702, 708, 709, 711, 718, 720, 721, 722, 725, 726, 727, 729, 730, 734, 739, 740, 754, 758, 760, 766, 769, 770, 771, 772, 774, 778, 779, 785, 788, 790, 791, 794, 795, 798, 801, 803, 805, 809, 813, 817, 819, 820, 821, 823, 824, 828, 830, 833, 834, 837, 840, 843, 844, 847, 851, 852, 856, 861, 862, 866, 869, 870, 875, 876, 884, 888, 889, 890, 891, 899, 901, 904, 913, 920, 927, 932, 935, 937, 942, 943, 945, 951, 952, 954, 958, 962, 966, 969, 970, 971, 980, 982, 989, 991, 994, 997, 998, 1001, 1003, 1005, 1006, 1007, 1011, 1012, 1014, 1015, 1019, 1022, 1033, 1036, 1045, 1046, 1051, 1053, 1054, 1061, 1064, 1066, 1069, 1071, 1073, 1075, 1076, 1080, 1083, 1085, 1087, 1089, 1096, 1107, 1111, 1116, 1120, 1125, 1126, 1129, 1135, 1138, 1144, 1154, 1158, 1163, 1164, 1166, 1167, 1170, 1174, 1177, 1178, 1179, 1180, 1181, 1183, 1185, 1188, 1202, 1203, 1207, 1212, 1219, 1228, 1232, 1237, 1239, 1240, 1241, 1242, 1243, 1249, 1251, 1252, 1254, 1259, 1266, 1267, 1282, 1289, 1293, 1300, 1301, 1305, 1308, 1311, 1313, 1314, 1315, 1317, 1324, 1331, 1332, 1341, 1342, 1349, 1353, 1357, 1363, 1364, 1367, 1369, 1373, 1380, 1385, 1387, 1388, 1389, 1390, 1391, 1392, 1393, 1395, 1400, 1402, 1406, 1407, 1409, 1412, 1413, 1420, 1424, 1426, 1427, 1441, 1444, 1445, 1446, 1448, 1451, 1453, 1454, 1459, 1460, 1462, 1463, 1469, 1470, 1473, 1476, 1478, 1481, 1491, 1494, 1500, 1501, 1512, 1515, 1517, 1518, 1525, 1526, 1528, 1533, 1544, 1546, 1547, 1554, 1559, 1560, 1562, 1567, 1572, 1573, 1581, 1584, 1585, 1588, 1590, 1593, 1594, 1596, 1603, 1604, 1605, 1611, 1613, 1622, 1627, 1631, 1633, 1637, 1643, 1645, 1647, 1650, 1654, 1655, 1658, 1659, 1660, 1662, 1667, 1668, 1672, 1673, 1674, 1676, 1679, 1683, 1686, 1689, 1691, 1695, 1700, 1712, 1716, 1718, 1726, 1727, 1730, 1735, 1736, 1738, 1746, 1751, 1752, 1754, 1756, 1766, 1770, 1773, 1780, 1786, 1790, 1791, 1796, 1799, 1804, 1809, 1812, 1816, 1818, 1825, 1827, 1833, 1834, 1835, 1847, 1848, 1854, 1858, 1860, 1864, 1867, 1869, 1870, 1872, 1879, 1881, 1882, 1888, 1895, 1897, 1910, 1913, 1914, 1915, 1935, 1936, 1940, 1945, 1953, 1958, 1961, 1962, 1963, 1964, 1965, 1973, 1978, 1981, 1983, 1984, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1998, 2001, 2005, 2007, 2010, 2014, 2015, 2017, 2021, 2035, 2037, 2038, 2040, 2042, 2046, 2049, 2062, 2063, 2064, 2067, 2070, 2072, 2076, 2077, 2094, 2099, 2102, 2106, 2109, 2112, 2118, 2119, 2120, 2121, 2122, 2123, 2126, 2130, 2133, 2135, 2139, 2140, 2141, 2145, 2147, 2161, 2162, 2164, 2167, 2169, 2172, 2177, 2180, 2184, 2185, 2186, 2189, 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2208, 2212, 2215, 2217, 2219, 2226, 2230, 2237, 2240, 2248, 2249, 2250, 2254, 2257, 2261, 2262, 2265, 2266, 2267, 2274, 2275, 2285, 2287, 2297, 2301, 2304, 2309, 2311, 2313, 2320, 2322, 2324, 2330, 2333, 2335, 2339, 2344, 2348, 2354, 2360, 2364, 2365, 2366, 2376, 2378, 2386, 2389, 2395, 2396, 2400, 2404, 2406, 2408, 2409, 2410, 2412, 2416, 2423, 2425, 2429, 2437, 2440, 2441, 2442, 2444, 2445, 2448, 2463, 2469, 2474, 2482, 2484, 2486, 2488, 2496, 2501, 2512, 2517, 2522, 2526, 2529, 2530, 2532, 2535, 2538, 2539, 2540, 2546, 2547, 2548, 2549, 2553, 2554, 2555, 2556, 2558, 2559, 2560, 2562, 2572, 2574, 2575, 2581, 2589, 2590, 2597, 2602, 2605, 2606, 2607, 2610, 2613, 2616, 2624, 2626, 2629, 2632, 2640, 2647, 2655, 2660, 2663, 2664, 2667, 2676, 2681, 2691, 2694, 2704, 2707, 2714, 2715, 2716, 2727, 2728, 2731, 2736, 2742, 2744, 2745, 2749, 2754, 2756, 2757, 2760, 2761, 2762, 2764, 2766, 2767, 2777, 2787, 2788, 2797, 2798, 2801, 2803, 2806, 2807, 2811, 2812, 2815, 2816, 2820, 2821, 2823, 2837, 2843, 2850, 2854, 2856, 2857, 2860, 2862, 2877, 2878, 2882, 2884, 2888, 2899, 2902, 2905, 2912, 2913, 2915, 2916, 2919, 2921, 2927, 2933, 2938, 2944, 2949, 2950, 2953, 2960, 2962, 2963, 2975, 2976, 2978, 2979, 2980, 2983, 2991, 2995, 2998]}\n","CPU times: user 1h 44min 19s, sys: 4min 27s, total: 1h 48min 46s\n","Wall time: 1h 51min 52s\n"]}],"source":["%%time\n","\n","evaluate_model(model, tokenizer, model_name, datasets[\"test\"])"]}],"metadata":{"accelerator":"GPU","application/vnd.databricks.v1+notebook":{"dashboards":[],"environmentMetadata":null,"language":"python","notebookMetadata":{"mostRecentlyExecutedCommandWithImplicitDF":{"commandId":-1,"dataframes":["_sqldf"]},"pythonIndentUnit":4},"notebookName":"10_eval-lf-medium-py3.11","widgets":{}},"colab":{"gpuType":"L4","provenance":[]},"kernelspec":{"display_name":"Python 3","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.11.9"}},"nbformat":4,"nbformat_minor":0}
 
1
+ {"cells":[{"cell_type":"code","execution_count":1,"metadata":{"executionInfo":{"elapsed":476,"status":"ok","timestamp":1720679526275,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"},"user_tz":-480},"id":"uWKRSV6eZsCn"},"outputs":[],"source":["%load_ext autoreload\n","%autoreload 2"]},{"cell_type":"code","execution_count":2,"metadata":{"application/vnd.databricks.v1+cell":{"cellMetadata":{"byteLimit":2048000,"rowLimit":10000},"inputWidgets":{},"nuid":"eb33b19f-1206-41ee-84e2-e6258a12eef7","showTitle":false,"title":""},"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":2534,"status":"ok","timestamp":1720679529344,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"},"user_tz":-480},"id":"xwFh14uiZBrI","outputId":"d767799c-34c2-46a5-f052-378146a55321"},"outputs":[],"source":["from pathlib import Path\n","\n","try:\n"," from google.colab import drive\n","\n"," drive.mount(\"/content/drive\")\n"," workding_dir = \"/content/drive/MyDrive/logical-reasoning/\"\n","except ModuleNotFoundError:\n"," workding_dir = str(Path.cwd().parent)"]},{"cell_type":"code","execution_count":3,"metadata":{"application/vnd.databricks.v1+cell":{"cellMetadata":{"byteLimit":2048000,"rowLimit":10000},"inputWidgets":{},"nuid":"6d394937-6c99-4a7c-9d32-7600a280032f","showTitle":false,"title":""},"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":5,"status":"ok","timestamp":1720679529345,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"},"user_tz":-480},"id":"G5pNu3zgZBrL","outputId":"160a554f-fb08-4aa0-bc00-0422fb7c1fac"},"outputs":[{"name":"stdout","output_type":"stream","text":["workding dir: /home/inflaton/code/projects/courses/logical-reasoning\n"]}],"source":["import os\n","import sys\n","from pathlib import Path\n","\n","os.chdir(workding_dir)\n","sys.path.append(workding_dir)\n","print(\"workding dir:\", workding_dir)"]},{"cell_type":"code","execution_count":4,"metadata":{"application/vnd.databricks.v1+cell":{"cellMetadata":{"byteLimit":2048000,"rowLimit":10000},"inputWidgets":{},"nuid":"9f67ec60-2f24-411c-84eb-0dd664b44775","showTitle":false,"title":""},"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":3,"status":"ok","timestamp":1720679529345,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"},"user_tz":-480},"id":"hPCC-6m7ZBrM","outputId":"c7aa2c96-5e99-440a-c148-201d79465ff9"},"outputs":[{"name":"stdout","output_type":"stream","text":["loading env vars from: /home/inflaton/code/projects/courses/logical-reasoning/.env\n"]},{"data":{"text/plain":["True"]},"execution_count":4,"metadata":{},"output_type":"execute_result"}],"source":["from dotenv import find_dotenv, load_dotenv\n","\n","found_dotenv = find_dotenv(\".env\")\n","\n","if len(found_dotenv) == 0:\n"," found_dotenv = find_dotenv(\".env.example\")\n","print(f\"loading env vars from: {found_dotenv}\")\n","load_dotenv(found_dotenv, override=True)"]},{"cell_type":"code","execution_count":5,"metadata":{"application/vnd.databricks.v1+cell":{"cellMetadata":{"byteLimit":2048000,"rowLimit":10000},"inputWidgets":{},"nuid":"f1597656-8042-4878-9d3b-9ebfb8dd86dc","showTitle":false,"title":""},"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":3,"status":"ok","timestamp":1720679529345,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"},"user_tz":-480},"id":"1M3IraVtZBrM","outputId":"29ab35f6-2970-4ade-d85d-3174acf8cda0"},"outputs":[{"name":"stdout","output_type":"stream","text":["llama-factory/merged_models/internlm2_5-7b-chat-1m_sft_bf16_p2_full None False datasets/mgtv results/mgtv-results_merged_model.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","\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","\u001b[33mWARNING: Package(s) not found: flash-attn\u001b[0m\u001b[33m\n","\u001b[0mCPU times: user 1.76 ms, sys: 10.8 ms, total: 12.5 ms\n","Wall time: 560 ms\n"]}],"source":["%%time\n","!python --version\n","!pip show flash-attn"]},{"cell_type":"code","execution_count":7,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":1685,"status":"ok","timestamp":1720679531591,"user":{"displayName":"HUANG DONGHAO _","userId":"00977795705617022768"},"user_tz":-480},"id":"ZuS_FsLyZBrN","outputId":"2cba0105-c505-4395-afbd-2f2fee6581d0"},"outputs":[{"name":"stdout","output_type":"stream","text":["loading /home/inflaton/code/projects/courses/logical-reasoning/llm_toolkit/logical_reasoning_utils.py\n","GPU is available\n"]}],"source":["from llm_toolkit.llm_utils import *\n","from llm_toolkit.logical_reasoning_utils import *\n","\n","device = check_gpu()"]},{"cell_type":"code","execution_count":8,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["loading model: llama-factory/merged_models/internlm2_5-7b-chat-1m_sft_bf16_p2_full\n"]},{"name":"stderr","output_type":"stream","text":["Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.\n"]},{"data":{"application/vnd.jupyter.widget-view+json":{"model_id":"91fd1c2ac40345238c96a1f5bf58ca31","version_major":2,"version_minor":0},"text/plain":["Loading checkpoint shards: 0%| | 0/8 [00:00<?, ?it/s]"]},"metadata":{},"output_type":"display_data"},{"name":"stderr","output_type":"stream","text":["WARNING:root:Some parameters are on the meta device device because they were offloaded to the cpu.\n"]},{"name":"stdout","output_type":"stream","text":["CPU times: user 4.81 s, sys: 585 ms, total: 5.4 s\n","Wall time: 8.52 s\n"]}],"source":["%%time\n","\n","model, tokenizer = load_model(model_name)"]},{"cell_type":"code","execution_count":9,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["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"]}],"source":["datasets = load_logical_reasoning_dataset(\n"," data_path,\n"," tokenizer=tokenizer,\n"," chinese_prompt=not use_english_datasets,\n"," using_p1=False,\n",")"]},{"cell_type":"code","execution_count":10,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["<s><|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","<s><s><|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","是</s>\n","CPU times: user 4.4 s, sys: 282 ms, total: 4.69 s\n","Wall time: 5.39 s\n"]}],"source":["%%time\n","\n","prompt1 = datasets[\"test\"][\"prompt\"][1000]\n","print(prompt1)\n","print(\"--\" * 20)\n","test_model(model, tokenizer, prompt1, device=device)"]},{"cell_type":"code","execution_count":11,"metadata":{},"outputs":[{"name":"stderr","output_type":"stream","text":[" 12%|█▎ | 1/8 [00:01<00:11, 1.58s/it]"]},{"name":"stdout","output_type":"stream","text":["--------\n","step 1: 不是</s>\n","--------\n","step 2: 不是\n","--------\n","step 3: 不是\n","--------\n","step 4: 不是\n","--------\n","step 5: 不是\n"]},{"name":"stderr","output_type":"stream","text":["100%|██████████| 8/8 [00:12<00:00, 1.59s/it]"]},{"name":"stdout","output_type":"stream","text":["CPU times: user 12 s, sys: 272 ms, total: 12.2 s\n","Wall time: 13 s\n"]},{"name":"stderr","output_type":"stream","text":["\n"]},{"data":{"text/plain":["['不是', '是', '是', '是', '不是', '是', '不重要', '不是']"]},"execution_count":11,"metadata":{},"output_type":"execute_result"}],"source":["%%time\n","\n","eval_model(model, tokenizer, datasets[\"test\"][:10], device=device)"]},{"cell_type":"code","execution_count":12,"metadata":{"id":"L370pvGTZBrN"},"outputs":[],"source":["def evaluate_model(model, tokenizer, model_name, dataset):\n"," print(f\"Evaluating model: {model_name} on {device}\")\n"," predictions = eval_model(model, tokenizer, dataset, device=device)\n","\n"," model_name += \"_NV4080\"\n","\n"," save_results(\n"," model_name,\n"," results_path,\n"," dataset,\n"," predictions,\n"," debug=True,\n"," )\n","\n"," metrics = calc_metrics(dataset[\"label\"], predictions, debug=True)\n"," print(metrics)"]},{"cell_type":"code","execution_count":13,"metadata":{"id":"WUFjhxmiZBrN"},"outputs":[{"name":"stdout","output_type":"stream","text":["Evaluating model: llama-factory/merged_models/internlm2_5-7b-chat-1m_sft_bf16_p2_full on cuda\n"]},{"name":"stderr","output_type":"stream","text":[" 0%| | 1/3000 [00:01<1:17:37, 1.55s/it]"]},{"name":"stdout","output_type":"stream","text":["--------\n","step 1: 不是</s>\n","--------\n","step 2: 不是\n","--------\n","step 3: 不是\n","--------\n","step 4: 不是\n","--------\n","step 5: 不是\n"]},{"name":"stderr","output_type":"stream","text":["100%|██████████| 3000/3000 [1:46:09<00:00, 2.12s/it]"]},{"name":"stdout","output_type":"stream","text":[" text label title puzzle \\\n","0 甄加索是自杀吗 不是 海岸之谜 在远离城市喧嚣的海边小屋,一天清晨,邻居发现甄加索僵卧在沙滩上,已无生命迹象。现场没有发现任... \n","\n"," truth \\\n","0 甄加索是一位热爱自然的画家,他每年都会来到这个海边小屋寻找灵感。在他生命的最后几天,他一直在... \n","\n"," llama-factory/merged_models/internlm2_5-7b-chat-1m_sft_bf16_p2_full_epoch_6_NV4080 \\\n","0 不是 \n","\n"," llama-factory/merged_models/internlm2_5-7b-chat-1m_sft_bf16_p2_full_epoch_6_M3 \\\n","0 不是 \n","\n"," llama-factory/merged_models/internlm2_5-7b-chat-1m_sft_bf16_p2_full_NV4080 \n","0 不是 \n","{'accuracy': 0.785, 'incorrect_ids': [9, 24, 29, 34, 36, 55, 58, 59, 61, 65, 66, 67, 78, 81, 82, 83, 84, 88, 91, 93, 99, 103, 104, 106, 110, 112, 117, 121, 128, 129, 135, 138, 139, 143, 149, 150, 153, 155, 161, 164, 170, 173, 179, 190, 199, 200, 202, 218, 222, 224, 227, 228, 236, 245, 250, 252, 259, 260, 269, 271, 275, 276, 284, 286, 299, 304, 314, 317, 318, 323, 330, 334, 335, 337, 338, 346, 350, 353, 355, 356, 360, 361, 368, 370, 371, 373, 377, 383, 386, 389, 395, 397, 410, 414, 416, 428, 429, 430, 432, 438, 445, 447, 450, 452, 454, 456, 457, 458, 471, 472, 476, 479, 480, 488, 490, 492, 493, 494, 495, 497, 501, 502, 506, 507, 508, 510, 511, 514, 517, 518, 519, 520, 530, 536, 540, 560, 566, 570, 571, 579, 581, 589, 591, 593, 596, 597, 599, 601, 612, 613, 614, 621, 622, 625, 628, 632, 636, 643, 644, 647, 666, 671, 682, 690, 695, 702, 708, 720, 721, 727, 729, 730, 734, 740, 754, 758, 766, 770, 772, 774, 778, 788, 791, 794, 795, 798, 799, 801, 803, 805, 809, 817, 819, 820, 821, 823, 824, 826, 828, 837, 840, 844, 847, 856, 859, 861, 862, 866, 869, 870, 875, 884, 889, 890, 899, 904, 913, 927, 935, 937, 942, 945, 952, 962, 964, 966, 969, 970, 980, 989, 991, 994, 998, 1001, 1003, 1005, 1006, 1007, 1011, 1012, 1014, 1015, 1019, 1022, 1038, 1040, 1043, 1051, 1053, 1069, 1071, 1075, 1076, 1077, 1080, 1083, 1087, 1089, 1096, 1107, 1108, 1120, 1125, 1126, 1129, 1138, 1160, 1161, 1166, 1167, 1172, 1173, 1174, 1178, 1180, 1181, 1183, 1185, 1198, 1203, 1212, 1228, 1232, 1239, 1240, 1241, 1251, 1252, 1254, 1258, 1259, 1266, 1282, 1289, 1305, 1308, 1311, 1313, 1315, 1317, 1324, 1331, 1337, 1339, 1342, 1346, 1349, 1353, 1357, 1363, 1364, 1367, 1385, 1387, 1388, 1389, 1391, 1392, 1393, 1395, 1400, 1406, 1409, 1417, 1420, 1422, 1426, 1438, 1440, 1444, 1451, 1453, 1454, 1455, 1459, 1462, 1469, 1476, 1478, 1486, 1490, 1493, 1494, 1496, 1501, 1504, 1512, 1517, 1518, 1525, 1526, 1533, 1544, 1547, 1554, 1559, 1560, 1562, 1580, 1585, 1590, 1593, 1594, 1603, 1604, 1605, 1613, 1622, 1627, 1633, 1637, 1641, 1645, 1647, 1648, 1650, 1654, 1655, 1658, 1659, 1665, 1668, 1669, 1672, 1673, 1674, 1676, 1679, 1683, 1686, 1691, 1695, 1712, 1716, 1718, 1721, 1726, 1727, 1734, 1736, 1738, 1751, 1755, 1756, 1780, 1786, 1791, 1796, 1798, 1812, 1816, 1827, 1834, 1835, 1841, 1858, 1860, 1867, 1869, 1877, 1879, 1888, 1897, 1914, 1945, 1953, 1958, 1963, 1964, 1971, 1973, 1978, 1981, 1984, 1989, 1990, 1991, 1992, 1994, 1995, 2001, 2017, 2021, 2028, 2035, 2036, 2049, 2054, 2062, 2064, 2067, 2070, 2072, 2076, 2077, 2092, 2100, 2106, 2109, 2110, 2112, 2118, 2119, 2120, 2121, 2126, 2133, 2139, 2141, 2147, 2159, 2161, 2162, 2164, 2167, 2169, 2172, 2174, 2177, 2181, 2185, 2186, 2188, 2192, 2193, 2194, 2195, 2197, 2208, 2212, 2222, 2223, 2226, 2230, 2233, 2237, 2240, 2243, 2247, 2249, 2250, 2257, 2262, 2265, 2274, 2278, 2280, 2281, 2285, 2297, 2304, 2311, 2312, 2317, 2320, 2322, 2324, 2330, 2333, 2335, 2339, 2344, 2348, 2360, 2364, 2366, 2378, 2389, 2395, 2396, 2400, 2404, 2409, 2410, 2420, 2423, 2425, 2429, 2437, 2440, 2442, 2454, 2463, 2469, 2484, 2488, 2491, 2511, 2512, 2515, 2517, 2522, 2529, 2530, 2532, 2535, 2538, 2539, 2546, 2547, 2548, 2549, 2555, 2556, 2559, 2560, 2562, 2574, 2575, 2589, 2590, 2602, 2616, 2624, 2626, 2629, 2632, 2644, 2660, 2663, 2667, 2676, 2678, 2691, 2707, 2714, 2716, 2731, 2736, 2742, 2744, 2745, 2746, 2749, 2754, 2757, 2762, 2764, 2766, 2777, 2788, 2791, 2797, 2798, 2801, 2803, 2806, 2807, 2812, 2815, 2816, 2820, 2823, 2837, 2843, 2845, 2854, 2857, 2860, 2861, 2877, 2880, 2882, 2884, 2888, 2899, 2902, 2905, 2912, 2913, 2915, 2916, 2921, 2927, 2933, 2938, 2939, 2944, 2949, 2953, 2977, 2979, 2985, 2995, 2998]}\n","CPU times: user 1h 38min 39s, sys: 4min 13s, total: 1h 42min 53s\n","Wall time: 1h 46min 10s\n"]},{"name":"stderr","output_type":"stream","text":["\n"]}],"source":["%%time\n","\n","evaluate_model(model, tokenizer, model_name, datasets[\"test\"])"]}],"metadata":{"accelerator":"GPU","application/vnd.databricks.v1+notebook":{"dashboards":[],"environmentMetadata":null,"language":"python","notebookMetadata":{"mostRecentlyExecutedCommandWithImplicitDF":{"commandId":-1,"dataframes":["_sqldf"]},"pythonIndentUnit":4},"notebookName":"10_eval-lf-medium-py3.11","widgets":{}},"colab":{"gpuType":"L4","provenance":[]},"kernelspec":{"display_name":"Python 3","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.11.9"}},"nbformat":4,"nbformat_minor":0}
llama-factory/merged_models/internlm2_5-7b-chat-1m_sft_bf16_p2_full/model-00001-of-00008.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:1da5fe169a1663fe655c3c4c866f09680060eb684b863ba20149ffde280a21c6
3
  size 1949337704
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:974b14608ff94120f8a7b69a8319b69c9e102c1dd04898ce680e2f48ee344ef1
3
  size 1949337704
llama-factory/merged_models/internlm2_5-7b-chat-1m_sft_bf16_p2_full/model-00002-of-00008.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:c2fb3c6d6ec6ea01df54082a5ca9fd9615f18ab95507cc2d119516c21e43dbe9
3
  size 1946242696
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a8ebc89c15e39300cdb8876edace963f8a1b03c9092bae105970c1b1b7c7c92a
3
  size 1946242696
llama-factory/merged_models/internlm2_5-7b-chat-1m_sft_bf16_p2_full/model-00003-of-00008.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5a8e8a1540c76fd9cf4f1643ad44a6969bc938daa1d355cb04d27b9bcd50d701
3
  size 1979780440
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f3f4271e5f6d4235465888481ec0c0b8ab1a8dcaea7d32c7c5517a3b0507bf47
3
  size 1979780440
llama-factory/merged_models/internlm2_5-7b-chat-1m_sft_bf16_p2_full/model-00004-of-00008.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:bb7f47836df9696fedaef1c9a288f84da39a93f8b1cd340435371560909e7061
3
  size 1946242728
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:25a4f0969df00963d23269ce06fb4ceff910e5fe8871bb0e8a387ca3be449fb7
3
  size 1946242728
llama-factory/merged_models/internlm2_5-7b-chat-1m_sft_bf16_p2_full/model-00005-of-00008.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:79706886713bbffcb585074fa8edfb2be2857037b5de2a15bd32aa3f875a9b2b
3
  size 1979780456
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8b7f335d694350b36baa6fd45f208ca6899a5034ceffeef3087f59cdc8fc073c
3
  size 1979780456
llama-factory/merged_models/internlm2_5-7b-chat-1m_sft_bf16_p2_full/model-00006-of-00008.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:63897d186fa6fde794cd9c68bbeb7947ac1a78447dd10e8c6500253e886a2441
3
  size 1946242728
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a1fabd10fa2b73b9763c12954bdfde663f8572beb20df4075d522fcf6c5a51cc
3
  size 1946242728
llama-factory/merged_models/internlm2_5-7b-chat-1m_sft_bf16_p2_full/model-00007-of-00008.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:a7162d34640f50426e1323281fa359ec983f618358b7359d922588908aea05a4
3
  size 1979780456
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ce32061ffd1f9ec4f0c5ff9a0593d0601e852833562c2f925279d06057a9bd94
3
  size 1979780456
llama-factory/merged_models/internlm2_5-7b-chat-1m_sft_bf16_p2_full/model-00008-of-00008.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:54f2c571880b9e45211a21afa9cbd132e11bc0309ae9b579a5e8904d82974875
3
  size 1748035640
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:709d41db0bbf989d866e27b7743c60a9b9445d6051dc47b554a88efe17925b22
3
  size 1748035640
results/mgtv-results_merged_model.csv CHANGED
The diff for this file is too large to render. See raw diff
 
scripts/merge.sh CHANGED
@@ -5,9 +5,18 @@ cd $BASEDIR/../llama-factory
5
  echo Current Directory:
6
  pwd
7
 
 
 
 
 
 
 
 
 
 
8
  CUDA_VISIBLE_DEVICES=0 llamafactory-cli export \
9
  --model_name_or_path internlm/internlm2_5-7b-chat-1m \
10
- --adapter_name_or_path saves/internlm2_5_7b/lora/sft_bf16_p2_full/checkpoint-528 \
11
  --template intern2 \
12
  --finetuning_type lora \
13
  --export_dir merged_models/internlm2_5-7b-chat-1m_sft_bf16_p2_full \
 
5
  echo Current Directory:
6
  pwd
7
 
8
+ # CUDA_VISIBLE_DEVICES=0 llamafactory-cli export \
9
+ # --model_name_or_path internlm/internlm2_5-7b-chat-1m \
10
+ # --adapter_name_or_path saves/internlm2_5_7b/lora/sft_bf16_p2_full/checkpoint-528 \
11
+ # --template intern2 \
12
+ # --finetuning_type lora \
13
+ # --export_dir merged_models/internlm2_5-7b-chat-1m_sft_bf16_p2_full \
14
+ # --export_size 2 \
15
+ # --export_legacy_format False
16
+
17
  CUDA_VISIBLE_DEVICES=0 llamafactory-cli export \
18
  --model_name_or_path internlm/internlm2_5-7b-chat-1m \
19
+ --adapter_name_or_path saves/internlm2_5_7b/lora/sft_bf16_p2_full/checkpoint-88 \
20
  --template intern2 \
21
  --finetuning_type lora \
22
  --export_dir merged_models/internlm2_5-7b-chat-1m_sft_bf16_p2_full \