Upload sd_token_similarity_calculator.ipynb
Browse files
Google Colab Notebooks/sd_token_similarity_calculator.ipynb
CHANGED
@@ -289,9 +289,9 @@
|
|
289 |
"strength_NEG = 1\n",
|
290 |
"if enable:\n",
|
291 |
" # Get text features for user input\n",
|
292 |
-
" inputs = tokenizer(text =
|
293 |
" text_features_NEG = model.get_text_features(**inputs)\n",
|
294 |
-
" text_features_NEG = text_features_NEG/
|
295 |
" name_NEG = neg_prompt\n",
|
296 |
" strength_NEG = neg_strength\n",
|
297 |
" #------#"
|
|
|
289 |
"strength_NEG = 1\n",
|
290 |
"if enable:\n",
|
291 |
" # Get text features for user input\n",
|
292 |
+
" inputs = tokenizer(text = neg_prompt, padding=True, return_tensors=\"pt\")\n",
|
293 |
" text_features_NEG = model.get_text_features(**inputs)\n",
|
294 |
+
" text_features_NEG = text_features_NEG/text_features_NEG.norm(p=2, dim=-1, keepdim=True)\n",
|
295 |
" name_NEG = neg_prompt\n",
|
296 |
" strength_NEG = neg_strength\n",
|
297 |
" #------#"
|