codeShare commited on
Commit
9ad46d9
1 Parent(s): 220bea5

Upload fusion_t2i_CLIP_interrogator.ipynb

Browse files
Google Colab Jupyter Notebooks/fusion_t2i_CLIP_interrogator.ipynb CHANGED
@@ -108,6 +108,9 @@
108
  "if url.find('perchance')>-1:\n",
109
  " image = Image.open(requests.get(url, stream=True).raw)\n",
110
  "#------#\n",
 
 
 
111
  "# @markdown ⚖️ 🖼️ encoding <-----?-----> 📝 encoding </div> <br>\n",
112
  "C = 0.3 # @param {type:\"slider\", min:0, max:1, step:0.01}\n",
113
  "log_strength = 1 # @param {type:\"slider\", min:-5, max:5, step:0.01}\n",
@@ -117,7 +120,6 @@
117
  "reference = torch.add(reference, math.pow(10 ,log_strength-1) * (1-C) * references[index][1].dequantize().to(dtype = torch.float32))\n",
118
  "references = '' # Clear up memory\n",
119
  "ref = reference.clone().detach()\n",
120
- "reference = '' # Clear up memory\n",
121
  "#------#\n",
122
  "print(f'Prompt for this image : \\n\\n \"{prompt} \" \\n\\n')\n",
123
  "image"
 
108
  "if url.find('perchance')>-1:\n",
109
  " image = Image.open(requests.get(url, stream=True).raw)\n",
110
  "#------#\n",
111
+ "try: reference\n",
112
+ "except: reference = torch.zeros(dim).to(dtype = dot_dtype)\n",
113
+ "if reference == '': reference = torch.zeros(dim).to(dtype = dot_dtype)\n",
114
  "# @markdown ⚖️ 🖼️ encoding <-----?-----> 📝 encoding </div> <br>\n",
115
  "C = 0.3 # @param {type:\"slider\", min:0, max:1, step:0.01}\n",
116
  "log_strength = 1 # @param {type:\"slider\", min:-5, max:5, step:0.01}\n",
 
120
  "reference = torch.add(reference, math.pow(10 ,log_strength-1) * (1-C) * references[index][1].dequantize().to(dtype = torch.float32))\n",
121
  "references = '' # Clear up memory\n",
122
  "ref = reference.clone().detach()\n",
 
123
  "#------#\n",
124
  "print(f'Prompt for this image : \\n\\n \"{prompt} \" \\n\\n')\n",
125
  "image"