Upload sd_token_similarity_calculator.ipynb
Browse files- sd_token_similarity_calculator.ipynb +134 -116
sd_token_similarity_calculator.ipynb
CHANGED
|
@@ -126,7 +126,7 @@
|
|
| 126 |
"colab": {
|
| 127 |
"base_uri": "https://localhost:8080/"
|
| 128 |
},
|
| 129 |
-
"outputId": "
|
| 130 |
},
|
| 131 |
"execution_count": 1,
|
| 132 |
"outputs": [
|
|
@@ -136,13 +136,13 @@
|
|
| 136 |
"text": [
|
| 137 |
"/content\n",
|
| 138 |
"Cloning into 'text-to-image-prompts'...\n",
|
| 139 |
-
"remote: Enumerating objects:
|
| 140 |
-
"remote: Counting objects: 100% (
|
| 141 |
-
"remote: Compressing objects: 100% (
|
| 142 |
-
"remote: Total
|
| 143 |
-
"Receiving objects: 100% (
|
| 144 |
-
"Resolving deltas: 100% (
|
| 145 |
-
"Filtering content: 100% (
|
| 146 |
]
|
| 147 |
}
|
| 148 |
]
|
|
@@ -159,14 +159,18 @@
|
|
| 159 |
"emojis = False # @param {\"type\":\"boolean\",\"placeholder\":\"π\"}\n",
|
| 160 |
"#------#\n",
|
| 161 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
"celebs = False # @param {\"type\":\"boolean\",\"placeholder\":\"ππ¨\"}\n",
|
| 163 |
"\n",
|
| 164 |
"#These are borked\n",
|
| 165 |
-
"
|
| 166 |
"#-------#\n",
|
| 167 |
"\n",
|
| 168 |
"#-----#\n",
|
| 169 |
-
"female_fullnames =
|
| 170 |
"debug = False\n",
|
| 171 |
"\n",
|
| 172 |
"#------#\n",
|
|
@@ -175,6 +179,20 @@
|
|
| 175 |
"nA = 0\n",
|
| 176 |
"#--------#\n",
|
| 177 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
"\n",
|
| 179 |
"if celebs:\n",
|
| 180 |
" url = '/content/text-to-image-prompts/names/celebs/mixed'\n",
|
|
@@ -239,9 +257,9 @@
|
|
| 239 |
"colab": {
|
| 240 |
"base_uri": "https://localhost:8080/"
|
| 241 |
},
|
| 242 |
-
"outputId": "
|
| 243 |
},
|
| 244 |
-
"execution_count":
|
| 245 |
"outputs": [
|
| 246 |
{
|
| 247 |
"output_type": "stream",
|
|
@@ -309,7 +327,7 @@
|
|
| 309 |
"cell_type": "code",
|
| 310 |
"source": [
|
| 311 |
"# @title π Get Prompt text_encoding similarity to the pre-calc. text_encodings\n",
|
| 312 |
-
"prompt = \"
|
| 313 |
"\n",
|
| 314 |
"from transformers import AutoTokenizer\n",
|
| 315 |
"tokenizer = AutoTokenizer.from_pretrained(\"openai/clip-vit-large-patch14\", clean_up_tokenization_spaces = False)\n",
|
|
@@ -336,7 +354,7 @@
|
|
| 336 |
"metadata": {
|
| 337 |
"id": "xc-PbIYF428y"
|
| 338 |
},
|
| 339 |
-
"execution_count":
|
| 340 |
"outputs": []
|
| 341 |
},
|
| 342 |
{
|
|
@@ -388,114 +406,114 @@
|
|
| 388 |
"colab": {
|
| 389 |
"base_uri": "https://localhost:8080/"
|
| 390 |
},
|
| 391 |
-
"outputId": "
|
| 392 |
},
|
| 393 |
-
"execution_count":
|
| 394 |
"outputs": [
|
| 395 |
{
|
| 396 |
"output_type": "stream",
|
| 397 |
"name": "stdout",
|
| 398 |
"text": [
|
| 399 |
-
"{
|
| 400 |
-
"
|
| 401 |
-
"
|
| 402 |
-
"
|
| 403 |
-
"
|
| 404 |
-
"
|
| 405 |
-
"
|
| 406 |
-
"
|
| 407 |
-
"
|
| 408 |
-
"
|
| 409 |
-
"
|
| 410 |
-
"
|
| 411 |
-
"
|
| 412 |
-
"
|
| 413 |
-
"
|
| 414 |
-
"
|
| 415 |
-
"
|
| 416 |
-
"
|
| 417 |
-
"
|
| 418 |
-
"
|
| 419 |
-
"
|
| 420 |
-
"
|
| 421 |
-
"
|
| 422 |
-
"
|
| 423 |
-
"
|
| 424 |
-
"
|
| 425 |
-
"
|
| 426 |
-
"
|
| 427 |
-
"
|
| 428 |
-
"
|
| 429 |
-
"
|
| 430 |
-
"
|
| 431 |
-
"
|
| 432 |
-
"
|
| 433 |
-
"
|
| 434 |
-
"
|
| 435 |
-
"
|
| 436 |
-
"
|
| 437 |
-
"
|
| 438 |
-
"
|
| 439 |
-
"
|
| 440 |
-
"
|
| 441 |
-
"
|
| 442 |
-
"
|
| 443 |
-
"
|
| 444 |
-
"
|
| 445 |
-
"
|
| 446 |
-
"
|
| 447 |
-
"
|
| 448 |
-
"
|
| 449 |
-
"
|
| 450 |
-
"
|
| 451 |
-
"
|
| 452 |
-
"
|
| 453 |
-
"
|
| 454 |
-
"
|
| 455 |
-
"
|
| 456 |
-
"
|
| 457 |
-
"
|
| 458 |
-
"
|
| 459 |
-
"
|
| 460 |
-
"
|
| 461 |
-
"
|
| 462 |
-
"
|
| 463 |
-
"
|
| 464 |
-
"
|
| 465 |
-
"
|
| 466 |
-
"
|
| 467 |
-
"
|
| 468 |
-
"
|
| 469 |
-
"
|
| 470 |
-
"
|
| 471 |
-
"
|
| 472 |
-
"
|
| 473 |
-
"
|
| 474 |
-
"
|
| 475 |
-
"
|
| 476 |
-
"
|
| 477 |
-
"
|
| 478 |
-
"
|
| 479 |
-
"
|
| 480 |
-
"
|
| 481 |
-
"
|
| 482 |
-
"
|
| 483 |
-
"
|
| 484 |
-
"
|
| 485 |
-
"
|
| 486 |
-
"
|
| 487 |
-
"
|
| 488 |
-
"
|
| 489 |
-
"
|
| 490 |
-
"
|
| 491 |
-
"
|
| 492 |
-
"
|
| 493 |
-
"
|
| 494 |
-
"
|
| 495 |
-
"
|
| 496 |
-
"
|
| 497 |
-
"
|
| 498 |
-
"
|
| 499 |
]
|
| 500 |
}
|
| 501 |
]
|
|
|
|
| 126 |
"colab": {
|
| 127 |
"base_uri": "https://localhost:8080/"
|
| 128 |
},
|
| 129 |
+
"outputId": "87487b44-9037-4adc-b978-b107be7854d1"
|
| 130 |
},
|
| 131 |
"execution_count": 1,
|
| 132 |
"outputs": [
|
|
|
|
| 136 |
"text": [
|
| 137 |
"/content\n",
|
| 138 |
"Cloning into 'text-to-image-prompts'...\n",
|
| 139 |
+
"remote: Enumerating objects: 1095, done.\u001b[K\n",
|
| 140 |
+
"remote: Counting objects: 100% (1092/1092), done.\u001b[K\n",
|
| 141 |
+
"remote: Compressing objects: 100% (1059/1059), done.\u001b[K\n",
|
| 142 |
+
"remote: Total 1095 (delta 147), reused 0 (delta 0), pack-reused 3 (from 1)\u001b[K\n",
|
| 143 |
+
"Receiving objects: 100% (1095/1095), 3.63 MiB | 5.75 MiB/s, done.\n",
|
| 144 |
+
"Resolving deltas: 100% (147/147), done.\n",
|
| 145 |
+
"Filtering content: 100% (275/275), 795.84 MiB | 45.49 MiB/s, done.\n"
|
| 146 |
]
|
| 147 |
}
|
| 148 |
]
|
|
|
|
| 159 |
"emojis = False # @param {\"type\":\"boolean\",\"placeholder\":\"π\"}\n",
|
| 160 |
"#------#\n",
|
| 161 |
"\n",
|
| 162 |
+
"first_names = False # @param {\"type\":\"boolean\",\"placeholder\":\"πΉ\"}\n",
|
| 163 |
+
"last_names = False # @param {\"type\":\"boolean\",\"placeholder\":\"πΈ\"}\n",
|
| 164 |
+
"full_names = True # @param {\"type\":\"boolean\",\"placeholder\":\"π\"}\n",
|
| 165 |
+
"\n",
|
| 166 |
"celebs = False # @param {\"type\":\"boolean\",\"placeholder\":\"ππ¨\"}\n",
|
| 167 |
"\n",
|
| 168 |
"#These are borked\n",
|
| 169 |
+
"celebs_young = False # param {\"type\":\"boolean\",\"placeholder\":\"πΈ\"}\n",
|
| 170 |
"#-------#\n",
|
| 171 |
"\n",
|
| 172 |
"#-----#\n",
|
| 173 |
+
"female_fullnames = False # @param {\"type\":\"boolean\",\"placeholder\":\"π\"}\n",
|
| 174 |
"debug = False\n",
|
| 175 |
"\n",
|
| 176 |
"#------#\n",
|
|
|
|
| 179 |
"nA = 0\n",
|
| 180 |
"#--------#\n",
|
| 181 |
"\n",
|
| 182 |
+
"if first_names:\n",
|
| 183 |
+
" url = '/content/text-to-image-prompts/names/firstnames'\n",
|
| 184 |
+
" prompts , text_encodings, nA = append_from_url(prompts , text_encodings, nA , url , '')\n",
|
| 185 |
+
"#--------#\n",
|
| 186 |
+
"\n",
|
| 187 |
+
"if last_names:\n",
|
| 188 |
+
" url = '/content/text-to-image-prompts/names/lastnames'\n",
|
| 189 |
+
" prompts , text_encodings, nA = append_from_url(prompts , text_encodings, nA , url , '')\n",
|
| 190 |
+
"#--------#\n",
|
| 191 |
+
"\n",
|
| 192 |
+
"if full_names:\n",
|
| 193 |
+
" url = '/content/text-to-image-prompts/names/fullnames'\n",
|
| 194 |
+
" prompts , text_encodings, nA = append_from_url(prompts , text_encodings, nA , url , '')\n",
|
| 195 |
+
"#--------#\n",
|
| 196 |
"\n",
|
| 197 |
"if celebs:\n",
|
| 198 |
" url = '/content/text-to-image-prompts/names/celebs/mixed'\n",
|
|
|
|
| 257 |
"colab": {
|
| 258 |
"base_uri": "https://localhost:8080/"
|
| 259 |
},
|
| 260 |
+
"outputId": "03b73537-6081-452e-d1fa-8ff6de9f0bf0"
|
| 261 |
},
|
| 262 |
+
"execution_count": 9,
|
| 263 |
"outputs": [
|
| 264 |
{
|
| 265 |
"output_type": "stream",
|
|
|
|
| 327 |
"cell_type": "code",
|
| 328 |
"source": [
|
| 329 |
"# @title π Get Prompt text_encoding similarity to the pre-calc. text_encodings\n",
|
| 330 |
+
"prompt = \"Beyonce \" # @param {\"type\":\"string\",\"placeholder\":\"Write a prompt\"}\n",
|
| 331 |
"\n",
|
| 332 |
"from transformers import AutoTokenizer\n",
|
| 333 |
"tokenizer = AutoTokenizer.from_pretrained(\"openai/clip-vit-large-patch14\", clean_up_tokenization_spaces = False)\n",
|
|
|
|
| 354 |
"metadata": {
|
| 355 |
"id": "xc-PbIYF428y"
|
| 356 |
},
|
| 357 |
+
"execution_count": 10,
|
| 358 |
"outputs": []
|
| 359 |
},
|
| 360 |
{
|
|
|
|
| 406 |
"colab": {
|
| 407 |
"base_uri": "https://localhost:8080/"
|
| 408 |
},
|
| 409 |
+
"outputId": "ae8f6e6e-50b1-4de4-cc90-6874be10c46d"
|
| 410 |
},
|
| 411 |
+
"execution_count": 11,
|
| 412 |
"outputs": [
|
| 413 |
{
|
| 414 |
"output_type": "stream",
|
| 415 |
"name": "stdout",
|
| 416 |
"text": [
|
| 417 |
+
"{Onna Ealy |\n",
|
| 418 |
+
"Onye Guss |\n",
|
| 419 |
+
"Donae Guynup |\n",
|
| 420 |
+
"Lyfe Manry |\n",
|
| 421 |
+
"Tranae Keye |\n",
|
| 422 |
+
"Teyonce Orouke |\n",
|
| 423 |
+
"Kenley Kenndey |\n",
|
| 424 |
+
"Madysin Oki |\n",
|
| 425 |
+
"Sureya Marki |\n",
|
| 426 |
+
"Noriah Orff |\n",
|
| 427 |
+
"Abaigeal Roode |\n",
|
| 428 |
+
"Lyric Chasen |\n",
|
| 429 |
+
"Annel Ebe |\n",
|
| 430 |
+
"Mkya Kindall |\n",
|
| 431 |
+
"Tionni Chando |\n",
|
| 432 |
+
"Brin Baves |\n",
|
| 433 |
+
"Zene Marer |\n",
|
| 434 |
+
"Meeah Ehlke |\n",
|
| 435 |
+
"Beyah Cheeseman |\n",
|
| 436 |
+
"Leta Eddins |\n",
|
| 437 |
+
"Le Eady |\n",
|
| 438 |
+
"Maloree Onsurez |\n",
|
| 439 |
+
"Kmya Dyte |\n",
|
| 440 |
+
"Joya Marade |\n",
|
| 441 |
+
"Yasmyne Mante |\n",
|
| 442 |
+
"Su Kinn |\n",
|
| 443 |
+
"Tyese Marana |\n",
|
| 444 |
+
"Abish Barimah |\n",
|
| 445 |
+
"Shakia Stanke |\n",
|
| 446 |
+
"Casie Chanab |\n",
|
| 447 |
+
"Lyric Chepiga |\n",
|
| 448 |
+
"Bita Eapen |\n",
|
| 449 |
+
"Shanzay Bassi |\n",
|
| 450 |
+
"Halli Bealmear |\n",
|
| 451 |
+
"Kenyonna Barshaw |\n",
|
| 452 |
+
"Yu Basa |\n",
|
| 453 |
+
"Heaven Manka |\n",
|
| 454 |
+
"Shay Kinnu |\n",
|
| 455 |
+
"Annay Kepke |\n",
|
| 456 |
+
"Nyasia Rombs |\n",
|
| 457 |
+
"Hannan Okie |\n",
|
| 458 |
+
"Jaycie Bateh |\n",
|
| 459 |
+
"Dea Stillssr |\n",
|
| 460 |
+
"Rubee Dys |\n",
|
| 461 |
+
"Tationna Kesha |\n",
|
| 462 |
+
"Aanaya Keneally |\n",
|
| 463 |
+
"Meelah Onan |\n",
|
| 464 |
+
"Thang Rollf |\n",
|
| 465 |
+
"Zaynah Manera |\n",
|
| 466 |
+
"Bessy Oriley |\n",
|
| 467 |
+
"Candyce Bayn |\n",
|
| 468 |
+
"Reana Bary |\n",
|
| 469 |
+
"Abish Kenngott |\n",
|
| 470 |
+
"Raeann Chandesh |\n",
|
| 471 |
+
"Atiyah Guzy |\n",
|
| 472 |
+
"Nariah Markell |\n",
|
| 473 |
+
"Braxtyn Olah |\n",
|
| 474 |
+
"Keshara Baston |\n",
|
| 475 |
+
"Emonee Chautin |\n",
|
| 476 |
+
"Demiah Royle |\n",
|
| 477 |
+
"Breanda Keshishian |\n",
|
| 478 |
+
"Quynn Edmond |\n",
|
| 479 |
+
"Abigial Opet |\n",
|
| 480 |
+
"Alancia Channey |\n",
|
| 481 |
+
"Cashay Guyot |\n",
|
| 482 |
+
"Brenyn Kincaid |\n",
|
| 483 |
+
"Shenell Marson |\n",
|
| 484 |
+
"Matty Guiher |\n",
|
| 485 |
+
"Aaryah Kiddy |\n",
|
| 486 |
+
"Rayah Chao |\n",
|
| 487 |
+
"Saje Marse |\n",
|
| 488 |
+
"Aunna Bargo |\n",
|
| 489 |
+
"Prema Bardes |\n",
|
| 490 |
+
"Shenell Ronca |\n",
|
| 491 |
+
"Chelsy Stickler |\n",
|
| 492 |
+
"Amberly Kinkin |\n",
|
| 493 |
+
"Joydan Guilmain |\n",
|
| 494 |
+
"Jood Barocio |\n",
|
| 495 |
+
"Promise Sterner |\n",
|
| 496 |
+
"Sureya Chhim |\n",
|
| 497 |
+
"Ly Kinsel |\n",
|
| 498 |
+
"Kerly Manuia |\n",
|
| 499 |
+
"Niamyah Basley |\n",
|
| 500 |
+
"Daylan Eaby |\n",
|
| 501 |
+
"Jenay Rouly |\n",
|
| 502 |
+
"Persayis Olewine |\n",
|
| 503 |
+
"Deysha Chaven |\n",
|
| 504 |
+
"Summer Effner |\n",
|
| 505 |
+
"Briuna Hacke |\n",
|
| 506 |
+
"Ande Chasbbar |\n",
|
| 507 |
+
"Lised Mansa |\n",
|
| 508 |
+
"Aman Challen |\n",
|
| 509 |
+
"Karrington Maniace |\n",
|
| 510 |
+
"Ishitha Gutam |\n",
|
| 511 |
+
"Riya Olk |\n",
|
| 512 |
+
"Conny Beabout |\n",
|
| 513 |
+
"Nicky Maquis |\n",
|
| 514 |
+
"Tatym Rothi |\n",
|
| 515 |
+
"Dani Charest |\n",
|
| 516 |
+
"Bryna Stater }\n"
|
| 517 |
]
|
| 518 |
}
|
| 519 |
]
|