{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "3d87ca8d", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "aa\n" ] } ], "source": [ "print('aa')\n", "# /usr/local/bin/python -m jupyter notebook --no-browser --port=8888\n", "# /usr/local/bin/python\n", "# 后台启动 Jupyter Server,不打开浏览器,指定端口\n", "# /usr/local/bin/python -m jupyter server --no-browser --port=8888 \n" ] }, { "cell_type": "code", "execution_count": null, "id": "6255246a", "metadata": {}, "outputs": [], "source": [ "import json\n", "with open('/data/oss_bucket_0/liqi/dataset/embedding_pf/zhaoxiangsi_train.json',\"r\", encoding=\"utf-8\") as f:\n", " data = json.load(f)\n", "number_1 = 0\n", "number_0 = 0\n", "print(data[0].keys())\n", "print(data[0])\n", "print(data[1])\n", "print(data[2])\n", "number = 0\n", "# for i in data:\n", " # if i['label'] == '0':\n", " # number += 1\n", " # print(i)\n", " # break\n", " # if i['rn'] == '037a6b4e192533b2e0dc9ab3fb692806':\n", " # number += 1\n", " # if i['label'] == '0':\n", " # number_0 += 1\n", " # print(i)\n", " # if i['label'] == '1':\n", " # number_1 += 1\n", " \n", "print(number_0)\n", "print(number_1)\n", "print(number)" ] }, { "cell_type": "code", "execution_count": 7, "id": "0e5a8159", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0\n", "1\n", "2 sample: 6 6 10\n", "3 sample: 9 9 4\n", "4 sample: 5 5 10\n", "5 sample: 10 10 6\n", "6 sample: 10 10 4\n", "7 sample: 2 2 14\n", "8 sample: 10 10 2\n", "9 sample: 10 10 6\n" ] } ], "source": [ "import json\n", "with open('/data/oss_bucket_0/liqi/dataset/embedding_pf/zhaoxiangsi_train.json',\"r\", encoding=\"utf-8\") as f:\n", " data = json.load(f)\n", "for i in range(0,10):\n", " prompt_list = data[i]['pos_prompts'].split('##')\n", " pos_list = data[i]['pos_item_tfsids'].split('##')\n", " neg_list = data[i]['neg_item_tfsids'].split('##')\n", " if len(prompt_list) == len(pos_list) and len(prompt_list) == len(neg_list):\n", " print(i)\n", " else:\n", " print(f\"{i} sample: {len(prompt_list)} {len(pos_list)} {len(neg_list)}\")" ] }, { "cell_type": "code", "execution_count": 8, "id": "9e6501bd", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "193145\n" ] } ], "source": [ "import json\n", "with open('/data/oss_bucket_0/liqi/dataset/embedding_pf/bianji_train.json',\"r\", encoding=\"utf-8\") as f:\n", " data = json.load(f)\n", "print(len(data))\n", "# with open('/data/oss_bucket_0/liqi/dataset/embedding_pf/cot_output_new/dapei_train_cot.json',\"r\", encoding=\"utf-8\") as f:\n", "# data2 = json.load(f)\n", "# print(len(data2))" ] }, { "cell_type": "code", "execution_count": null, "id": "c55c3414", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "rn: 10_copy1\n", "query_tfsid: O1CN01b1XDLi1ng65mWbXUm_!!4611686018427384350-0-imgsearch.jpg\n", "query_bbox: 50 185 357 565\n", "instruction: 要个带推杆的儿童三轮车\n", "cot: 粉色儿童三轮车,配备黑色手推杆,紫色座椅带有浅绿色箭头图案,车身侧面设储物篮,适合1-3岁宝宝骑行。\n", "prompt_index: 0\n", "pos_item_tfsid: O1CN01e6SdyJ1zEPYnOJHvb_!!4611686018427385642-0-fleamarket.jpg\n", "pos_item_title: 儿童三轮车脚踏车小孩轻便脚蹬自行车1-3-6岁宝宝手推滑行车\n", "pos_item_bbox: 16 66 841 1184\n", "neg_item_tfsid: O1CN01uY8GlQ1FZ34pNSBLB_!!2206509150500.jpg\n", "neg_item_title: 儿童平衡滑步车1-3岁宝宝小孩学步6手推车三合一三轮溜娃神器骑行\n", "neg_item_bbox: 50 49 764 653\n" ] } ], "source": [ "import json\n", "with open('/data/oss_bucket_0/liqi/dataset/embedding_pf/cot_output_new/dapei_train_cot.json',\"r\", encoding=\"utf-8\") as f:\n", " data2 = json.load(f)\n", "print(len(data2))\n", "# data = data2[0]\n", "# for i in data.keys():\n", "# print(f\"{i}: {data[i]}\")" ] }, { "cell_type": "code", "execution_count": 3, "id": "5a649d5f", "metadata": {}, "outputs": [], "source": [ "\n", "import json\n", "with open('/data/oss_bucket_0/liqi/dataset/embedding_pf/bianji_test.json',\"r\", encoding=\"utf-8\") as f:\n", " data2 = json.load(f)\n", "new_data = data2[:200]\n", "json.dump(new_data,open(\"./bianji_test_200.json\", \"w\", encoding=\"utf-8\"),ensure_ascii=False,indent=2)\n", "# data = data2[0]\n", "# for i in data.keys():\n", "# print(f\"{i}: {data[i]}\")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "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.13.12" } }, "nbformat": 4, "nbformat_minor": 5 }