crumb commited on
Commit
bf60456
1 Parent(s): 0e6ca81

Delete stable_inversion.ipynb

Browse files
Files changed (1) hide show
  1. stable_inversion.ipynb +0 -1714
stable_inversion.ipynb DELETED
@@ -1,1714 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "markdown",
5
- "source": [
6
- "# Trinket! Stable Inversion\n",
7
- "A cheap alternative to finetuning stable diffusion, by [crumb](https://twitter.com/aicrumb)\n",
8
- "\n",
9
- "Finetunes the embedding layer like Textual-Inversion does, but on CLIP Text/Image pairs instead of reconstruction loss from Stable Diffusion. Lower memory requirements + (sometimes) faster than finetuning the traditional way."
10
- ],
11
- "metadata": {
12
- "id": "mSXDq5-qTSF6"
13
- },
14
- "id": "mSXDq5-qTSF6"
15
- },
16
- {
17
- "cell_type": "code",
18
- "source": [
19
- "!pip install git+https://github.com/openai/CLIP -q\n",
20
- "!pip install bitsandbytes -q"
21
- ],
22
- "metadata": {
23
- "id": "yB-XeS51NmI2"
24
- },
25
- "id": "yB-XeS51NmI2",
26
- "execution_count": 1,
27
- "outputs": []
28
- },
29
- {
30
- "cell_type": "code",
31
- "source": [
32
- "import bitsandbytes as bnb\n",
33
- "import torchvision\n",
34
- "from torchvision import transforms\n",
35
- "from tqdm.auto import *\n",
36
- "from torch import nn, optim\n",
37
- "from torch.nn import functional as F\n",
38
- "from PIL import Image\n",
39
- "import requests\n",
40
- "from io import BytesIO\n",
41
- "import torch\n",
42
- "import random\n",
43
- "import clip\n",
44
- "import pandas as pd"
45
- ],
46
- "metadata": {
47
- "id": "x1OogszooEi6",
48
- "colab": {
49
- "base_uri": "https://localhost:8080/"
50
- },
51
- "outputId": "a55a628d-aafc-407e-a2a9-fb03b8a0896a"
52
- },
53
- "id": "x1OogszooEi6",
54
- "execution_count": 2,
55
- "outputs": [
56
- {
57
- "output_type": "stream",
58
- "name": "stdout",
59
- "text": [
60
- "\n",
61
- "===================================BUG REPORT===================================\n",
62
- "Welcome to bitsandbytes. For bug reports, please submit your error trace to: https://github.com/TimDettmers/bitsandbytes/issues\n",
63
- "For effortless bug reporting copy-paste your error into this form: https://docs.google.com/forms/d/e/1FAIpQLScPB8emS3Thkp66nvqwmjTEgxp8Y9ufuWTzFyr9kJ5AoI47dQ/viewform?usp=sf_link\n",
64
- "================================================================================\n",
65
- "CUDA_SETUP: WARNING! libcudart.so not found in any environmental path. Searching /usr/local/cuda/lib64...\n",
66
- "CUDA SETUP: CUDA runtime path found: /usr/local/cuda/lib64/libcudart.so\n",
67
- "CUDA SETUP: Highest compute capability among GPUs detected: 7.5\n",
68
- "CUDA SETUP: Detected CUDA version 111\n",
69
- "CUDA SETUP: Loading binary /usr/local/lib/python3.7/dist-packages/bitsandbytes/libbitsandbytes_cuda111.so...\n"
70
- ]
71
- },
72
- {
73
- "output_type": "stream",
74
- "name": "stderr",
75
- "text": [
76
- "/usr/local/lib/python3.7/dist-packages/bitsandbytes/cuda_setup/paths.py:99: UserWarning: /usr/lib64-nvidia did not contain libcudart.so as expected! Searching further paths...\n",
77
- " f'{candidate_env_vars[\"LD_LIBRARY_PATH\"]} did not contain '\n",
78
- "/usr/local/lib/python3.7/dist-packages/bitsandbytes/cuda_setup/paths.py:21: UserWarning: WARNING: The following directories listed in your path were found to be non-existent: {PosixPath('{\"kernelManagerProxyPort\"'), PosixPath('\"/usr/local/bin/dap_multiplexer\",\"enableLsp\"'), PosixPath('\"172.28.0.3\",\"jupyterArgs\"'), PosixPath('[\"--ip=172.28.0.2\"],\"debugAdapterMultiplexerPath\"'), PosixPath('true}'), PosixPath('6000,\"kernelManagerProxyHost\"')}\n",
79
- " \"WARNING: The following directories listed in your path were found to \"\n",
80
- "/usr/local/lib/python3.7/dist-packages/bitsandbytes/cuda_setup/paths.py:21: UserWarning: WARNING: The following directories listed in your path were found to be non-existent: {PosixPath('/env/python')}\n",
81
- " \"WARNING: The following directories listed in your path were found to \"\n",
82
- "/usr/local/lib/python3.7/dist-packages/bitsandbytes/cuda_setup/paths.py:21: UserWarning: WARNING: The following directories listed in your path were found to be non-existent: {PosixPath('module'), PosixPath('//ipykernel.pylab.backend_inline')}\n",
83
- " \"WARNING: The following directories listed in your path were found to \"\n"
84
- ]
85
- }
86
- ]
87
- },
88
- {
89
- "cell_type": "code",
90
- "execution_count": 3,
91
- "id": "22b6861e-289f-4779-bbf1-40bfd1327823",
92
- "metadata": {
93
- "colab": {
94
- "base_uri": "https://localhost:8080/"
95
- },
96
- "id": "22b6861e-289f-4779-bbf1-40bfd1327823",
97
- "outputId": "fd96d25d-8cbf-43d2-8d5b-983856bf2a3a"
98
- },
99
- "outputs": [
100
- {
101
- "output_type": "stream",
102
- "name": "stdout",
103
- "text": [
104
- "Loaded CLIP\n"
105
- ]
106
- }
107
- ],
108
- "source": [
109
- "# the stable diffusion model uses L/14 by default\n",
110
- "clip_model, _ = clip.load(\"ViT-L/14\", jit=False)\n",
111
- "clip_model = clip_model.cuda()\n",
112
- "print(\"Loaded CLIP\")"
113
- ]
114
- },
115
- {
116
- "cell_type": "code",
117
- "execution_count": 4,
118
- "id": "eaa9bde8-3fdd-48df-aa36-8b88cec285be",
119
- "metadata": {
120
- "id": "eaa9bde8-3fdd-48df-aa36-8b88cec285be"
121
- },
122
- "outputs": [],
123
- "source": [
124
- "bs = 16 # need a large batch size for the contrastive loss to work properly\n",
125
- "steps = 64\n",
126
- "epochs = 4\n",
127
- "lr = 1e-3"
128
- ]
129
- },
130
- {
131
- "cell_type": "code",
132
- "execution_count": 5,
133
- "id": "0667d187-2c3e-40b8-a2fd-b408d5f144c5",
134
- "metadata": {
135
- "colab": {
136
- "base_uri": "https://localhost:8080/",
137
- "height": 206
138
- },
139
- "id": "0667d187-2c3e-40b8-a2fd-b408d5f144c5",
140
- "outputId": "b8f6056a-c2ac-4b89-e222-0d47705617e9"
141
- },
142
- "outputs": [
143
- {
144
- "output_type": "execute_result",
145
- "data": {
146
- "text/plain": [
147
- " Unnamed: 0 url \\\n",
148
- "0 0 https://cdn.donmai.us/original/51/bb/51bb44d69... \n",
149
- "1 1 https://cdn.donmai.us/original/4f/8e/4f8e5eaba... \n",
150
- "2 2 https://cdn.donmai.us/original/c8/54/c85428d89... \n",
151
- "3 3 https://cdn.donmai.us/original/e9/fc/e9fcc788e... \n",
152
- "4 4 https://cdn.donmai.us/original/8a/63/8a639d21b... \n",
153
- "\n",
154
- " prompt \n",
155
- "0 genshin_impact boo_tao_(genshin_impact) hu_tao... \n",
156
- "1 genshin_impact arlecchino_(genshin_impact) cap... \n",
157
- "2 genshin_impact fischl_(ein_immernachtstraum)_(... \n",
158
- "3 genshin_impact eula_(genshin_impact) 1girl :o ... \n",
159
- "4 genshin_impact kuki_shinobu 1girl breasts brid... "
160
- ],
161
- "text/html": [
162
- "\n",
163
- " <div id=\"df-b1359ba3-d298-4260-9864-de09e0a61fd0\">\n",
164
- " <div class=\"colab-df-container\">\n",
165
- " <div>\n",
166
- "<style scoped>\n",
167
- " .dataframe tbody tr th:only-of-type {\n",
168
- " vertical-align: middle;\n",
169
- " }\n",
170
- "\n",
171
- " .dataframe tbody tr th {\n",
172
- " vertical-align: top;\n",
173
- " }\n",
174
- "\n",
175
- " .dataframe thead th {\n",
176
- " text-align: right;\n",
177
- " }\n",
178
- "</style>\n",
179
- "<table border=\"1\" class=\"dataframe\">\n",
180
- " <thead>\n",
181
- " <tr style=\"text-align: right;\">\n",
182
- " <th></th>\n",
183
- " <th>Unnamed: 0</th>\n",
184
- " <th>url</th>\n",
185
- " <th>prompt</th>\n",
186
- " </tr>\n",
187
- " </thead>\n",
188
- " <tbody>\n",
189
- " <tr>\n",
190
- " <th>0</th>\n",
191
- " <td>0</td>\n",
192
- " <td>https://cdn.donmai.us/original/51/bb/51bb44d69...</td>\n",
193
- " <td>genshin_impact boo_tao_(genshin_impact) hu_tao...</td>\n",
194
- " </tr>\n",
195
- " <tr>\n",
196
- " <th>1</th>\n",
197
- " <td>1</td>\n",
198
- " <td>https://cdn.donmai.us/original/4f/8e/4f8e5eaba...</td>\n",
199
- " <td>genshin_impact arlecchino_(genshin_impact) cap...</td>\n",
200
- " </tr>\n",
201
- " <tr>\n",
202
- " <th>2</th>\n",
203
- " <td>2</td>\n",
204
- " <td>https://cdn.donmai.us/original/c8/54/c85428d89...</td>\n",
205
- " <td>genshin_impact fischl_(ein_immernachtstraum)_(...</td>\n",
206
- " </tr>\n",
207
- " <tr>\n",
208
- " <th>3</th>\n",
209
- " <td>3</td>\n",
210
- " <td>https://cdn.donmai.us/original/e9/fc/e9fcc788e...</td>\n",
211
- " <td>genshin_impact eula_(genshin_impact) 1girl :o ...</td>\n",
212
- " </tr>\n",
213
- " <tr>\n",
214
- " <th>4</th>\n",
215
- " <td>4</td>\n",
216
- " <td>https://cdn.donmai.us/original/8a/63/8a639d21b...</td>\n",
217
- " <td>genshin_impact kuki_shinobu 1girl breasts brid...</td>\n",
218
- " </tr>\n",
219
- " </tbody>\n",
220
- "</table>\n",
221
- "</div>\n",
222
- " <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-b1359ba3-d298-4260-9864-de09e0a61fd0')\"\n",
223
- " title=\"Convert this dataframe to an interactive table.\"\n",
224
- " style=\"display:none;\">\n",
225
- " \n",
226
- " <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
227
- " width=\"24px\">\n",
228
- " <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
229
- " <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
230
- " </svg>\n",
231
- " </button>\n",
232
- " \n",
233
- " <style>\n",
234
- " .colab-df-container {\n",
235
- " display:flex;\n",
236
- " flex-wrap:wrap;\n",
237
- " gap: 12px;\n",
238
- " }\n",
239
- "\n",
240
- " .colab-df-convert {\n",
241
- " background-color: #E8F0FE;\n",
242
- " border: none;\n",
243
- " border-radius: 50%;\n",
244
- " cursor: pointer;\n",
245
- " display: none;\n",
246
- " fill: #1967D2;\n",
247
- " height: 32px;\n",
248
- " padding: 0 0 0 0;\n",
249
- " width: 32px;\n",
250
- " }\n",
251
- "\n",
252
- " .colab-df-convert:hover {\n",
253
- " background-color: #E2EBFA;\n",
254
- " box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
255
- " fill: #174EA6;\n",
256
- " }\n",
257
- "\n",
258
- " [theme=dark] .colab-df-convert {\n",
259
- " background-color: #3B4455;\n",
260
- " fill: #D2E3FC;\n",
261
- " }\n",
262
- "\n",
263
- " [theme=dark] .colab-df-convert:hover {\n",
264
- " background-color: #434B5C;\n",
265
- " box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
266
- " filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
267
- " fill: #FFFFFF;\n",
268
- " }\n",
269
- " </style>\n",
270
- "\n",
271
- " <script>\n",
272
- " const buttonEl =\n",
273
- " document.querySelector('#df-b1359ba3-d298-4260-9864-de09e0a61fd0 button.colab-df-convert');\n",
274
- " buttonEl.style.display =\n",
275
- " google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
276
- "\n",
277
- " async function convertToInteractive(key) {\n",
278
- " const element = document.querySelector('#df-b1359ba3-d298-4260-9864-de09e0a61fd0');\n",
279
- " const dataTable =\n",
280
- " await google.colab.kernel.invokeFunction('convertToInteractive',\n",
281
- " [key], {});\n",
282
- " if (!dataTable) return;\n",
283
- "\n",
284
- " const docLinkHtml = 'Like what you see? Visit the ' +\n",
285
- " '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
286
- " + ' to learn more about interactive tables.';\n",
287
- " element.innerHTML = '';\n",
288
- " dataTable['output_type'] = 'display_data';\n",
289
- " await google.colab.output.renderOutput(dataTable, element);\n",
290
- " const docLink = document.createElement('div');\n",
291
- " docLink.innerHTML = docLinkHtml;\n",
292
- " element.appendChild(docLink);\n",
293
- " }\n",
294
- " </script>\n",
295
- " </div>\n",
296
- " </div>\n",
297
- " "
298
- ]
299
- },
300
- "metadata": {},
301
- "execution_count": 5
302
- }
303
- ],
304
- "source": [
305
- "# ultimately you just need >1000 prompt+url pairs in lists named prompts and urls, however you load it is fine\n",
306
- "# this is how i scraped them so this is how i load them\n",
307
- "# you can scrape danbooru/safebooru/others with pybooru with this script from waifu-diffusion https://github.com/harubaru/waifu-diffusion/blob/main/danbooru_data/scrape.py\n",
308
- "df = pd.read_csv(\"/content/genshin.csv\")\n",
309
- "prompts = df['prompt']#[:steps*bs]\n",
310
- "urls = df['url']#[:steps*bs\n",
311
- "df.head()"
312
- ]
313
- },
314
- {
315
- "cell_type": "code",
316
- "source": [
317
- "print(len(prompts))"
318
- ],
319
- "metadata": {
320
- "colab": {
321
- "base_uri": "https://localhost:8080/"
322
- },
323
- "id": "6lYQYqKEZKhv",
324
- "outputId": "7d26b946-ce1e-41ed-abaf-a4efed5d02cc"
325
- },
326
- "id": "6lYQYqKEZKhv",
327
- "execution_count": 6,
328
- "outputs": [
329
- {
330
- "output_type": "stream",
331
- "name": "stdout",
332
- "text": [
333
- "1200\n"
334
- ]
335
- }
336
- ]
337
- },
338
- {
339
- "cell_type": "code",
340
- "execution_count": 7,
341
- "id": "12fce080-73f3-430f-ba2c-99f265316b66",
342
- "metadata": {
343
- "id": "12fce080-73f3-430f-ba2c-99f265316b66"
344
- },
345
- "outputs": [],
346
- "source": [
347
- "clip_model.token_embedding.weight.requires_grad = True\n",
348
- "# opt = optim.Adam([clip_model.token_embedding.weight], lr)\n",
349
- "opt = bnb.optim.AdamW8bit([clip_model.token_embedding.weight], lr)"
350
- ]
351
- },
352
- {
353
- "cell_type": "code",
354
- "execution_count": 8,
355
- "id": "9a4b1696-a8d9-4eea-a8e0-ba372d450619",
356
- "metadata": {
357
- "id": "9a4b1696-a8d9-4eea-a8e0-ba372d450619"
358
- },
359
- "outputs": [],
360
- "source": [
361
- "# functions from another project of mine that's a bit messy\n",
362
- "def fix_to_224(pil_image):\n",
363
- " width, height = pil_image.size\n",
364
- " if width < height:\n",
365
- " new_width = 224\n",
366
- " new_height = int(new_width * height / width)\n",
367
- " else:\n",
368
- " new_height = 224\n",
369
- " new_width = int(new_height * width / height)\n",
370
- " return pil_image.resize((new_width, new_height))\n",
371
- "def to_tensor_and_center_crop(pil_image):\n",
372
- " tensor = torchvision.transforms.functional.to_tensor(pil_image)\n",
373
- " center_crop = torchvision.transforms.functional.center_crop(tensor, (224, 224))\n",
374
- " return center_crop\n",
375
- "def fix(img):\n",
376
- " return to_tensor_and_center_crop(fix_to_224(img))\n",
377
- "\n",
378
- "iter_prompts = iter(prompts)\n",
379
- "iter_urls = iter(urls)\n",
380
- "def get_batch(size=8, step=1, steps_per_epoch=128, epoch=1, total_epochs=1):\n",
381
- " to_tensor = transforms.ToTensor()\n",
382
- " x = []\n",
383
- " y = []\n",
384
- " total_steps = total_epochs*steps_per_epoch\n",
385
- " current_fraction = (epoch*steps_per_epoch-steps_per_epoch+step) / total_steps\n",
386
- "\n",
387
- " while len(x) < size:\n",
388
- " # uncomment these and space the big block right one tab\n",
389
- " # if you're using a set that might have dead urls\n",
390
- " try:\n",
391
- " url = next(iter_urls)\n",
392
- " response = requests.get(url)\n",
393
- " img = Image.open(BytesIO(response.content))\n",
394
- " img = img.convert(\"RGB\")\n",
395
- " img = fix(img)\n",
396
- " x.append(img.unsqueeze(0))\n",
397
- "\n",
398
- " p = next(iter_prompts)\n",
399
- "\n",
400
- " # comment out these lines if you aren't using danbooru tags\n",
401
- " p = p.split(\" \")\n",
402
- " if current_fraction < 0.75: random.shuffle(p)\n",
403
- " if current_fraction > 0.5: # halfway through training, start dropping half of the tags\n",
404
- " p = p[:len(p)//2]\n",
405
- " if current_fraction > 0.75: # 3/4 through training, start dropping 3/4 of the tags\n",
406
- " p = p[:4]\n",
407
- " p = \" \".join(p)\n",
408
- " y.append(p)\n",
409
- " except KeyboardInterrupt:\n",
410
- " print('Interrupted')\n",
411
- " break\n",
412
- " except:\n",
413
- " pass\n",
414
- " \n",
415
- " x = torch.cat(x, 0)\n",
416
- " x = clip_model.encode_image(x.cuda())\n",
417
- " \n",
418
- " y = clip.tokenize(y, truncate=True)\n",
419
- " y = clip_model.encode_text(y.cuda())\n",
420
- " return x, y"
421
- ]
422
- },
423
- {
424
- "cell_type": "code",
425
- "execution_count": null,
426
- "id": "203637dd-441e-4b43-944d-48ffa126e826",
427
- "metadata": {
428
- "colab": {
429
- "base_uri": "https://localhost:8080/",
430
- "height": 182,
431
- "referenced_widgets": [
432
- "cfab11c900c44070b2dc032034b9a65d",
433
- "edf50d7b6e8b475abd9e1ebae7778aba",
434
- "af697a5f975c405190c54d2a349b551c",
435
- "1953f85f00e04cb4bb95acadbb589b12",
436
- "d28248f12d834263a1605afed777077a",
437
- "1b255d9b51cb4dee82e1d14a506bf85e",
438
- "effd6703ac904650a7c02fbac19d1ce9",
439
- "f62a8b3dfedd4500b795e8a9e57ee4e1",
440
- "c2669c5874354798b33d7da9a5d8084d",
441
- "6b085d5276bf42c8b8e6a050de4730c9",
442
- "47347341d5a14564a25e52179187b218",
443
- "39487ee2262647a79ed05bd89413ec25",
444
- "37fd57a2be584e37aade4f200aca564e",
445
- "2daa2d8768f94963b4be13ee5108ec16",
446
- "41d52c3d2db543ac8654f2d79ea72f51",
447
- "cee7cfd5a46a4a86a048e84c9aa6df56",
448
- "365846f3939d49188dd2698ccb4a0c6d",
449
- "fa8cd1c1559248aeb8a920d6a1f7b8ca",
450
- "8d6f469af323498aae3b8c2fd2e4f7de",
451
- "a58aa5c526234c25bd330564a8631310",
452
- "355e7a4bac0f41d1a0a7aba831c1916b",
453
- "d8d127599a964af2b22957e7cadc3949",
454
- "94c994a72e6e47a581ef47eafc4f8621",
455
- "e2409e281b874665bbe830fc5843e4fe",
456
- "c980cbb0b5ba43378c84ea122829e70e",
457
- "08ab7aae4ac341909798caf190c84ada",
458
- "9decfef2a41f42f0a3b77dfaa3a02bac",
459
- "a0f24920a480438381da74562a7f7df1",
460
- "bc4723c3d801406b891f808c84e9e83b",
461
- "c464d7549104481a90f75f3e5b219189",
462
- "d9792cd6d5034352a3a9f2122bb5d9c0",
463
- "8a9c974907c74fe29b6a323df7df0d4d",
464
- "40ae1be859d74847b4f0944c4027e1cf"
465
- ]
466
- },
467
- "id": "203637dd-441e-4b43-944d-48ffa126e826",
468
- "outputId": "4ea5f3da-86fa-4910-d919-fc1ef0d8f007"
469
- },
470
- "outputs": [
471
- {
472
- "output_type": "display_data",
473
- "data": {
474
- "text/plain": [
475
- " 0%| | 0/4 [00:00<?, ?it/s]"
476
- ],
477
- "application/vnd.jupyter.widget-view+json": {
478
- "version_major": 2,
479
- "version_minor": 0,
480
- "model_id": "cfab11c900c44070b2dc032034b9a65d"
481
- }
482
- },
483
- "metadata": {}
484
- },
485
- {
486
- "output_type": "display_data",
487
- "data": {
488
- "text/plain": [
489
- " 0%| | 0/64 [00:00<?, ?it/s]"
490
- ],
491
- "application/vnd.jupyter.widget-view+json": {
492
- "version_major": 2,
493
- "version_minor": 0,
494
- "model_id": "39487ee2262647a79ed05bd89413ec25"
495
- }
496
- },
497
- "metadata": {}
498
- },
499
- {
500
- "output_type": "stream",
501
- "name": "stderr",
502
- "text": [
503
- "/usr/local/lib/python3.7/dist-packages/PIL/Image.py:960: UserWarning: Palette images with Transparency expressed in bytes should be converted to RGBA images\n",
504
- " \"Palette images with Transparency expressed in bytes should be \"\n",
505
- "/usr/local/lib/python3.7/dist-packages/PIL/TiffImagePlugin.py:788: UserWarning: Corrupt EXIF data. Expecting to read 4 bytes but only got 0. \n",
506
- " warnings.warn(str(msg))\n"
507
- ]
508
- },
509
- {
510
- "output_type": "display_data",
511
- "data": {
512
- "text/plain": [
513
- " 0%| | 0/64 [00:00<?, ?it/s]"
514
- ],
515
- "application/vnd.jupyter.widget-view+json": {
516
- "version_major": 2,
517
- "version_minor": 0,
518
- "model_id": "94c994a72e6e47a581ef47eafc4f8621"
519
- }
520
- },
521
- "metadata": {}
522
- }
523
- ],
524
- "source": [
525
- "losses = []\n",
526
- "\n",
527
- "for epoch in trange(epochs):\n",
528
- " pbar = trange(steps)\n",
529
- " iter_prompts = iter(prompts)\n",
530
- " iter_urls = iter(urls)\n",
531
- "\n",
532
- " for i in pbar:\n",
533
- " x, y = get_batch(bs, i, steps, epoch, epochs)\n",
534
- " loss = (x-y).pow(2).mean()\n",
535
- " # loss = spherical_distance_loss(x,y).mean() # TODO: try whatever loss they use in the CLIP paper instead\n",
536
- " loss.backward()\n",
537
- " opt.step()\n",
538
- " opt.zero_grad()\n",
539
- "\n",
540
- " pbar.set_description(str(loss.item()))\n",
541
- " losses.append(loss.item())"
542
- ]
543
- },
544
- {
545
- "cell_type": "code",
546
- "source": [
547
- "import matplotlib.pyplot as plt\n",
548
- "\n",
549
- "# hacky ema plot\n",
550
- "losses_df = pd.DataFrame(losses, columns=['loss'])\n",
551
- "losses_plot = losses_df.ewm(alpha=0.05).mean()['loss']\n",
552
- "plt.plot(losses_plot)\n",
553
- "plt.plot(losses)"
554
- ],
555
- "metadata": {
556
- "id": "J5QkXxh5PI04"
557
- },
558
- "id": "J5QkXxh5PI04",
559
- "execution_count": null,
560
- "outputs": []
561
- },
562
- {
563
- "cell_type": "code",
564
- "source": [
565
- "torch.save(clip_model.token_embedding.weight, \"token_embeddings.pt\")"
566
- ],
567
- "metadata": {
568
- "id": "MdEjBt3hRIRB"
569
- },
570
- "id": "MdEjBt3hRIRB",
571
- "execution_count": null,
572
- "outputs": []
573
- },
574
- {
575
- "cell_type": "code",
576
- "source": [
577
- "#@markdown 🔔\n",
578
- "from google.colab import output\n",
579
- "output.eval_js('new Audio(\"https://freesound.org/data/previews/80/80921_1022651-lq.ogg\").play()')"
580
- ],
581
- "metadata": {
582
- "cellView": "form",
583
- "id": "IU0mqpyVTQzt"
584
- },
585
- "id": "IU0mqpyVTQzt",
586
- "execution_count": null,
587
- "outputs": []
588
- },
589
- {
590
- "cell_type": "markdown",
591
- "source": [
592
- "### Upload to 🤗"
593
- ],
594
- "metadata": {
595
- "id": "E5TP5qjAkTjL"
596
- },
597
- "id": "E5TP5qjAkTjL"
598
- },
599
- {
600
- "cell_type": "code",
601
- "source": [
602
- "#@markdown Log in\n",
603
- "!pip install huggingface-hub -q\n",
604
- "from huggingface_hub import notebook_login\n",
605
- "notebook_login()"
606
- ],
607
- "metadata": {
608
- "id": "bUdMc0o4kBYx",
609
- "cellView": "form"
610
- },
611
- "id": "bUdMc0o4kBYx",
612
- "execution_count": null,
613
- "outputs": []
614
- },
615
- {
616
- "cell_type": "code",
617
- "source": [
618
- "from huggingface_hub import HfApi\n",
619
- "api = HfApi()\n",
620
- "\n",
621
- "#@markdown go ahead and create the repository on 🤗 before running this\n",
622
- "my_repo = \"user/my-stable-inversion\" #@param {type:\"string\"}\n",
623
- "\n",
624
- "api.upload_file(\n",
625
- " path_or_fileobj=\"token_embeddings.pt\",\n",
626
- " path_in_repo=\"token_embeddings.pt\",\n",
627
- " repo_id=my_repo,\n",
628
- " repo_type=\"model\",\n",
629
- ")"
630
- ],
631
- "metadata": {
632
- "id": "WJ30dShA7koO"
633
- },
634
- "id": "WJ30dShA7koO",
635
- "execution_count": null,
636
- "outputs": []
637
- },
638
- {
639
- "cell_type": "markdown",
640
- "source": [
641
- "how you can load the stable inversions into a diffusers-based notebook like [Doohickey](https://github.com/aicrumb/doohickey) might look something like this\n",
642
- "\n",
643
- "```\n",
644
- "from huggingface_hub import hf_hub_download\n",
645
- "\n",
646
- "stable_inversion = \"user/my-stable-inversion\" #@param {type:\"string\"}\n",
647
- "if len(stable_inversion)>1:\n",
648
- " g = hf_hub_download(repo_id=stable_inversion, filename=\"token_embeddings.pt\")\n",
649
- " text_encoder.text_model.embeddings.token_embedding.weight = torch.load(g)\n",
650
- "```"
651
- ],
652
- "metadata": {
653
- "id": "tIKiCVkHkFET"
654
- },
655
- "id": "tIKiCVkHkFET"
656
- }
657
- ],
658
- "metadata": {
659
- "kernelspec": {
660
- "display_name": "Python 3 (ipykernel)",
661
- "language": "python",
662
- "name": "python3"
663
- },
664
- "language_info": {
665
- "codemirror_mode": {
666
- "name": "ipython",
667
- "version": 3
668
- },
669
- "file_extension": ".py",
670
- "mimetype": "text/x-python",
671
- "name": "python",
672
- "nbconvert_exporter": "python",
673
- "pygments_lexer": "ipython3",
674
- "version": "3.10.4"
675
- },
676
- "colab": {
677
- "provenance": [],
678
- "collapsed_sections": []
679
- },
680
- "accelerator": "GPU",
681
- "widgets": {
682
- "application/vnd.jupyter.widget-state+json": {
683
- "cfab11c900c44070b2dc032034b9a65d": {
684
- "model_module": "@jupyter-widgets/controls",
685
- "model_name": "HBoxModel",
686
- "model_module_version": "1.5.0",
687
- "state": {
688
- "_dom_classes": [],
689
- "_model_module": "@jupyter-widgets/controls",
690
- "_model_module_version": "1.5.0",
691
- "_model_name": "HBoxModel",
692
- "_view_count": null,
693
- "_view_module": "@jupyter-widgets/controls",
694
- "_view_module_version": "1.5.0",
695
- "_view_name": "HBoxView",
696
- "box_style": "",
697
- "children": [
698
- "IPY_MODEL_edf50d7b6e8b475abd9e1ebae7778aba",
699
- "IPY_MODEL_af697a5f975c405190c54d2a349b551c",
700
- "IPY_MODEL_1953f85f00e04cb4bb95acadbb589b12"
701
- ],
702
- "layout": "IPY_MODEL_d28248f12d834263a1605afed777077a"
703
- }
704
- },
705
- "edf50d7b6e8b475abd9e1ebae7778aba": {
706
- "model_module": "@jupyter-widgets/controls",
707
- "model_name": "HTMLModel",
708
- "model_module_version": "1.5.0",
709
- "state": {
710
- "_dom_classes": [],
711
- "_model_module": "@jupyter-widgets/controls",
712
- "_model_module_version": "1.5.0",
713
- "_model_name": "HTMLModel",
714
- "_view_count": null,
715
- "_view_module": "@jupyter-widgets/controls",
716
- "_view_module_version": "1.5.0",
717
- "_view_name": "HTMLView",
718
- "description": "",
719
- "description_tooltip": null,
720
- "layout": "IPY_MODEL_1b255d9b51cb4dee82e1d14a506bf85e",
721
- "placeholder": "​",
722
- "style": "IPY_MODEL_effd6703ac904650a7c02fbac19d1ce9",
723
- "value": " 25%"
724
- }
725
- },
726
- "af697a5f975c405190c54d2a349b551c": {
727
- "model_module": "@jupyter-widgets/controls",
728
- "model_name": "FloatProgressModel",
729
- "model_module_version": "1.5.0",
730
- "state": {
731
- "_dom_classes": [],
732
- "_model_module": "@jupyter-widgets/controls",
733
- "_model_module_version": "1.5.0",
734
- "_model_name": "FloatProgressModel",
735
- "_view_count": null,
736
- "_view_module": "@jupyter-widgets/controls",
737
- "_view_module_version": "1.5.0",
738
- "_view_name": "ProgressView",
739
- "bar_style": "",
740
- "description": "",
741
- "description_tooltip": null,
742
- "layout": "IPY_MODEL_f62a8b3dfedd4500b795e8a9e57ee4e1",
743
- "max": 4,
744
- "min": 0,
745
- "orientation": "horizontal",
746
- "style": "IPY_MODEL_c2669c5874354798b33d7da9a5d8084d",
747
- "value": 1
748
- }
749
- },
750
- "1953f85f00e04cb4bb95acadbb589b12": {
751
- "model_module": "@jupyter-widgets/controls",
752
- "model_name": "HTMLModel",
753
- "model_module_version": "1.5.0",
754
- "state": {
755
- "_dom_classes": [],
756
- "_model_module": "@jupyter-widgets/controls",
757
- "_model_module_version": "1.5.0",
758
- "_model_name": "HTMLModel",
759
- "_view_count": null,
760
- "_view_module": "@jupyter-widgets/controls",
761
- "_view_module_version": "1.5.0",
762
- "_view_name": "HTMLView",
763
- "description": "",
764
- "description_tooltip": null,
765
- "layout": "IPY_MODEL_6b085d5276bf42c8b8e6a050de4730c9",
766
- "placeholder": "​",
767
- "style": "IPY_MODEL_47347341d5a14564a25e52179187b218",
768
- "value": " 1/4 [10:02&lt;30:08, 602.73s/it]"
769
- }
770
- },
771
- "d28248f12d834263a1605afed777077a": {
772
- "model_module": "@jupyter-widgets/base",
773
- "model_name": "LayoutModel",
774
- "model_module_version": "1.2.0",
775
- "state": {
776
- "_model_module": "@jupyter-widgets/base",
777
- "_model_module_version": "1.2.0",
778
- "_model_name": "LayoutModel",
779
- "_view_count": null,
780
- "_view_module": "@jupyter-widgets/base",
781
- "_view_module_version": "1.2.0",
782
- "_view_name": "LayoutView",
783
- "align_content": null,
784
- "align_items": null,
785
- "align_self": null,
786
- "border": null,
787
- "bottom": null,
788
- "display": null,
789
- "flex": null,
790
- "flex_flow": null,
791
- "grid_area": null,
792
- "grid_auto_columns": null,
793
- "grid_auto_flow": null,
794
- "grid_auto_rows": null,
795
- "grid_column": null,
796
- "grid_gap": null,
797
- "grid_row": null,
798
- "grid_template_areas": null,
799
- "grid_template_columns": null,
800
- "grid_template_rows": null,
801
- "height": null,
802
- "justify_content": null,
803
- "justify_items": null,
804
- "left": null,
805
- "margin": null,
806
- "max_height": null,
807
- "max_width": null,
808
- "min_height": null,
809
- "min_width": null,
810
- "object_fit": null,
811
- "object_position": null,
812
- "order": null,
813
- "overflow": null,
814
- "overflow_x": null,
815
- "overflow_y": null,
816
- "padding": null,
817
- "right": null,
818
- "top": null,
819
- "visibility": null,
820
- "width": null
821
- }
822
- },
823
- "1b255d9b51cb4dee82e1d14a506bf85e": {
824
- "model_module": "@jupyter-widgets/base",
825
- "model_name": "LayoutModel",
826
- "model_module_version": "1.2.0",
827
- "state": {
828
- "_model_module": "@jupyter-widgets/base",
829
- "_model_module_version": "1.2.0",
830
- "_model_name": "LayoutModel",
831
- "_view_count": null,
832
- "_view_module": "@jupyter-widgets/base",
833
- "_view_module_version": "1.2.0",
834
- "_view_name": "LayoutView",
835
- "align_content": null,
836
- "align_items": null,
837
- "align_self": null,
838
- "border": null,
839
- "bottom": null,
840
- "display": null,
841
- "flex": null,
842
- "flex_flow": null,
843
- "grid_area": null,
844
- "grid_auto_columns": null,
845
- "grid_auto_flow": null,
846
- "grid_auto_rows": null,
847
- "grid_column": null,
848
- "grid_gap": null,
849
- "grid_row": null,
850
- "grid_template_areas": null,
851
- "grid_template_columns": null,
852
- "grid_template_rows": null,
853
- "height": null,
854
- "justify_content": null,
855
- "justify_items": null,
856
- "left": null,
857
- "margin": null,
858
- "max_height": null,
859
- "max_width": null,
860
- "min_height": null,
861
- "min_width": null,
862
- "object_fit": null,
863
- "object_position": null,
864
- "order": null,
865
- "overflow": null,
866
- "overflow_x": null,
867
- "overflow_y": null,
868
- "padding": null,
869
- "right": null,
870
- "top": null,
871
- "visibility": null,
872
- "width": null
873
- }
874
- },
875
- "effd6703ac904650a7c02fbac19d1ce9": {
876
- "model_module": "@jupyter-widgets/controls",
877
- "model_name": "DescriptionStyleModel",
878
- "model_module_version": "1.5.0",
879
- "state": {
880
- "_model_module": "@jupyter-widgets/controls",
881
- "_model_module_version": "1.5.0",
882
- "_model_name": "DescriptionStyleModel",
883
- "_view_count": null,
884
- "_view_module": "@jupyter-widgets/base",
885
- "_view_module_version": "1.2.0",
886
- "_view_name": "StyleView",
887
- "description_width": ""
888
- }
889
- },
890
- "f62a8b3dfedd4500b795e8a9e57ee4e1": {
891
- "model_module": "@jupyter-widgets/base",
892
- "model_name": "LayoutModel",
893
- "model_module_version": "1.2.0",
894
- "state": {
895
- "_model_module": "@jupyter-widgets/base",
896
- "_model_module_version": "1.2.0",
897
- "_model_name": "LayoutModel",
898
- "_view_count": null,
899
- "_view_module": "@jupyter-widgets/base",
900
- "_view_module_version": "1.2.0",
901
- "_view_name": "LayoutView",
902
- "align_content": null,
903
- "align_items": null,
904
- "align_self": null,
905
- "border": null,
906
- "bottom": null,
907
- "display": null,
908
- "flex": null,
909
- "flex_flow": null,
910
- "grid_area": null,
911
- "grid_auto_columns": null,
912
- "grid_auto_flow": null,
913
- "grid_auto_rows": null,
914
- "grid_column": null,
915
- "grid_gap": null,
916
- "grid_row": null,
917
- "grid_template_areas": null,
918
- "grid_template_columns": null,
919
- "grid_template_rows": null,
920
- "height": null,
921
- "justify_content": null,
922
- "justify_items": null,
923
- "left": null,
924
- "margin": null,
925
- "max_height": null,
926
- "max_width": null,
927
- "min_height": null,
928
- "min_width": null,
929
- "object_fit": null,
930
- "object_position": null,
931
- "order": null,
932
- "overflow": null,
933
- "overflow_x": null,
934
- "overflow_y": null,
935
- "padding": null,
936
- "right": null,
937
- "top": null,
938
- "visibility": null,
939
- "width": null
940
- }
941
- },
942
- "c2669c5874354798b33d7da9a5d8084d": {
943
- "model_module": "@jupyter-widgets/controls",
944
- "model_name": "ProgressStyleModel",
945
- "model_module_version": "1.5.0",
946
- "state": {
947
- "_model_module": "@jupyter-widgets/controls",
948
- "_model_module_version": "1.5.0",
949
- "_model_name": "ProgressStyleModel",
950
- "_view_count": null,
951
- "_view_module": "@jupyter-widgets/base",
952
- "_view_module_version": "1.2.0",
953
- "_view_name": "StyleView",
954
- "bar_color": null,
955
- "description_width": ""
956
- }
957
- },
958
- "6b085d5276bf42c8b8e6a050de4730c9": {
959
- "model_module": "@jupyter-widgets/base",
960
- "model_name": "LayoutModel",
961
- "model_module_version": "1.2.0",
962
- "state": {
963
- "_model_module": "@jupyter-widgets/base",
964
- "_model_module_version": "1.2.0",
965
- "_model_name": "LayoutModel",
966
- "_view_count": null,
967
- "_view_module": "@jupyter-widgets/base",
968
- "_view_module_version": "1.2.0",
969
- "_view_name": "LayoutView",
970
- "align_content": null,
971
- "align_items": null,
972
- "align_self": null,
973
- "border": null,
974
- "bottom": null,
975
- "display": null,
976
- "flex": null,
977
- "flex_flow": null,
978
- "grid_area": null,
979
- "grid_auto_columns": null,
980
- "grid_auto_flow": null,
981
- "grid_auto_rows": null,
982
- "grid_column": null,
983
- "grid_gap": null,
984
- "grid_row": null,
985
- "grid_template_areas": null,
986
- "grid_template_columns": null,
987
- "grid_template_rows": null,
988
- "height": null,
989
- "justify_content": null,
990
- "justify_items": null,
991
- "left": null,
992
- "margin": null,
993
- "max_height": null,
994
- "max_width": null,
995
- "min_height": null,
996
- "min_width": null,
997
- "object_fit": null,
998
- "object_position": null,
999
- "order": null,
1000
- "overflow": null,
1001
- "overflow_x": null,
1002
- "overflow_y": null,
1003
- "padding": null,
1004
- "right": null,
1005
- "top": null,
1006
- "visibility": null,
1007
- "width": null
1008
- }
1009
- },
1010
- "47347341d5a14564a25e52179187b218": {
1011
- "model_module": "@jupyter-widgets/controls",
1012
- "model_name": "DescriptionStyleModel",
1013
- "model_module_version": "1.5.0",
1014
- "state": {
1015
- "_model_module": "@jupyter-widgets/controls",
1016
- "_model_module_version": "1.5.0",
1017
- "_model_name": "DescriptionStyleModel",
1018
- "_view_count": null,
1019
- "_view_module": "@jupyter-widgets/base",
1020
- "_view_module_version": "1.2.0",
1021
- "_view_name": "StyleView",
1022
- "description_width": ""
1023
- }
1024
- },
1025
- "39487ee2262647a79ed05bd89413ec25": {
1026
- "model_module": "@jupyter-widgets/controls",
1027
- "model_name": "HBoxModel",
1028
- "model_module_version": "1.5.0",
1029
- "state": {
1030
- "_dom_classes": [],
1031
- "_model_module": "@jupyter-widgets/controls",
1032
- "_model_module_version": "1.5.0",
1033
- "_model_name": "HBoxModel",
1034
- "_view_count": null,
1035
- "_view_module": "@jupyter-widgets/controls",
1036
- "_view_module_version": "1.5.0",
1037
- "_view_name": "HBoxView",
1038
- "box_style": "",
1039
- "children": [
1040
- "IPY_MODEL_37fd57a2be584e37aade4f200aca564e",
1041
- "IPY_MODEL_2daa2d8768f94963b4be13ee5108ec16",
1042
- "IPY_MODEL_41d52c3d2db543ac8654f2d79ea72f51"
1043
- ],
1044
- "layout": "IPY_MODEL_cee7cfd5a46a4a86a048e84c9aa6df56"
1045
- }
1046
- },
1047
- "37fd57a2be584e37aade4f200aca564e": {
1048
- "model_module": "@jupyter-widgets/controls",
1049
- "model_name": "HTMLModel",
1050
- "model_module_version": "1.5.0",
1051
- "state": {
1052
- "_dom_classes": [],
1053
- "_model_module": "@jupyter-widgets/controls",
1054
- "_model_module_version": "1.5.0",
1055
- "_model_name": "HTMLModel",
1056
- "_view_count": null,
1057
- "_view_module": "@jupyter-widgets/controls",
1058
- "_view_module_version": "1.5.0",
1059
- "_view_name": "HTMLView",
1060
- "description": "",
1061
- "description_tooltip": null,
1062
- "layout": "IPY_MODEL_365846f3939d49188dd2698ccb4a0c6d",
1063
- "placeholder": "​",
1064
- "style": "IPY_MODEL_fa8cd1c1559248aeb8a920d6a1f7b8ca",
1065
- "value": "0.277587890625: 100%"
1066
- }
1067
- },
1068
- "2daa2d8768f94963b4be13ee5108ec16": {
1069
- "model_module": "@jupyter-widgets/controls",
1070
- "model_name": "FloatProgressModel",
1071
- "model_module_version": "1.5.0",
1072
- "state": {
1073
- "_dom_classes": [],
1074
- "_model_module": "@jupyter-widgets/controls",
1075
- "_model_module_version": "1.5.0",
1076
- "_model_name": "FloatProgressModel",
1077
- "_view_count": null,
1078
- "_view_module": "@jupyter-widgets/controls",
1079
- "_view_module_version": "1.5.0",
1080
- "_view_name": "ProgressView",
1081
- "bar_style": "success",
1082
- "description": "",
1083
- "description_tooltip": null,
1084
- "layout": "IPY_MODEL_8d6f469af323498aae3b8c2fd2e4f7de",
1085
- "max": 64,
1086
- "min": 0,
1087
- "orientation": "horizontal",
1088
- "style": "IPY_MODEL_a58aa5c526234c25bd330564a8631310",
1089
- "value": 64
1090
- }
1091
- },
1092
- "41d52c3d2db543ac8654f2d79ea72f51": {
1093
- "model_module": "@jupyter-widgets/controls",
1094
- "model_name": "HTMLModel",
1095
- "model_module_version": "1.5.0",
1096
- "state": {
1097
- "_dom_classes": [],
1098
- "_model_module": "@jupyter-widgets/controls",
1099
- "_model_module_version": "1.5.0",
1100
- "_model_name": "HTMLModel",
1101
- "_view_count": null,
1102
- "_view_module": "@jupyter-widgets/controls",
1103
- "_view_module_version": "1.5.0",
1104
- "_view_name": "HTMLView",
1105
- "description": "",
1106
- "description_tooltip": null,
1107
- "layout": "IPY_MODEL_355e7a4bac0f41d1a0a7aba831c1916b",
1108
- "placeholder": "​",
1109
- "style": "IPY_MODEL_d8d127599a964af2b22957e7cadc3949",
1110
- "value": " 64/64 [10:02&lt;00:00, 9.10s/it]"
1111
- }
1112
- },
1113
- "cee7cfd5a46a4a86a048e84c9aa6df56": {
1114
- "model_module": "@jupyter-widgets/base",
1115
- "model_name": "LayoutModel",
1116
- "model_module_version": "1.2.0",
1117
- "state": {
1118
- "_model_module": "@jupyter-widgets/base",
1119
- "_model_module_version": "1.2.0",
1120
- "_model_name": "LayoutModel",
1121
- "_view_count": null,
1122
- "_view_module": "@jupyter-widgets/base",
1123
- "_view_module_version": "1.2.0",
1124
- "_view_name": "LayoutView",
1125
- "align_content": null,
1126
- "align_items": null,
1127
- "align_self": null,
1128
- "border": null,
1129
- "bottom": null,
1130
- "display": null,
1131
- "flex": null,
1132
- "flex_flow": null,
1133
- "grid_area": null,
1134
- "grid_auto_columns": null,
1135
- "grid_auto_flow": null,
1136
- "grid_auto_rows": null,
1137
- "grid_column": null,
1138
- "grid_gap": null,
1139
- "grid_row": null,
1140
- "grid_template_areas": null,
1141
- "grid_template_columns": null,
1142
- "grid_template_rows": null,
1143
- "height": null,
1144
- "justify_content": null,
1145
- "justify_items": null,
1146
- "left": null,
1147
- "margin": null,
1148
- "max_height": null,
1149
- "max_width": null,
1150
- "min_height": null,
1151
- "min_width": null,
1152
- "object_fit": null,
1153
- "object_position": null,
1154
- "order": null,
1155
- "overflow": null,
1156
- "overflow_x": null,
1157
- "overflow_y": null,
1158
- "padding": null,
1159
- "right": null,
1160
- "top": null,
1161
- "visibility": null,
1162
- "width": null
1163
- }
1164
- },
1165
- "365846f3939d49188dd2698ccb4a0c6d": {
1166
- "model_module": "@jupyter-widgets/base",
1167
- "model_name": "LayoutModel",
1168
- "model_module_version": "1.2.0",
1169
- "state": {
1170
- "_model_module": "@jupyter-widgets/base",
1171
- "_model_module_version": "1.2.0",
1172
- "_model_name": "LayoutModel",
1173
- "_view_count": null,
1174
- "_view_module": "@jupyter-widgets/base",
1175
- "_view_module_version": "1.2.0",
1176
- "_view_name": "LayoutView",
1177
- "align_content": null,
1178
- "align_items": null,
1179
- "align_self": null,
1180
- "border": null,
1181
- "bottom": null,
1182
- "display": null,
1183
- "flex": null,
1184
- "flex_flow": null,
1185
- "grid_area": null,
1186
- "grid_auto_columns": null,
1187
- "grid_auto_flow": null,
1188
- "grid_auto_rows": null,
1189
- "grid_column": null,
1190
- "grid_gap": null,
1191
- "grid_row": null,
1192
- "grid_template_areas": null,
1193
- "grid_template_columns": null,
1194
- "grid_template_rows": null,
1195
- "height": null,
1196
- "justify_content": null,
1197
- "justify_items": null,
1198
- "left": null,
1199
- "margin": null,
1200
- "max_height": null,
1201
- "max_width": null,
1202
- "min_height": null,
1203
- "min_width": null,
1204
- "object_fit": null,
1205
- "object_position": null,
1206
- "order": null,
1207
- "overflow": null,
1208
- "overflow_x": null,
1209
- "overflow_y": null,
1210
- "padding": null,
1211
- "right": null,
1212
- "top": null,
1213
- "visibility": null,
1214
- "width": null
1215
- }
1216
- },
1217
- "fa8cd1c1559248aeb8a920d6a1f7b8ca": {
1218
- "model_module": "@jupyter-widgets/controls",
1219
- "model_name": "DescriptionStyleModel",
1220
- "model_module_version": "1.5.0",
1221
- "state": {
1222
- "_model_module": "@jupyter-widgets/controls",
1223
- "_model_module_version": "1.5.0",
1224
- "_model_name": "DescriptionStyleModel",
1225
- "_view_count": null,
1226
- "_view_module": "@jupyter-widgets/base",
1227
- "_view_module_version": "1.2.0",
1228
- "_view_name": "StyleView",
1229
- "description_width": ""
1230
- }
1231
- },
1232
- "8d6f469af323498aae3b8c2fd2e4f7de": {
1233
- "model_module": "@jupyter-widgets/base",
1234
- "model_name": "LayoutModel",
1235
- "model_module_version": "1.2.0",
1236
- "state": {
1237
- "_model_module": "@jupyter-widgets/base",
1238
- "_model_module_version": "1.2.0",
1239
- "_model_name": "LayoutModel",
1240
- "_view_count": null,
1241
- "_view_module": "@jupyter-widgets/base",
1242
- "_view_module_version": "1.2.0",
1243
- "_view_name": "LayoutView",
1244
- "align_content": null,
1245
- "align_items": null,
1246
- "align_self": null,
1247
- "border": null,
1248
- "bottom": null,
1249
- "display": null,
1250
- "flex": null,
1251
- "flex_flow": null,
1252
- "grid_area": null,
1253
- "grid_auto_columns": null,
1254
- "grid_auto_flow": null,
1255
- "grid_auto_rows": null,
1256
- "grid_column": null,
1257
- "grid_gap": null,
1258
- "grid_row": null,
1259
- "grid_template_areas": null,
1260
- "grid_template_columns": null,
1261
- "grid_template_rows": null,
1262
- "height": null,
1263
- "justify_content": null,
1264
- "justify_items": null,
1265
- "left": null,
1266
- "margin": null,
1267
- "max_height": null,
1268
- "max_width": null,
1269
- "min_height": null,
1270
- "min_width": null,
1271
- "object_fit": null,
1272
- "object_position": null,
1273
- "order": null,
1274
- "overflow": null,
1275
- "overflow_x": null,
1276
- "overflow_y": null,
1277
- "padding": null,
1278
- "right": null,
1279
- "top": null,
1280
- "visibility": null,
1281
- "width": null
1282
- }
1283
- },
1284
- "a58aa5c526234c25bd330564a8631310": {
1285
- "model_module": "@jupyter-widgets/controls",
1286
- "model_name": "ProgressStyleModel",
1287
- "model_module_version": "1.5.0",
1288
- "state": {
1289
- "_model_module": "@jupyter-widgets/controls",
1290
- "_model_module_version": "1.5.0",
1291
- "_model_name": "ProgressStyleModel",
1292
- "_view_count": null,
1293
- "_view_module": "@jupyter-widgets/base",
1294
- "_view_module_version": "1.2.0",
1295
- "_view_name": "StyleView",
1296
- "bar_color": null,
1297
- "description_width": ""
1298
- }
1299
- },
1300
- "355e7a4bac0f41d1a0a7aba831c1916b": {
1301
- "model_module": "@jupyter-widgets/base",
1302
- "model_name": "LayoutModel",
1303
- "model_module_version": "1.2.0",
1304
- "state": {
1305
- "_model_module": "@jupyter-widgets/base",
1306
- "_model_module_version": "1.2.0",
1307
- "_model_name": "LayoutModel",
1308
- "_view_count": null,
1309
- "_view_module": "@jupyter-widgets/base",
1310
- "_view_module_version": "1.2.0",
1311
- "_view_name": "LayoutView",
1312
- "align_content": null,
1313
- "align_items": null,
1314
- "align_self": null,
1315
- "border": null,
1316
- "bottom": null,
1317
- "display": null,
1318
- "flex": null,
1319
- "flex_flow": null,
1320
- "grid_area": null,
1321
- "grid_auto_columns": null,
1322
- "grid_auto_flow": null,
1323
- "grid_auto_rows": null,
1324
- "grid_column": null,
1325
- "grid_gap": null,
1326
- "grid_row": null,
1327
- "grid_template_areas": null,
1328
- "grid_template_columns": null,
1329
- "grid_template_rows": null,
1330
- "height": null,
1331
- "justify_content": null,
1332
- "justify_items": null,
1333
- "left": null,
1334
- "margin": null,
1335
- "max_height": null,
1336
- "max_width": null,
1337
- "min_height": null,
1338
- "min_width": null,
1339
- "object_fit": null,
1340
- "object_position": null,
1341
- "order": null,
1342
- "overflow": null,
1343
- "overflow_x": null,
1344
- "overflow_y": null,
1345
- "padding": null,
1346
- "right": null,
1347
- "top": null,
1348
- "visibility": null,
1349
- "width": null
1350
- }
1351
- },
1352
- "d8d127599a964af2b22957e7cadc3949": {
1353
- "model_module": "@jupyter-widgets/controls",
1354
- "model_name": "DescriptionStyleModel",
1355
- "model_module_version": "1.5.0",
1356
- "state": {
1357
- "_model_module": "@jupyter-widgets/controls",
1358
- "_model_module_version": "1.5.0",
1359
- "_model_name": "DescriptionStyleModel",
1360
- "_view_count": null,
1361
- "_view_module": "@jupyter-widgets/base",
1362
- "_view_module_version": "1.2.0",
1363
- "_view_name": "StyleView",
1364
- "description_width": ""
1365
- }
1366
- },
1367
- "94c994a72e6e47a581ef47eafc4f8621": {
1368
- "model_module": "@jupyter-widgets/controls",
1369
- "model_name": "HBoxModel",
1370
- "model_module_version": "1.5.0",
1371
- "state": {
1372
- "_dom_classes": [],
1373
- "_model_module": "@jupyter-widgets/controls",
1374
- "_model_module_version": "1.5.0",
1375
- "_model_name": "HBoxModel",
1376
- "_view_count": null,
1377
- "_view_module": "@jupyter-widgets/controls",
1378
- "_view_module_version": "1.5.0",
1379
- "_view_name": "HBoxView",
1380
- "box_style": "",
1381
- "children": [
1382
- "IPY_MODEL_e2409e281b874665bbe830fc5843e4fe",
1383
- "IPY_MODEL_c980cbb0b5ba43378c84ea122829e70e",
1384
- "IPY_MODEL_08ab7aae4ac341909798caf190c84ada"
1385
- ],
1386
- "layout": "IPY_MODEL_9decfef2a41f42f0a3b77dfaa3a02bac"
1387
- }
1388
- },
1389
- "e2409e281b874665bbe830fc5843e4fe": {
1390
- "model_module": "@jupyter-widgets/controls",
1391
- "model_name": "HTMLModel",
1392
- "model_module_version": "1.5.0",
1393
- "state": {
1394
- "_dom_classes": [],
1395
- "_model_module": "@jupyter-widgets/controls",
1396
- "_model_module_version": "1.5.0",
1397
- "_model_name": "HTMLModel",
1398
- "_view_count": null,
1399
- "_view_module": "@jupyter-widgets/controls",
1400
- "_view_module_version": "1.5.0",
1401
- "_view_name": "HTMLView",
1402
- "description": "",
1403
- "description_tooltip": null,
1404
- "layout": "IPY_MODEL_a0f24920a480438381da74562a7f7df1",
1405
- "placeholder": "​",
1406
- "style": "IPY_MODEL_bc4723c3d801406b891f808c84e9e83b",
1407
- "value": "0.261962890625: 80%"
1408
- }
1409
- },
1410
- "c980cbb0b5ba43378c84ea122829e70e": {
1411
- "model_module": "@jupyter-widgets/controls",
1412
- "model_name": "FloatProgressModel",
1413
- "model_module_version": "1.5.0",
1414
- "state": {
1415
- "_dom_classes": [],
1416
- "_model_module": "@jupyter-widgets/controls",
1417
- "_model_module_version": "1.5.0",
1418
- "_model_name": "FloatProgressModel",
1419
- "_view_count": null,
1420
- "_view_module": "@jupyter-widgets/controls",
1421
- "_view_module_version": "1.5.0",
1422
- "_view_name": "ProgressView",
1423
- "bar_style": "",
1424
- "description": "",
1425
- "description_tooltip": null,
1426
- "layout": "IPY_MODEL_c464d7549104481a90f75f3e5b219189",
1427
- "max": 64,
1428
- "min": 0,
1429
- "orientation": "horizontal",
1430
- "style": "IPY_MODEL_d9792cd6d5034352a3a9f2122bb5d9c0",
1431
- "value": 51
1432
- }
1433
- },
1434
- "08ab7aae4ac341909798caf190c84ada": {
1435
- "model_module": "@jupyter-widgets/controls",
1436
- "model_name": "HTMLModel",
1437
- "model_module_version": "1.5.0",
1438
- "state": {
1439
- "_dom_classes": [],
1440
- "_model_module": "@jupyter-widgets/controls",
1441
- "_model_module_version": "1.5.0",
1442
- "_model_name": "HTMLModel",
1443
- "_view_count": null,
1444
- "_view_module": "@jupyter-widgets/controls",
1445
- "_view_module_version": "1.5.0",
1446
- "_view_name": "HTMLView",
1447
- "description": "",
1448
- "description_tooltip": null,
1449
- "layout": "IPY_MODEL_8a9c974907c74fe29b6a323df7df0d4d",
1450
- "placeholder": "​",
1451
- "style": "IPY_MODEL_40ae1be859d74847b4f0944c4027e1cf",
1452
- "value": " 51/64 [07:22&lt;02:13, 10.29s/it]"
1453
- }
1454
- },
1455
- "9decfef2a41f42f0a3b77dfaa3a02bac": {
1456
- "model_module": "@jupyter-widgets/base",
1457
- "model_name": "LayoutModel",
1458
- "model_module_version": "1.2.0",
1459
- "state": {
1460
- "_model_module": "@jupyter-widgets/base",
1461
- "_model_module_version": "1.2.0",
1462
- "_model_name": "LayoutModel",
1463
- "_view_count": null,
1464
- "_view_module": "@jupyter-widgets/base",
1465
- "_view_module_version": "1.2.0",
1466
- "_view_name": "LayoutView",
1467
- "align_content": null,
1468
- "align_items": null,
1469
- "align_self": null,
1470
- "border": null,
1471
- "bottom": null,
1472
- "display": null,
1473
- "flex": null,
1474
- "flex_flow": null,
1475
- "grid_area": null,
1476
- "grid_auto_columns": null,
1477
- "grid_auto_flow": null,
1478
- "grid_auto_rows": null,
1479
- "grid_column": null,
1480
- "grid_gap": null,
1481
- "grid_row": null,
1482
- "grid_template_areas": null,
1483
- "grid_template_columns": null,
1484
- "grid_template_rows": null,
1485
- "height": null,
1486
- "justify_content": null,
1487
- "justify_items": null,
1488
- "left": null,
1489
- "margin": null,
1490
- "max_height": null,
1491
- "max_width": null,
1492
- "min_height": null,
1493
- "min_width": null,
1494
- "object_fit": null,
1495
- "object_position": null,
1496
- "order": null,
1497
- "overflow": null,
1498
- "overflow_x": null,
1499
- "overflow_y": null,
1500
- "padding": null,
1501
- "right": null,
1502
- "top": null,
1503
- "visibility": null,
1504
- "width": null
1505
- }
1506
- },
1507
- "a0f24920a480438381da74562a7f7df1": {
1508
- "model_module": "@jupyter-widgets/base",
1509
- "model_name": "LayoutModel",
1510
- "model_module_version": "1.2.0",
1511
- "state": {
1512
- "_model_module": "@jupyter-widgets/base",
1513
- "_model_module_version": "1.2.0",
1514
- "_model_name": "LayoutModel",
1515
- "_view_count": null,
1516
- "_view_module": "@jupyter-widgets/base",
1517
- "_view_module_version": "1.2.0",
1518
- "_view_name": "LayoutView",
1519
- "align_content": null,
1520
- "align_items": null,
1521
- "align_self": null,
1522
- "border": null,
1523
- "bottom": null,
1524
- "display": null,
1525
- "flex": null,
1526
- "flex_flow": null,
1527
- "grid_area": null,
1528
- "grid_auto_columns": null,
1529
- "grid_auto_flow": null,
1530
- "grid_auto_rows": null,
1531
- "grid_column": null,
1532
- "grid_gap": null,
1533
- "grid_row": null,
1534
- "grid_template_areas": null,
1535
- "grid_template_columns": null,
1536
- "grid_template_rows": null,
1537
- "height": null,
1538
- "justify_content": null,
1539
- "justify_items": null,
1540
- "left": null,
1541
- "margin": null,
1542
- "max_height": null,
1543
- "max_width": null,
1544
- "min_height": null,
1545
- "min_width": null,
1546
- "object_fit": null,
1547
- "object_position": null,
1548
- "order": null,
1549
- "overflow": null,
1550
- "overflow_x": null,
1551
- "overflow_y": null,
1552
- "padding": null,
1553
- "right": null,
1554
- "top": null,
1555
- "visibility": null,
1556
- "width": null
1557
- }
1558
- },
1559
- "bc4723c3d801406b891f808c84e9e83b": {
1560
- "model_module": "@jupyter-widgets/controls",
1561
- "model_name": "DescriptionStyleModel",
1562
- "model_module_version": "1.5.0",
1563
- "state": {
1564
- "_model_module": "@jupyter-widgets/controls",
1565
- "_model_module_version": "1.5.0",
1566
- "_model_name": "DescriptionStyleModel",
1567
- "_view_count": null,
1568
- "_view_module": "@jupyter-widgets/base",
1569
- "_view_module_version": "1.2.0",
1570
- "_view_name": "StyleView",
1571
- "description_width": ""
1572
- }
1573
- },
1574
- "c464d7549104481a90f75f3e5b219189": {
1575
- "model_module": "@jupyter-widgets/base",
1576
- "model_name": "LayoutModel",
1577
- "model_module_version": "1.2.0",
1578
- "state": {
1579
- "_model_module": "@jupyter-widgets/base",
1580
- "_model_module_version": "1.2.0",
1581
- "_model_name": "LayoutModel",
1582
- "_view_count": null,
1583
- "_view_module": "@jupyter-widgets/base",
1584
- "_view_module_version": "1.2.0",
1585
- "_view_name": "LayoutView",
1586
- "align_content": null,
1587
- "align_items": null,
1588
- "align_self": null,
1589
- "border": null,
1590
- "bottom": null,
1591
- "display": null,
1592
- "flex": null,
1593
- "flex_flow": null,
1594
- "grid_area": null,
1595
- "grid_auto_columns": null,
1596
- "grid_auto_flow": null,
1597
- "grid_auto_rows": null,
1598
- "grid_column": null,
1599
- "grid_gap": null,
1600
- "grid_row": null,
1601
- "grid_template_areas": null,
1602
- "grid_template_columns": null,
1603
- "grid_template_rows": null,
1604
- "height": null,
1605
- "justify_content": null,
1606
- "justify_items": null,
1607
- "left": null,
1608
- "margin": null,
1609
- "max_height": null,
1610
- "max_width": null,
1611
- "min_height": null,
1612
- "min_width": null,
1613
- "object_fit": null,
1614
- "object_position": null,
1615
- "order": null,
1616
- "overflow": null,
1617
- "overflow_x": null,
1618
- "overflow_y": null,
1619
- "padding": null,
1620
- "right": null,
1621
- "top": null,
1622
- "visibility": null,
1623
- "width": null
1624
- }
1625
- },
1626
- "d9792cd6d5034352a3a9f2122bb5d9c0": {
1627
- "model_module": "@jupyter-widgets/controls",
1628
- "model_name": "ProgressStyleModel",
1629
- "model_module_version": "1.5.0",
1630
- "state": {
1631
- "_model_module": "@jupyter-widgets/controls",
1632
- "_model_module_version": "1.5.0",
1633
- "_model_name": "ProgressStyleModel",
1634
- "_view_count": null,
1635
- "_view_module": "@jupyter-widgets/base",
1636
- "_view_module_version": "1.2.0",
1637
- "_view_name": "StyleView",
1638
- "bar_color": null,
1639
- "description_width": ""
1640
- }
1641
- },
1642
- "8a9c974907c74fe29b6a323df7df0d4d": {
1643
- "model_module": "@jupyter-widgets/base",
1644
- "model_name": "LayoutModel",
1645
- "model_module_version": "1.2.0",
1646
- "state": {
1647
- "_model_module": "@jupyter-widgets/base",
1648
- "_model_module_version": "1.2.0",
1649
- "_model_name": "LayoutModel",
1650
- "_view_count": null,
1651
- "_view_module": "@jupyter-widgets/base",
1652
- "_view_module_version": "1.2.0",
1653
- "_view_name": "LayoutView",
1654
- "align_content": null,
1655
- "align_items": null,
1656
- "align_self": null,
1657
- "border": null,
1658
- "bottom": null,
1659
- "display": null,
1660
- "flex": null,
1661
- "flex_flow": null,
1662
- "grid_area": null,
1663
- "grid_auto_columns": null,
1664
- "grid_auto_flow": null,
1665
- "grid_auto_rows": null,
1666
- "grid_column": null,
1667
- "grid_gap": null,
1668
- "grid_row": null,
1669
- "grid_template_areas": null,
1670
- "grid_template_columns": null,
1671
- "grid_template_rows": null,
1672
- "height": null,
1673
- "justify_content": null,
1674
- "justify_items": null,
1675
- "left": null,
1676
- "margin": null,
1677
- "max_height": null,
1678
- "max_width": null,
1679
- "min_height": null,
1680
- "min_width": null,
1681
- "object_fit": null,
1682
- "object_position": null,
1683
- "order": null,
1684
- "overflow": null,
1685
- "overflow_x": null,
1686
- "overflow_y": null,
1687
- "padding": null,
1688
- "right": null,
1689
- "top": null,
1690
- "visibility": null,
1691
- "width": null
1692
- }
1693
- },
1694
- "40ae1be859d74847b4f0944c4027e1cf": {
1695
- "model_module": "@jupyter-widgets/controls",
1696
- "model_name": "DescriptionStyleModel",
1697
- "model_module_version": "1.5.0",
1698
- "state": {
1699
- "_model_module": "@jupyter-widgets/controls",
1700
- "_model_module_version": "1.5.0",
1701
- "_model_name": "DescriptionStyleModel",
1702
- "_view_count": null,
1703
- "_view_module": "@jupyter-widgets/base",
1704
- "_view_module_version": "1.2.0",
1705
- "_view_name": "StyleView",
1706
- "description_width": ""
1707
- }
1708
- }
1709
- }
1710
- }
1711
- },
1712
- "nbformat": 4,
1713
- "nbformat_minor": 5
1714
- }