Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
5700f1e
1
Parent(s):
7f77208
modified: src/flux/math.py
Browse files- src/flux/__pycache__/__init__.cpython-310.pyc +0 -0
- src/flux/__pycache__/_version.cpython-310.pyc +0 -0
- src/flux/__pycache__/math.cpython-310.pyc +0 -0
- src/flux/__pycache__/model.cpython-310.pyc +0 -0
- src/flux/__pycache__/sampling.cpython-310.pyc +0 -0
- src/flux/__pycache__/util.cpython-310.pyc +0 -0
- src/flux/math.py +16 -4
- src/flux/modules/__pycache__/autoencoder.cpython-310.pyc +0 -0
- src/flux/modules/__pycache__/conditioner.cpython-310.pyc +0 -0
- src/flux/modules/__pycache__/layers.cpython-310.pyc +0 -0
src/flux/__pycache__/__init__.cpython-310.pyc
CHANGED
|
Binary files a/src/flux/__pycache__/__init__.cpython-310.pyc and b/src/flux/__pycache__/__init__.cpython-310.pyc differ
|
|
|
src/flux/__pycache__/_version.cpython-310.pyc
CHANGED
|
Binary files a/src/flux/__pycache__/_version.cpython-310.pyc and b/src/flux/__pycache__/_version.cpython-310.pyc differ
|
|
|
src/flux/__pycache__/math.cpython-310.pyc
CHANGED
|
Binary files a/src/flux/__pycache__/math.cpython-310.pyc and b/src/flux/__pycache__/math.cpython-310.pyc differ
|
|
|
src/flux/__pycache__/model.cpython-310.pyc
CHANGED
|
Binary files a/src/flux/__pycache__/model.cpython-310.pyc and b/src/flux/__pycache__/model.cpython-310.pyc differ
|
|
|
src/flux/__pycache__/sampling.cpython-310.pyc
CHANGED
|
Binary files a/src/flux/__pycache__/sampling.cpython-310.pyc and b/src/flux/__pycache__/sampling.cpython-310.pyc differ
|
|
|
src/flux/__pycache__/util.cpython-310.pyc
CHANGED
|
Binary files a/src/flux/__pycache__/util.cpython-310.pyc and b/src/flux/__pycache__/util.cpython-310.pyc differ
|
|
|
src/flux/math.py
CHANGED
|
@@ -111,6 +111,17 @@ def scaled_dot_product_attention(query, key, value, txt_shape, img_shape, cur_st
|
|
| 111 |
attn_weight = torch.softmax(attn_weight, dim=-1)
|
| 112 |
attn_weight = torch.dropout(attn_weight, dropout_p, train=True)
|
| 113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
if not info['inverse']:
|
| 115 |
# GENERATE MASK
|
| 116 |
txt_img_cross = attn_weight[:, :, -img_shape:, :txt_shape] # lower left part
|
|
@@ -130,10 +141,11 @@ def scaled_dot_product_attention(query, key, value, txt_shape, img_shape, cur_st
|
|
| 130 |
save_image(mask_img.unsqueeze(0), save_path)
|
| 131 |
# Debug information
|
| 132 |
print(f"[DEBUG] cur_step: {cur_step}, cur_block: {cur_block}")
|
| 133 |
-
|
| 134 |
-
print(f"[DEBUG]
|
| 135 |
-
print(f"[DEBUG]
|
| 136 |
-
print(f"[DEBUG]
|
|
|
|
| 137 |
|
| 138 |
mask_img[mask_img >= thre] = 1
|
| 139 |
mask_img[mask_img < thre] = 0
|
|
|
|
| 111 |
attn_weight = torch.softmax(attn_weight, dim=-1)
|
| 112 |
attn_weight = torch.dropout(attn_weight, dropout_p, train=True)
|
| 113 |
|
| 114 |
+
if info['inverse']:
|
| 115 |
+
print(f"[DEBUG_Inverse] query:\n{query}")
|
| 116 |
+
print(f"[DEBUG_Inverse] key :\n{key}")
|
| 117 |
+
print(f"[DEBUG_Inverse] value :\n{value}")
|
| 118 |
+
print(f"[DEBUG_Inverse] attn_weight:\n{attn_weight}")
|
| 119 |
+
else:
|
| 120 |
+
print(f"[DEBUG_Sample] query:\n{query}")
|
| 121 |
+
print(f"[DEBUG_Sample] key :\n{key}")
|
| 122 |
+
print(f"[DEBUG_Sample] value :\n{value}")
|
| 123 |
+
print(f"[DEBUG_Sample] attn_weight values:\n{attn_weight}")
|
| 124 |
+
|
| 125 |
if not info['inverse']:
|
| 126 |
# GENERATE MASK
|
| 127 |
txt_img_cross = attn_weight[:, :, -img_shape:, :txt_shape] # lower left part
|
|
|
|
| 141 |
save_image(mask_img.unsqueeze(0), save_path)
|
| 142 |
# Debug information
|
| 143 |
print(f"[DEBUG] cur_step: {cur_step}, cur_block: {cur_block}")
|
| 144 |
+
|
| 145 |
+
#print(f"[DEBUG] norm_heatmap values:\n{norm_heatmap}")
|
| 146 |
+
#print(f"[DEBUG] mask_img (before thresholding) stats: min={mask_img.min().item()}, max={mask_img.max().item()}, mean={mask_img.mean().item()}")
|
| 147 |
+
#print(f"[DEBUG] thre value: {thre}")
|
| 148 |
+
#print(f"[DEBUG] mask_img (before thresholding) values:\n{mask_img}")
|
| 149 |
|
| 150 |
mask_img[mask_img >= thre] = 1
|
| 151 |
mask_img[mask_img < thre] = 0
|
src/flux/modules/__pycache__/autoencoder.cpython-310.pyc
CHANGED
|
Binary files a/src/flux/modules/__pycache__/autoencoder.cpython-310.pyc and b/src/flux/modules/__pycache__/autoencoder.cpython-310.pyc differ
|
|
|
src/flux/modules/__pycache__/conditioner.cpython-310.pyc
CHANGED
|
Binary files a/src/flux/modules/__pycache__/conditioner.cpython-310.pyc and b/src/flux/modules/__pycache__/conditioner.cpython-310.pyc differ
|
|
|
src/flux/modules/__pycache__/layers.cpython-310.pyc
CHANGED
|
Binary files a/src/flux/modules/__pycache__/layers.cpython-310.pyc and b/src/flux/modules/__pycache__/layers.cpython-310.pyc differ
|
|
|