Upload sd_token_similarity_calculator.ipynb
Browse files
Google Colab Notebooks/sd_token_similarity_calculator.ipynb
CHANGED
|
@@ -47,6 +47,7 @@
|
|
| 47 |
" return id\n",
|
| 48 |
"\n",
|
| 49 |
"def getPrompts(_path, separator):\n",
|
|
|
|
| 50 |
" path = _path + '/text'\n",
|
| 51 |
" path_enc = _path + '/text_encodings'\n",
|
| 52 |
" #-----#\n",
|
|
@@ -118,13 +119,19 @@
|
|
| 118 |
"#-------#\n",
|
| 119 |
"\n",
|
| 120 |
"#🔸🔹\n",
|
| 121 |
-
"
|
| 122 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
],
|
| 124 |
"metadata": {
|
| 125 |
"id": "rUXQ73IbonHY"
|
| 126 |
},
|
| 127 |
-
"execution_count":
|
| 128 |
"outputs": []
|
| 129 |
},
|
| 130 |
{
|
|
@@ -134,9 +141,9 @@
|
|
| 134 |
"\n",
|
| 135 |
"prompt_features = False # @param {\"type\":\"boolean\",\"placeholder\":\"🦜\"}\n",
|
| 136 |
"civitai_blue_set = False # @param {\"type\":\"boolean\",\"placeholder\":\"📘\"}\n",
|
| 137 |
-
"suffix =
|
| 138 |
-
"prefix =
|
| 139 |
-
"emojis =
|
| 140 |
"#------#\n",
|
| 141 |
"\n",
|
| 142 |
"first_names = False # @param {\"type\":\"boolean\",\"placeholder\":\"🔹\"}\n",
|
|
@@ -147,7 +154,7 @@
|
|
| 147 |
"celebs_young = False # param {\"type\":\"boolean\",\"placeholder\":\"🔸\"}\n",
|
| 148 |
"#-------#\n",
|
| 149 |
"\n",
|
| 150 |
-
"danbooru_tags =
|
| 151 |
"\n",
|
| 152 |
"#-----#\n",
|
| 153 |
"female_fullnames = False # @param {\"type\":\"boolean\",\"placeholder\":\"😃\"}\n",
|
|
@@ -202,7 +209,7 @@
|
|
| 202 |
"\n",
|
| 203 |
"\n",
|
| 204 |
"if emojis:\n",
|
| 205 |
-
" url = '/content/text-to-image-prompts/
|
| 206 |
" prompts , text_encodings, nA = append_from_url(prompts , text_encodings, nA , url , '')\n",
|
| 207 |
"#--------#\n",
|
| 208 |
"\n",
|
|
@@ -213,14 +220,14 @@
|
|
| 213 |
"#--------#\n",
|
| 214 |
"\n",
|
| 215 |
"if suffix :\n",
|
| 216 |
-
" tmp = '/content/text-to-image-prompts/
|
| 217 |
" for item in ['common','average','rare','weird','exotic'] :\n",
|
| 218 |
" url = tmp + item\n",
|
| 219 |
" prompts , text_encodings, nA = append_from_url(prompts , text_encodings, nA , url , '')\n",
|
| 220 |
"#------#\n",
|
| 221 |
"\n",
|
| 222 |
"if prefix :\n",
|
| 223 |
-
" tmp = '/content/text-to-image-prompts/
|
| 224 |
" for item in ['common','average','rare','weird','exotic'] :\n",
|
| 225 |
" url = tmp + item\n",
|
| 226 |
" prompts , text_encodings, nA = append_from_url(prompts , text_encodings, nA , url , '-')\n",
|
|
|
|
| 47 |
" return id\n",
|
| 48 |
"\n",
|
| 49 |
"def getPrompts(_path, separator):\n",
|
| 50 |
+
"\n",
|
| 51 |
" path = _path + '/text'\n",
|
| 52 |
" path_enc = _path + '/text_encodings'\n",
|
| 53 |
" #-----#\n",
|
|
|
|
| 119 |
"#-------#\n",
|
| 120 |
"\n",
|
| 121 |
"#🔸🔹\n",
|
| 122 |
+
"# Load the data if not already loaded\n",
|
| 123 |
+
"try:\n",
|
| 124 |
+
" loaded\n",
|
| 125 |
+
"except:\n",
|
| 126 |
+
" %cd {home_directory}\n",
|
| 127 |
+
" !git clone https://huggingface.co/datasets/codeShare/text-to-image-prompts\n",
|
| 128 |
+
" loaded = True\n",
|
| 129 |
+
"#--------#\n"
|
| 130 |
],
|
| 131 |
"metadata": {
|
| 132 |
"id": "rUXQ73IbonHY"
|
| 133 |
},
|
| 134 |
+
"execution_count": 3,
|
| 135 |
"outputs": []
|
| 136 |
},
|
| 137 |
{
|
|
|
|
| 141 |
"\n",
|
| 142 |
"prompt_features = False # @param {\"type\":\"boolean\",\"placeholder\":\"🦜\"}\n",
|
| 143 |
"civitai_blue_set = False # @param {\"type\":\"boolean\",\"placeholder\":\"📘\"}\n",
|
| 144 |
+
"suffix = True # @param {\"type\":\"boolean\",\"placeholder\":\"🔹\"}\n",
|
| 145 |
+
"prefix = True # @param {\"type\":\"boolean\",\"placeholder\":\"🔸\"}\n",
|
| 146 |
+
"emojis = True # @param {\"type\":\"boolean\",\"placeholder\":\"😃\"}\n",
|
| 147 |
"#------#\n",
|
| 148 |
"\n",
|
| 149 |
"first_names = False # @param {\"type\":\"boolean\",\"placeholder\":\"🔹\"}\n",
|
|
|
|
| 154 |
"celebs_young = False # param {\"type\":\"boolean\",\"placeholder\":\"🔸\"}\n",
|
| 155 |
"#-------#\n",
|
| 156 |
"\n",
|
| 157 |
+
"danbooru_tags = False # @param {\"type\":\"boolean\",\"placeholder\":\"🎀\"}\n",
|
| 158 |
"\n",
|
| 159 |
"#-----#\n",
|
| 160 |
"female_fullnames = False # @param {\"type\":\"boolean\",\"placeholder\":\"😃\"}\n",
|
|
|
|
| 209 |
"\n",
|
| 210 |
"\n",
|
| 211 |
"if emojis:\n",
|
| 212 |
+
" url = '/content/text-to-image-prompts/vocab/text_encodings/emoji'\n",
|
| 213 |
" prompts , text_encodings, nA = append_from_url(prompts , text_encodings, nA , url , '')\n",
|
| 214 |
"#--------#\n",
|
| 215 |
"\n",
|
|
|
|
| 220 |
"#--------#\n",
|
| 221 |
"\n",
|
| 222 |
"if suffix :\n",
|
| 223 |
+
" tmp = '/content/text-to-image-prompts/vocab/text_encodings/suffix/'\n",
|
| 224 |
" for item in ['common','average','rare','weird','exotic'] :\n",
|
| 225 |
" url = tmp + item\n",
|
| 226 |
" prompts , text_encodings, nA = append_from_url(prompts , text_encodings, nA , url , '')\n",
|
| 227 |
"#------#\n",
|
| 228 |
"\n",
|
| 229 |
"if prefix :\n",
|
| 230 |
+
" tmp = '/content/text-to-image-prompts/vocab/text_encodings/prefix/'\n",
|
| 231 |
" for item in ['common','average','rare','weird','exotic'] :\n",
|
| 232 |
" url = tmp + item\n",
|
| 233 |
" prompts , text_encodings, nA = append_from_url(prompts , text_encodings, nA , url , '-')\n",
|