File size: 5,686 Bytes
0ab2566
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
{
 "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
}