nbroad commited on
Commit
29ed70b
·
verified ·
1 Parent(s): 970279e

Upload convert_to_long.ipynb

Browse files
Files changed (1) hide show
  1. convert_to_long.ipynb +1091 -0
convert_to_long.ipynb ADDED
@@ -0,0 +1,1091 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "426ead53-211f-4f07-b327-ce1f75f923e0",
7
+ "metadata": {
8
+ "tags": []
9
+ },
10
+ "outputs": [
11
+ {
12
+ "name": "stdout",
13
+ "output_type": "stream",
14
+ "text": [
15
+ "Collecting transformers\n",
16
+ " Downloading transformers-4.41.2-py3-none-any.whl (9.1 MB)\n",
17
+ "\u001b[K |████████████████████████████████| 9.1 MB 26.1 MB/s eta 0:00:01\n",
18
+ "\u001b[?25hCollecting sentencepiece\n",
19
+ " Downloading sentencepiece-0.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB)\n",
20
+ "\u001b[K |████████████████████████████████| 1.3 MB 94.2 MB/s eta 0:00:01\n",
21
+ "\u001b[?25hCollecting filelock\n",
22
+ " Downloading filelock-3.15.4-py3-none-any.whl (16 kB)\n",
23
+ "Collecting numpy>=1.17\n",
24
+ " Downloading numpy-2.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.3 MB)\n",
25
+ "\u001b[K |████████████████████████████████| 19.3 MB 97.7 MB/s eta 0:00:01\n",
26
+ "\u001b[?25hRequirement already satisfied: pyyaml>=5.1 in /home/user/miniconda/lib/python3.9/site-packages (from transformers) (6.0.1)\n",
27
+ "Collecting safetensors>=0.4.1\n",
28
+ " Downloading safetensors-0.4.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB)\n",
29
+ "\u001b[K |████████████████████████████████| 1.2 MB 87.6 MB/s eta 0:00:01\n",
30
+ "\u001b[?25hCollecting tokenizers<0.20,>=0.19\n",
31
+ " Downloading tokenizers-0.19.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.6 MB)\n",
32
+ "\u001b[K |████████████████████████████████| 3.6 MB 111.0 MB/s eta 0:00:01\n",
33
+ "\u001b[?25hCollecting regex!=2019.12.17\n",
34
+ " Downloading regex-2024.5.15-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (774 kB)\n",
35
+ "\u001b[K |████████████████████████████████| 774 kB 96.6 MB/s eta 0:00:01\n",
36
+ "\u001b[?25hRequirement already satisfied: packaging>=20.0 in /home/user/miniconda/lib/python3.9/site-packages (from transformers) (24.1)\n",
37
+ "Collecting huggingface-hub<1.0,>=0.23.0\n",
38
+ " Downloading huggingface_hub-0.23.4-py3-none-any.whl (402 kB)\n",
39
+ "\u001b[K |████████████████████████████████| 402 kB 118.3 MB/s eta 0:00:01\n",
40
+ "\u001b[?25hRequirement already satisfied: tqdm>=4.27 in /home/user/miniconda/lib/python3.9/site-packages (from transformers) (4.61.2)\n",
41
+ "Requirement already satisfied: requests in /home/user/miniconda/lib/python3.9/site-packages (from transformers) (2.32.3)\n",
42
+ "Requirement already satisfied: typing-extensions>=3.7.4.3 in /home/user/miniconda/lib/python3.9/site-packages (from huggingface-hub<1.0,>=0.23.0->transformers) (4.12.2)\n",
43
+ "Collecting fsspec>=2023.5.0\n",
44
+ " Downloading fsspec-2024.6.0-py3-none-any.whl (176 kB)\n",
45
+ "\u001b[K |████████████████████████████████| 176 kB 127.1 MB/s eta 0:00:01\n",
46
+ "\u001b[?25hRequirement already satisfied: urllib3<3,>=1.21.1 in /home/user/miniconda/lib/python3.9/site-packages (from requests->transformers) (1.26.6)\n",
47
+ "Requirement already satisfied: charset-normalizer<4,>=2 in /home/user/miniconda/lib/python3.9/site-packages (from requests->transformers) (3.3.2)\n",
48
+ "Requirement already satisfied: idna<4,>=2.5 in /home/user/miniconda/lib/python3.9/site-packages (from requests->transformers) (2.10)\n",
49
+ "Requirement already satisfied: certifi>=2017.4.17 in /home/user/miniconda/lib/python3.9/site-packages (from requests->transformers) (2021.5.30)\n",
50
+ "Installing collected packages: fsspec, filelock, huggingface-hub, tokenizers, safetensors, regex, numpy, transformers, sentencepiece\n",
51
+ "Successfully installed filelock-3.15.4 fsspec-2024.6.0 huggingface-hub-0.23.4 numpy-2.0.0 regex-2024.5.15 safetensors-0.4.3 sentencepiece-0.2.0 tokenizers-0.19.1 transformers-4.41.2\n"
52
+ ]
53
+ }
54
+ ],
55
+ "source": [
56
+ "!pip install transformers sentencepiece"
57
+ ]
58
+ },
59
+ {
60
+ "cell_type": "code",
61
+ "execution_count": 1,
62
+ "id": "5bee7472-9458-428b-b315-2a6579ecbcd7",
63
+ "metadata": {
64
+ "tags": []
65
+ },
66
+ "outputs": [
67
+ {
68
+ "data": {
69
+ "application/json": {
70
+ "ascii": false,
71
+ "bar_format": null,
72
+ "colour": null,
73
+ "elapsed": 0.0051538944244384766,
74
+ "initial": 0,
75
+ "n": 0,
76
+ "ncols": null,
77
+ "nrows": null,
78
+ "postfix": null,
79
+ "prefix": "config.json",
80
+ "rate": null,
81
+ "total": 615,
82
+ "unit": "B",
83
+ "unit_divisor": 1000,
84
+ "unit_scale": true
85
+ },
86
+ "application/vnd.jupyter.widget-view+json": {
87
+ "model_id": "b071a2288c7848b9a86e9c12e7c5105c",
88
+ "version_major": 2,
89
+ "version_minor": 0
90
+ },
91
+ "text/plain": [
92
+ "config.json: 0%| | 0.00/615 [00:00<?, ?B/s]"
93
+ ]
94
+ },
95
+ "metadata": {},
96
+ "output_type": "display_data"
97
+ },
98
+ {
99
+ "data": {
100
+ "application/json": {
101
+ "ascii": false,
102
+ "bar_format": null,
103
+ "colour": null,
104
+ "elapsed": 0.004002094268798828,
105
+ "initial": 0,
106
+ "n": 0,
107
+ "ncols": null,
108
+ "nrows": null,
109
+ "postfix": null,
110
+ "prefix": "model.safetensors",
111
+ "rate": null,
112
+ "total": 1115567652,
113
+ "unit": "B",
114
+ "unit_divisor": 1000,
115
+ "unit_scale": true
116
+ },
117
+ "application/vnd.jupyter.widget-view+json": {
118
+ "model_id": "524b814ec5164db5a86203078b303a9c",
119
+ "version_major": 2,
120
+ "version_minor": 0
121
+ },
122
+ "text/plain": [
123
+ "model.safetensors: 0%| | 0.00/1.12G [00:00<?, ?B/s]"
124
+ ]
125
+ },
126
+ "metadata": {},
127
+ "output_type": "display_data"
128
+ }
129
+ ],
130
+ "source": [
131
+ "from transformers import AutoModel\n",
132
+ "\n",
133
+ "xlm_base = AutoModel.from_pretrained(\"xlm-roberta-base\")"
134
+ ]
135
+ },
136
+ {
137
+ "cell_type": "code",
138
+ "execution_count": 2,
139
+ "id": "3c5bfded-aa37-4c1b-8fe8-c6fe64e184e7",
140
+ "metadata": {
141
+ "tags": []
142
+ },
143
+ "outputs": [
144
+ {
145
+ "data": {
146
+ "application/json": {
147
+ "ascii": false,
148
+ "bar_format": null,
149
+ "colour": null,
150
+ "elapsed": 0.0036783218383789062,
151
+ "initial": 0,
152
+ "n": 0,
153
+ "ncols": null,
154
+ "nrows": null,
155
+ "postfix": null,
156
+ "prefix": "config.json",
157
+ "rate": null,
158
+ "total": 616,
159
+ "unit": "B",
160
+ "unit_divisor": 1000,
161
+ "unit_scale": true
162
+ },
163
+ "application/vnd.jupyter.widget-view+json": {
164
+ "model_id": "67617bf347cf46bb95d1559e756b3e64",
165
+ "version_major": 2,
166
+ "version_minor": 0
167
+ },
168
+ "text/plain": [
169
+ "config.json: 0%| | 0.00/616 [00:00<?, ?B/s]"
170
+ ]
171
+ },
172
+ "metadata": {},
173
+ "output_type": "display_data"
174
+ },
175
+ {
176
+ "data": {
177
+ "application/json": {
178
+ "ascii": false,
179
+ "bar_format": null,
180
+ "colour": null,
181
+ "elapsed": 0.00390625,
182
+ "initial": 0,
183
+ "n": 0,
184
+ "ncols": null,
185
+ "nrows": null,
186
+ "postfix": null,
187
+ "prefix": "model.safetensors",
188
+ "rate": null,
189
+ "total": 2244817354,
190
+ "unit": "B",
191
+ "unit_divisor": 1000,
192
+ "unit_scale": true
193
+ },
194
+ "application/vnd.jupyter.widget-view+json": {
195
+ "model_id": "7cd0c7418dc4483083054e541b6dd1ac",
196
+ "version_major": 2,
197
+ "version_minor": 0
198
+ },
199
+ "text/plain": [
200
+ "model.safetensors: 0%| | 0.00/2.24G [00:00<?, ?B/s]"
201
+ ]
202
+ },
203
+ "metadata": {},
204
+ "output_type": "display_data"
205
+ }
206
+ ],
207
+ "source": [
208
+ "xlm_large = AutoModel.from_pretrained(\"xlm-roberta-large\")"
209
+ ]
210
+ },
211
+ {
212
+ "cell_type": "code",
213
+ "execution_count": 3,
214
+ "id": "ba1b9da7-eafe-4c81-b47d-63ae94585b37",
215
+ "metadata": {
216
+ "tags": []
217
+ },
218
+ "outputs": [
219
+ {
220
+ "data": {
221
+ "text/plain": [
222
+ "XLMRobertaModel(\n",
223
+ " (embeddings): XLMRobertaEmbeddings(\n",
224
+ " (word_embeddings): Embedding(250002, 768, padding_idx=1)\n",
225
+ " (position_embeddings): Embedding(514, 768, padding_idx=1)\n",
226
+ " (token_type_embeddings): Embedding(1, 768)\n",
227
+ " (LayerNorm): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
228
+ " (dropout): Dropout(p=0.1, inplace=False)\n",
229
+ " )\n",
230
+ " (encoder): XLMRobertaEncoder(\n",
231
+ " (layer): ModuleList(\n",
232
+ " (0-11): 12 x XLMRobertaLayer(\n",
233
+ " (attention): XLMRobertaAttention(\n",
234
+ " (self): XLMRobertaSelfAttention(\n",
235
+ " (query): Linear(in_features=768, out_features=768, bias=True)\n",
236
+ " (key): Linear(in_features=768, out_features=768, bias=True)\n",
237
+ " (value): Linear(in_features=768, out_features=768, bias=True)\n",
238
+ " (dropout): Dropout(p=0.1, inplace=False)\n",
239
+ " )\n",
240
+ " (output): XLMRobertaSelfOutput(\n",
241
+ " (dense): Linear(in_features=768, out_features=768, bias=True)\n",
242
+ " (LayerNorm): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
243
+ " (dropout): Dropout(p=0.1, inplace=False)\n",
244
+ " )\n",
245
+ " )\n",
246
+ " (intermediate): XLMRobertaIntermediate(\n",
247
+ " (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
248
+ " (intermediate_act_fn): GELUActivation()\n",
249
+ " )\n",
250
+ " (output): XLMRobertaOutput(\n",
251
+ " (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
252
+ " (LayerNorm): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
253
+ " (dropout): Dropout(p=0.1, inplace=False)\n",
254
+ " )\n",
255
+ " )\n",
256
+ " )\n",
257
+ " )\n",
258
+ " (pooler): XLMRobertaPooler(\n",
259
+ " (dense): Linear(in_features=768, out_features=768, bias=True)\n",
260
+ " (activation): Tanh()\n",
261
+ " )\n",
262
+ ")"
263
+ ]
264
+ },
265
+ "execution_count": 3,
266
+ "metadata": {},
267
+ "output_type": "execute_result"
268
+ }
269
+ ],
270
+ "source": [
271
+ "xlm_base"
272
+ ]
273
+ },
274
+ {
275
+ "cell_type": "code",
276
+ "execution_count": 6,
277
+ "id": "53fcc03e-d6f5-41c3-9dc2-2922e6747896",
278
+ "metadata": {
279
+ "tags": []
280
+ },
281
+ "outputs": [
282
+ {
283
+ "data": {
284
+ "text/plain": [
285
+ "tensor([[ 0.0578, -0.0071, -0.0068, ..., 0.0061, -0.0260, -0.0291],\n",
286
+ " [ 0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000],\n",
287
+ " [-0.1564, -0.0728, -0.2477, ..., -0.0778, -0.3088, -0.0090],\n",
288
+ " ...,\n",
289
+ " [ 0.0118, 0.0458, -0.0054, ..., -0.0865, 0.0374, 0.0040],\n",
290
+ " [ 0.0525, -0.0270, -0.0141, ..., -0.0552, 0.0349, 0.0274],\n",
291
+ " [-0.0479, -0.0293, 0.1079, ..., -0.0825, 0.2908, 0.0861]])"
292
+ ]
293
+ },
294
+ "execution_count": 6,
295
+ "metadata": {},
296
+ "output_type": "execute_result"
297
+ }
298
+ ],
299
+ "source": [
300
+ "old_embeddings = xlm_base.embeddings.position_embeddings.weight.data\n",
301
+ "old_embeddings"
302
+ ]
303
+ },
304
+ {
305
+ "cell_type": "code",
306
+ "execution_count": 7,
307
+ "id": "fc69704e-51a6-489f-8b6a-b776d1027a2a",
308
+ "metadata": {
309
+ "tags": []
310
+ },
311
+ "outputs": [
312
+ {
313
+ "data": {
314
+ "text/plain": [
315
+ "torch.Size([514, 768])"
316
+ ]
317
+ },
318
+ "execution_count": 7,
319
+ "metadata": {},
320
+ "output_type": "execute_result"
321
+ }
322
+ ],
323
+ "source": [
324
+ "old_embeddings.shape"
325
+ ]
326
+ },
327
+ {
328
+ "cell_type": "code",
329
+ "execution_count": 8,
330
+ "id": "714faf1f-ec8c-4e39-986f-5624658c8a9d",
331
+ "metadata": {
332
+ "tags": []
333
+ },
334
+ "outputs": [],
335
+ "source": [
336
+ "import torch\n",
337
+ "\n",
338
+ "new_embeddings = torch.zeros((2050, 768))"
339
+ ]
340
+ },
341
+ {
342
+ "cell_type": "code",
343
+ "execution_count": 10,
344
+ "id": "4eb8dfff-57a7-4e2c-a060-54d7ec84e2d7",
345
+ "metadata": {
346
+ "tags": []
347
+ },
348
+ "outputs": [],
349
+ "source": [
350
+ "new_embeddings[:514, :] = old_embeddings.clone()"
351
+ ]
352
+ },
353
+ {
354
+ "cell_type": "code",
355
+ "execution_count": 19,
356
+ "id": "0a4dcbb8-20f1-476c-83b0-199d3e406888",
357
+ "metadata": {
358
+ "tags": []
359
+ },
360
+ "outputs": [
361
+ {
362
+ "name": "stdout",
363
+ "output_type": "stream",
364
+ "text": [
365
+ "514 1026\n",
366
+ "1026 1538\n",
367
+ "1538 2050\n"
368
+ ]
369
+ }
370
+ ],
371
+ "source": [
372
+ "num_pos = 514\n",
373
+ "\n",
374
+ "for i in range(3):\n",
375
+ " start_idx = num_pos+512*i\n",
376
+ " end_idx = start_idx + 512\n",
377
+ " new_embeddings[start_idx:end_idx, :] = old_embeddings[2:, :].clone()\n",
378
+ " print(start_idx, end_idx)"
379
+ ]
380
+ },
381
+ {
382
+ "cell_type": "code",
383
+ "execution_count": 30,
384
+ "id": "6530a6fa-fe8e-4d37-9e35-1272643d04c4",
385
+ "metadata": {
386
+ "tags": []
387
+ },
388
+ "outputs": [
389
+ {
390
+ "name": "stderr",
391
+ "output_type": "stream",
392
+ "text": [
393
+ "Some weights of XLMRobertaModel were not initialized from the model checkpoint at xlm-roberta-base and are newly initialized because the shapes did not match:\n",
394
+ "- roberta.embeddings.position_embeddings.weight: found shape torch.Size([514, 768]) in the checkpoint and torch.Size([2050, 768]) in the model instantiated\n",
395
+ "You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.\n"
396
+ ]
397
+ }
398
+ ],
399
+ "source": [
400
+ "\n",
401
+ "xlm_base = AutoModel.from_pretrained(\"xlm-roberta-base\", max_position_embeddings=2050, ignore_mismatched_sizes=True)\n",
402
+ "\n",
403
+ "xlm_base.embeddings.position_embeddings.weight.data = new_embeddings"
404
+ ]
405
+ },
406
+ {
407
+ "cell_type": "code",
408
+ "execution_count": 31,
409
+ "id": "ae8250bb-2d81-4ad9-b281-84d9ad3d9114",
410
+ "metadata": {
411
+ "tags": []
412
+ },
413
+ "outputs": [],
414
+ "source": [
415
+ "with torch.no_grad():\n",
416
+ " xlm_base(input_ids=seq_2048)"
417
+ ]
418
+ },
419
+ {
420
+ "cell_type": "code",
421
+ "execution_count": 33,
422
+ "id": "1e77aea0-65ff-403c-87cc-14afd87d7646",
423
+ "metadata": {
424
+ "tags": []
425
+ },
426
+ "outputs": [
427
+ {
428
+ "name": "stdout",
429
+ "output_type": "stream",
430
+ "text": [
431
+ "torch.Size([2050, 768])\n"
432
+ ]
433
+ },
434
+ {
435
+ "data": {
436
+ "text/plain": [
437
+ "tensor([[ 0.0578, -0.0071, -0.0068, ..., 0.0061, -0.0260, -0.0291],\n",
438
+ " [ 0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000],\n",
439
+ " [-0.1564, -0.0728, -0.2477, ..., -0.0778, -0.3088, -0.0090],\n",
440
+ " ...,\n",
441
+ " [ 0.0118, 0.0458, -0.0054, ..., -0.0865, 0.0374, 0.0040],\n",
442
+ " [ 0.0525, -0.0270, -0.0141, ..., -0.0552, 0.0349, 0.0274],\n",
443
+ " [-0.0479, -0.0293, 0.1079, ..., -0.0825, 0.2908, 0.0861]])"
444
+ ]
445
+ },
446
+ "execution_count": 33,
447
+ "metadata": {},
448
+ "output_type": "execute_result"
449
+ }
450
+ ],
451
+ "source": [
452
+ "print(xlm_base.embeddings.position_embeddings.weight.data.shape)\n",
453
+ "xlm_base.embeddings.position_embeddings.weight.data"
454
+ ]
455
+ },
456
+ {
457
+ "cell_type": "code",
458
+ "execution_count": 34,
459
+ "id": "74297602-9c8e-4341-96cc-b26435046082",
460
+ "metadata": {
461
+ "tags": []
462
+ },
463
+ "outputs": [
464
+ {
465
+ "name": "stdout",
466
+ "output_type": "stream",
467
+ "text": [
468
+ "514 1026\n",
469
+ "1026 1538\n",
470
+ "1538 2050\n"
471
+ ]
472
+ }
473
+ ],
474
+ "source": [
475
+ "old_embeddings = xlm_large.embeddings.position_embeddings.weight.data\n",
476
+ "\n",
477
+ "new_embeddings = torch.zeros((2050, old_embeddings.shape[1]))\n",
478
+ "\n",
479
+ "new_embeddings[:514, :] = old_embeddings.clone()\n",
480
+ "\n",
481
+ "num_pos = 514\n",
482
+ "\n",
483
+ "for i in range(3):\n",
484
+ " start_idx = num_pos+512*i\n",
485
+ " end_idx = start_idx + 512\n",
486
+ " new_embeddings[start_idx:end_idx, :] = old_embeddings[2:, :].clone()\n",
487
+ " print(start_idx, end_idx)"
488
+ ]
489
+ },
490
+ {
491
+ "cell_type": "code",
492
+ "execution_count": 35,
493
+ "id": "57ccd5e8-667a-4fae-be04-55c14aa1a316",
494
+ "metadata": {
495
+ "tags": []
496
+ },
497
+ "outputs": [
498
+ {
499
+ "name": "stderr",
500
+ "output_type": "stream",
501
+ "text": [
502
+ "Some weights of XLMRobertaModel were not initialized from the model checkpoint at xlm-roberta-large and are newly initialized because the shapes did not match:\n",
503
+ "- roberta.embeddings.position_embeddings.weight: found shape torch.Size([514, 1024]) in the checkpoint and torch.Size([2050, 1024]) in the model instantiated\n",
504
+ "You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.\n"
505
+ ]
506
+ }
507
+ ],
508
+ "source": [
509
+ "xlm_large = AutoModel.from_pretrained(\"xlm-roberta-large\", max_position_embeddings=2050, ignore_mismatched_sizes=True)\n",
510
+ "\n",
511
+ "xlm_large.embeddings.position_embeddings.weight.data = new_embeddings"
512
+ ]
513
+ },
514
+ {
515
+ "cell_type": "code",
516
+ "execution_count": 37,
517
+ "id": "1b584a7b-19b0-45ac-824c-57e37bf2bf75",
518
+ "metadata": {
519
+ "tags": []
520
+ },
521
+ "outputs": [
522
+ {
523
+ "name": "stdout",
524
+ "output_type": "stream",
525
+ "text": [
526
+ "The token has not been saved to the git credentials helper. Pass `add_to_git_credential=True` in this function directly or `--add-to-git-credential` if using via `huggingface-cli` if you want to set the git credential as well.\n",
527
+ "Token is valid (permission: write).\n",
528
+ "Your token has been saved to /home/user/.cache/huggingface/token\n",
529
+ "Login successful\n"
530
+ ]
531
+ }
532
+ ],
533
+ "source": [
534
+ "!huggingface-cli login"
535
+ ]
536
+ },
537
+ {
538
+ "cell_type": "code",
539
+ "execution_count": 38,
540
+ "id": "3b5f110a-c30d-4b83-997b-384cf159f1c4",
541
+ "metadata": {
542
+ "tags": []
543
+ },
544
+ "outputs": [
545
+ {
546
+ "data": {
547
+ "application/json": {
548
+ "ascii": false,
549
+ "bar_format": null,
550
+ "colour": null,
551
+ "elapsed": 0.004299163818359375,
552
+ "initial": 0,
553
+ "n": 0,
554
+ "ncols": null,
555
+ "nrows": null,
556
+ "postfix": null,
557
+ "prefix": "model.safetensors",
558
+ "rate": null,
559
+ "total": 2245898632,
560
+ "unit": "B",
561
+ "unit_divisor": 1000,
562
+ "unit_scale": true
563
+ },
564
+ "application/vnd.jupyter.widget-view+json": {
565
+ "model_id": "d1193e52abce44fdba074b5996560954",
566
+ "version_major": 2,
567
+ "version_minor": 0
568
+ },
569
+ "text/plain": [
570
+ "model.safetensors: 0%| | 0.00/2.25G [00:00<?, ?B/s]"
571
+ ]
572
+ },
573
+ "metadata": {},
574
+ "output_type": "display_data"
575
+ },
576
+ {
577
+ "data": {
578
+ "text/plain": [
579
+ "CommitInfo(commit_url='https://huggingface.co/nbroad/xlm-roberta-large-2048/commit/8270d498aad31c695866c0fbcf5c7eb932b69590', commit_message='Upload model', commit_description='', oid='8270d498aad31c695866c0fbcf5c7eb932b69590', pr_url=None, pr_revision=None, pr_num=None)"
580
+ ]
581
+ },
582
+ "execution_count": 38,
583
+ "metadata": {},
584
+ "output_type": "execute_result"
585
+ }
586
+ ],
587
+ "source": [
588
+ "xlm_large.push_to_hub(\"nbroad/xlm-roberta-large-2048\")"
589
+ ]
590
+ },
591
+ {
592
+ "cell_type": "code",
593
+ "execution_count": 39,
594
+ "id": "b0448ee6-e471-44f3-ac8e-e18ed66adcbb",
595
+ "metadata": {
596
+ "tags": []
597
+ },
598
+ "outputs": [
599
+ {
600
+ "data": {
601
+ "application/json": {
602
+ "ascii": false,
603
+ "bar_format": null,
604
+ "colour": null,
605
+ "elapsed": 0.003611326217651367,
606
+ "initial": 0,
607
+ "n": 0,
608
+ "ncols": null,
609
+ "nrows": null,
610
+ "postfix": null,
611
+ "prefix": "model.safetensors",
612
+ "rate": null,
613
+ "total": 1116915696,
614
+ "unit": "B",
615
+ "unit_divisor": 1000,
616
+ "unit_scale": true
617
+ },
618
+ "application/vnd.jupyter.widget-view+json": {
619
+ "model_id": "2c2058a26f1641ea8645220c91f50d73",
620
+ "version_major": 2,
621
+ "version_minor": 0
622
+ },
623
+ "text/plain": [
624
+ "model.safetensors: 0%| | 0.00/1.12G [00:00<?, ?B/s]"
625
+ ]
626
+ },
627
+ "metadata": {},
628
+ "output_type": "display_data"
629
+ },
630
+ {
631
+ "data": {
632
+ "text/plain": [
633
+ "CommitInfo(commit_url='https://huggingface.co/nbroad/xlm-roberta-base-2048/commit/4daea3ba9080f535f1fc819cbc76453248252f6b', commit_message='Upload model', commit_description='', oid='4daea3ba9080f535f1fc819cbc76453248252f6b', pr_url=None, pr_revision=None, pr_num=None)"
634
+ ]
635
+ },
636
+ "execution_count": 39,
637
+ "metadata": {},
638
+ "output_type": "execute_result"
639
+ }
640
+ ],
641
+ "source": [
642
+ "xlm_base.push_to_hub(\"nbroad/xlm-roberta-base-2048\")"
643
+ ]
644
+ },
645
+ {
646
+ "cell_type": "code",
647
+ "execution_count": 40,
648
+ "id": "5bae84dc-a5c1-40cd-9eaf-a42e0a4276f3",
649
+ "metadata": {
650
+ "tags": []
651
+ },
652
+ "outputs": [],
653
+ "source": [
654
+ "from transformers import AutoTokenizer\n",
655
+ "\n",
656
+ "tokenizer = AutoTokenizer.from_pretrained(\"xlm-roberta-base\")"
657
+ ]
658
+ },
659
+ {
660
+ "cell_type": "code",
661
+ "execution_count": 42,
662
+ "id": "1bbf303d-8613-43dd-9a1e-4fb597920b78",
663
+ "metadata": {
664
+ "tags": []
665
+ },
666
+ "outputs": [],
667
+ "source": [
668
+ "tokenizer.model_max_length = 2048"
669
+ ]
670
+ },
671
+ {
672
+ "cell_type": "code",
673
+ "execution_count": 44,
674
+ "id": "07add3fd-e539-43ef-be9b-9409e5f44e40",
675
+ "metadata": {
676
+ "tags": []
677
+ },
678
+ "outputs": [
679
+ {
680
+ "data": {
681
+ "application/json": {
682
+ "ascii": false,
683
+ "bar_format": null,
684
+ "colour": null,
685
+ "elapsed": 0.0037915706634521484,
686
+ "initial": 0,
687
+ "n": 0,
688
+ "ncols": null,
689
+ "nrows": null,
690
+ "postfix": null,
691
+ "prefix": "README.md",
692
+ "rate": null,
693
+ "total": 5174,
694
+ "unit": "B",
695
+ "unit_divisor": 1000,
696
+ "unit_scale": true
697
+ },
698
+ "application/vnd.jupyter.widget-view+json": {
699
+ "model_id": "a2b9909d0e784de0bc03e1edc6b8e21a",
700
+ "version_major": 2,
701
+ "version_minor": 0
702
+ },
703
+ "text/plain": [
704
+ "README.md: 0%| | 0.00/5.17k [00:00<?, ?B/s]"
705
+ ]
706
+ },
707
+ "metadata": {},
708
+ "output_type": "display_data"
709
+ },
710
+ {
711
+ "data": {
712
+ "application/json": {
713
+ "ascii": false,
714
+ "bar_format": null,
715
+ "colour": null,
716
+ "elapsed": 0.0038919448852539062,
717
+ "initial": 0,
718
+ "n": 0,
719
+ "ncols": null,
720
+ "nrows": null,
721
+ "postfix": null,
722
+ "prefix": "sentencepiece.bpe.model",
723
+ "rate": null,
724
+ "total": 5069051,
725
+ "unit": "B",
726
+ "unit_divisor": 1000,
727
+ "unit_scale": true
728
+ },
729
+ "application/vnd.jupyter.widget-view+json": {
730
+ "model_id": "9d22217b68554e9ab3c67be3dce5d9a3",
731
+ "version_major": 2,
732
+ "version_minor": 0
733
+ },
734
+ "text/plain": [
735
+ "sentencepiece.bpe.model: 0%| | 0.00/5.07M [00:00<?, ?B/s]"
736
+ ]
737
+ },
738
+ "metadata": {},
739
+ "output_type": "display_data"
740
+ },
741
+ {
742
+ "data": {
743
+ "application/json": {
744
+ "ascii": false,
745
+ "bar_format": null,
746
+ "colour": null,
747
+ "elapsed": 0.0034050941467285156,
748
+ "initial": 0,
749
+ "n": 0,
750
+ "ncols": null,
751
+ "nrows": null,
752
+ "postfix": null,
753
+ "prefix": "Upload 2 LFS files",
754
+ "rate": null,
755
+ "total": 2,
756
+ "unit": "it",
757
+ "unit_divisor": 1000,
758
+ "unit_scale": false
759
+ },
760
+ "application/vnd.jupyter.widget-view+json": {
761
+ "model_id": "e0f6e1f6662c44a1b434ee81980cbe97",
762
+ "version_major": 2,
763
+ "version_minor": 0
764
+ },
765
+ "text/plain": [
766
+ "Upload 2 LFS files: 0%| | 0/2 [00:00<?, ?it/s]"
767
+ ]
768
+ },
769
+ "metadata": {},
770
+ "output_type": "display_data"
771
+ },
772
+ {
773
+ "data": {
774
+ "application/json": {
775
+ "ascii": false,
776
+ "bar_format": null,
777
+ "colour": null,
778
+ "elapsed": 0.0035247802734375,
779
+ "initial": 0,
780
+ "n": 0,
781
+ "ncols": null,
782
+ "nrows": null,
783
+ "postfix": null,
784
+ "prefix": "tokenizer.json",
785
+ "rate": null,
786
+ "total": 17082734,
787
+ "unit": "B",
788
+ "unit_divisor": 1000,
789
+ "unit_scale": true
790
+ },
791
+ "application/vnd.jupyter.widget-view+json": {
792
+ "model_id": "6db7d931fd2846ad9fa36c0612b9aa71",
793
+ "version_major": 2,
794
+ "version_minor": 0
795
+ },
796
+ "text/plain": [
797
+ "tokenizer.json: 0%| | 0.00/17.1M [00:00<?, ?B/s]"
798
+ ]
799
+ },
800
+ "metadata": {},
801
+ "output_type": "display_data"
802
+ },
803
+ {
804
+ "data": {
805
+ "text/plain": [
806
+ "CommitInfo(commit_url='https://huggingface.co/nbroad/xlm-roberta-base-2048/commit/82129a4b55ea013dd3fa2816c24696814b08a6b4', commit_message='Upload tokenizer', commit_description='', oid='82129a4b55ea013dd3fa2816c24696814b08a6b4', pr_url=None, pr_revision=None, pr_num=None)"
807
+ ]
808
+ },
809
+ "execution_count": 44,
810
+ "metadata": {},
811
+ "output_type": "execute_result"
812
+ }
813
+ ],
814
+ "source": [
815
+ "tokenizer.push_to_hub(\"nbroad/xlm-roberta-base-2048\")"
816
+ ]
817
+ },
818
+ {
819
+ "cell_type": "code",
820
+ "execution_count": 45,
821
+ "id": "2ab6599e-3621-469f-8bdd-389cf7f60088",
822
+ "metadata": {
823
+ "tags": []
824
+ },
825
+ "outputs": [
826
+ {
827
+ "data": {
828
+ "application/json": {
829
+ "ascii": false,
830
+ "bar_format": null,
831
+ "colour": null,
832
+ "elapsed": 0.0036215782165527344,
833
+ "initial": 0,
834
+ "n": 0,
835
+ "ncols": null,
836
+ "nrows": null,
837
+ "postfix": null,
838
+ "prefix": "tokenizer_config.json",
839
+ "rate": null,
840
+ "total": 25,
841
+ "unit": "B",
842
+ "unit_divisor": 1000,
843
+ "unit_scale": true
844
+ },
845
+ "application/vnd.jupyter.widget-view+json": {
846
+ "model_id": "4c30d397f9344f2ca227d117618d25ce",
847
+ "version_major": 2,
848
+ "version_minor": 0
849
+ },
850
+ "text/plain": [
851
+ "tokenizer_config.json: 0%| | 0.00/25.0 [00:00<?, ?B/s]"
852
+ ]
853
+ },
854
+ "metadata": {},
855
+ "output_type": "display_data"
856
+ },
857
+ {
858
+ "data": {
859
+ "application/json": {
860
+ "ascii": false,
861
+ "bar_format": null,
862
+ "colour": null,
863
+ "elapsed": 0.003586292266845703,
864
+ "initial": 0,
865
+ "n": 0,
866
+ "ncols": null,
867
+ "nrows": null,
868
+ "postfix": null,
869
+ "prefix": "sentencepiece.bpe.model",
870
+ "rate": null,
871
+ "total": 5069051,
872
+ "unit": "B",
873
+ "unit_divisor": 1000,
874
+ "unit_scale": true
875
+ },
876
+ "application/vnd.jupyter.widget-view+json": {
877
+ "model_id": "d094dd6bccd84006b0d7347d8dbdccfe",
878
+ "version_major": 2,
879
+ "version_minor": 0
880
+ },
881
+ "text/plain": [
882
+ "sentencepiece.bpe.model: 0%| | 0.00/5.07M [00:00<?, ?B/s]"
883
+ ]
884
+ },
885
+ "metadata": {},
886
+ "output_type": "display_data"
887
+ },
888
+ {
889
+ "data": {
890
+ "application/json": {
891
+ "ascii": false,
892
+ "bar_format": null,
893
+ "colour": null,
894
+ "elapsed": 0.003679037094116211,
895
+ "initial": 0,
896
+ "n": 0,
897
+ "ncols": null,
898
+ "nrows": null,
899
+ "postfix": null,
900
+ "prefix": "tokenizer.json",
901
+ "rate": null,
902
+ "total": 9096718,
903
+ "unit": "B",
904
+ "unit_divisor": 1000,
905
+ "unit_scale": true
906
+ },
907
+ "application/vnd.jupyter.widget-view+json": {
908
+ "model_id": "ff510cc6c58c42dc93c74d607543b734",
909
+ "version_major": 2,
910
+ "version_minor": 0
911
+ },
912
+ "text/plain": [
913
+ "tokenizer.json: 0%| | 0.00/9.10M [00:00<?, ?B/s]"
914
+ ]
915
+ },
916
+ "metadata": {},
917
+ "output_type": "display_data"
918
+ },
919
+ {
920
+ "data": {
921
+ "application/json": {
922
+ "ascii": false,
923
+ "bar_format": null,
924
+ "colour": null,
925
+ "elapsed": 0.003905057907104492,
926
+ "initial": 0,
927
+ "n": 0,
928
+ "ncols": null,
929
+ "nrows": null,
930
+ "postfix": null,
931
+ "prefix": "README.md",
932
+ "rate": null,
933
+ "total": 5174,
934
+ "unit": "B",
935
+ "unit_divisor": 1000,
936
+ "unit_scale": true
937
+ },
938
+ "application/vnd.jupyter.widget-view+json": {
939
+ "model_id": "b1d4be8d4e744082b9f48d6a92cc5f6c",
940
+ "version_major": 2,
941
+ "version_minor": 0
942
+ },
943
+ "text/plain": [
944
+ "README.md: 0%| | 0.00/5.17k [00:00<?, ?B/s]"
945
+ ]
946
+ },
947
+ "metadata": {},
948
+ "output_type": "display_data"
949
+ },
950
+ {
951
+ "data": {
952
+ "application/json": {
953
+ "ascii": false,
954
+ "bar_format": null,
955
+ "colour": null,
956
+ "elapsed": 0.0074939727783203125,
957
+ "initial": 0,
958
+ "n": 0,
959
+ "ncols": null,
960
+ "nrows": null,
961
+ "postfix": null,
962
+ "prefix": "Upload 2 LFS files",
963
+ "rate": null,
964
+ "total": 2,
965
+ "unit": "it",
966
+ "unit_divisor": 1000,
967
+ "unit_scale": false
968
+ },
969
+ "application/vnd.jupyter.widget-view+json": {
970
+ "model_id": "e32b5391525c4b448fadf8bbaf434f91",
971
+ "version_major": 2,
972
+ "version_minor": 0
973
+ },
974
+ "text/plain": [
975
+ "Upload 2 LFS files: 0%| | 0/2 [00:00<?, ?it/s]"
976
+ ]
977
+ },
978
+ "metadata": {},
979
+ "output_type": "display_data"
980
+ },
981
+ {
982
+ "data": {
983
+ "application/json": {
984
+ "ascii": false,
985
+ "bar_format": null,
986
+ "colour": null,
987
+ "elapsed": 0.0040264129638671875,
988
+ "initial": 0,
989
+ "n": 0,
990
+ "ncols": null,
991
+ "nrows": null,
992
+ "postfix": null,
993
+ "prefix": "sentencepiece.bpe.model",
994
+ "rate": null,
995
+ "total": 5069051,
996
+ "unit": "B",
997
+ "unit_divisor": 1000,
998
+ "unit_scale": true
999
+ },
1000
+ "application/vnd.jupyter.widget-view+json": {
1001
+ "model_id": "d9260ad639034eacbc3ee0f3cf970751",
1002
+ "version_major": 2,
1003
+ "version_minor": 0
1004
+ },
1005
+ "text/plain": [
1006
+ "sentencepiece.bpe.model: 0%| | 0.00/5.07M [00:00<?, ?B/s]"
1007
+ ]
1008
+ },
1009
+ "metadata": {},
1010
+ "output_type": "display_data"
1011
+ },
1012
+ {
1013
+ "data": {
1014
+ "application/json": {
1015
+ "ascii": false,
1016
+ "bar_format": null,
1017
+ "colour": null,
1018
+ "elapsed": 0.003367185592651367,
1019
+ "initial": 0,
1020
+ "n": 0,
1021
+ "ncols": null,
1022
+ "nrows": null,
1023
+ "postfix": null,
1024
+ "prefix": "tokenizer.json",
1025
+ "rate": null,
1026
+ "total": 17082734,
1027
+ "unit": "B",
1028
+ "unit_divisor": 1000,
1029
+ "unit_scale": true
1030
+ },
1031
+ "application/vnd.jupyter.widget-view+json": {
1032
+ "model_id": "71db7613c7d347128e7ddb745e1e5f6e",
1033
+ "version_major": 2,
1034
+ "version_minor": 0
1035
+ },
1036
+ "text/plain": [
1037
+ "tokenizer.json: 0%| | 0.00/17.1M [00:00<?, ?B/s]"
1038
+ ]
1039
+ },
1040
+ "metadata": {},
1041
+ "output_type": "display_data"
1042
+ },
1043
+ {
1044
+ "ename": "AttributeError",
1045
+ "evalue": "'CommitInfo' object has no attribute 'push_to_hub'",
1046
+ "output_type": "error",
1047
+ "traceback": [
1048
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
1049
+ "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",
1050
+ "Cell \u001b[0;32mIn[45], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m tokenizer \u001b[38;5;241m=\u001b[39m AutoTokenizer\u001b[38;5;241m.\u001b[39mfrom_pretrained(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mxlm-roberta-large\u001b[39m\u001b[38;5;124m\"\u001b[39m)\u001b[38;5;241m.\u001b[39mpush_to_hub(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnbroad/xlm-roberta-large-2048\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 2\u001b[0m tokenizer\u001b[38;5;241m.\u001b[39mmodel_max_length \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m2048\u001b[39m\n\u001b[0;32m----> 3\u001b[0m \u001b[43mtokenizer\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpush_to_hub\u001b[49m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnbroad/xlm-roberta-large-2048\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
1051
+ "\u001b[0;31mAttributeError\u001b[0m: 'CommitInfo' object has no attribute 'push_to_hub'"
1052
+ ]
1053
+ }
1054
+ ],
1055
+ "source": [
1056
+ "tokenizer = AutoTokenizer.from_pretrained(\"xlm-roberta-large\").push_to_hub(\"nbroad/xlm-roberta-large-2048\")\n",
1057
+ "tokenizer.model_max_length = 2048\n",
1058
+ "tokenizer.push_to_hub(\"nbroad/xlm-roberta-large-2048\")"
1059
+ ]
1060
+ },
1061
+ {
1062
+ "cell_type": "code",
1063
+ "execution_count": null,
1064
+ "id": "f64c2a48-0850-4520-a7bc-f8870f570066",
1065
+ "metadata": {},
1066
+ "outputs": [],
1067
+ "source": []
1068
+ }
1069
+ ],
1070
+ "metadata": {
1071
+ "kernelspec": {
1072
+ "display_name": "Python 3 (ipykernel)",
1073
+ "language": "python",
1074
+ "name": "python3"
1075
+ },
1076
+ "language_info": {
1077
+ "codemirror_mode": {
1078
+ "name": "ipython",
1079
+ "version": 3
1080
+ },
1081
+ "file_extension": ".py",
1082
+ "mimetype": "text/x-python",
1083
+ "name": "python",
1084
+ "nbconvert_exporter": "python",
1085
+ "pygments_lexer": "ipython3",
1086
+ "version": "3.9.5"
1087
+ }
1088
+ },
1089
+ "nbformat": 4,
1090
+ "nbformat_minor": 5
1091
+ }