Update sd_token_similarity_calculator.ipynb
Browse files
sd_token_similarity_calculator.ipynb
CHANGED
@@ -180,7 +180,7 @@
|
|
180 |
" print(\"Tokenized prompt tensor A has been recalculated as A = w*A + (1-w)*C , where C is the tokenized prompt 'mix_with' tensor C\")\n",
|
181 |
"\n",
|
182 |
"if (mix_method == \"Subtract\"):\n",
|
183 |
-
" tmp =
|
184 |
" _tmp = LA.vector_norm(tmp, ord=2)\n",
|
185 |
" A = tmp*((w*_A + (1-w)*_C)/_tmp)\n",
|
186 |
" _A = LA.vector_norm(A, ord=2)\n",
|
|
|
180 |
" print(\"Tokenized prompt tensor A has been recalculated as A = w*A + (1-w)*C , where C is the tokenized prompt 'mix_with' tensor C\")\n",
|
181 |
"\n",
|
182 |
"if (mix_method == \"Subtract\"):\n",
|
183 |
+
" tmp = (A/_A) - (C/_C)\n",
|
184 |
" _tmp = LA.vector_norm(tmp, ord=2)\n",
|
185 |
" A = tmp*((w*_A + (1-w)*_C)/_tmp)\n",
|
186 |
" _A = LA.vector_norm(A, ord=2)\n",
|