ZhouZJ36DL commited on
Commit
7f77208
·
1 Parent(s): aea1107

modified: src/flux/math.py

Browse files
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
@@ -128,10 +128,18 @@ def scaled_dot_product_attention(query, key, value, txt_shape, img_shape, cur_st
128
  save_path = f'heatmap/step_{cur_step}_layer_{cur_block}_token{token_index}.png'
129
  load_path = [f'heatmap/step_{cur_step-1}_layer_{i}_token{token_index}.png' for i in layer] #save_image(mask_img.unsqueeze(0), save_path)
130
  save_image(mask_img.unsqueeze(0), save_path)
 
 
 
 
 
 
131
 
132
  mask_img[mask_img >= thre] = 1
133
  mask_img[mask_img < thre] = 0
134
  #save_image(mask_img.unsqueeze(0), save_path)
 
 
135
 
136
  mask_tensor = torch.zeros_like(mask_img) # Set mask_tensor as a zero tensor
137
  if cur_step > 3:
 
128
  save_path = f'heatmap/step_{cur_step}_layer_{cur_block}_token{token_index}.png'
129
  load_path = [f'heatmap/step_{cur_step-1}_layer_{i}_token{token_index}.png' for i in layer] #save_image(mask_img.unsqueeze(0), save_path)
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
+ print(f"[DEBUG] norm_heatmap values:\n{norm_heatmap}")
134
+ print(f"[DEBUG] mask_img (before thresholding) stats: min={mask_img.min().item()}, max={mask_img.max().item()}, mean={mask_img.mean().item()}")
135
+ print(f"[DEBUG] thre value: {thre}")
136
+ print(f"[DEBUG] mask_img (before thresholding) values:\n{mask_img}")
137
 
138
  mask_img[mask_img >= thre] = 1
139
  mask_img[mask_img < thre] = 0
140
  #save_image(mask_img.unsqueeze(0), save_path)
141
+ print(f"[DEBUG] mask_img (after thresholding) unique values: {mask_img.unique().tolist()}")
142
+ print(f"[DEBUG] mask_img (after thresholding) values:\n{mask_img}")
143
 
144
  mask_tensor = torch.zeros_like(mask_img) # Set mask_tensor as a zero tensor
145
  if cur_step > 3:
src/flux/model.py CHANGED
@@ -93,8 +93,8 @@ class Flux(nn.Module):
93
  # --- CRITICAL DEBUG: Check the device of self.img_in's parameters ---
94
  weight_device = self.img_in.weight.device
95
  bias_device = self.img_in.bias.device if self.img_in.bias is not None else "N/A (None)"
96
- print(f"self.img_in.weight device: {weight_device}")
97
- print(f"self.img_in.bias device: {bias_device}")
98
 
99
  # --- FIX: Explicitly move img to the device of img_in's weight if they differ ---
100
  # This is the core fix if the mismatch is here
@@ -109,7 +109,7 @@ class Flux(nn.Module):
109
  # Add similar checks/moves for txt_ids, y, timesteps, guidance if needed,
110
  # but based on your previous debug, they were on cuda:0.
111
 
112
- print("--- End of Critical Debug ---")
113
 
114
  # running on sequences img
115
  img = self.img_in(img)
 
93
  # --- CRITICAL DEBUG: Check the device of self.img_in's parameters ---
94
  weight_device = self.img_in.weight.device
95
  bias_device = self.img_in.bias.device if self.img_in.bias is not None else "N/A (None)"
96
+ #print(f"self.img_in.weight device: {weight_device}")
97
+ #print(f"self.img_in.bias device: {bias_device}")
98
 
99
  # --- FIX: Explicitly move img to the device of img_in's weight if they differ ---
100
  # This is the core fix if the mismatch is here
 
109
  # Add similar checks/moves for txt_ids, y, timesteps, guidance if needed,
110
  # but based on your previous debug, they were on cuda:0.
111
 
112
+ #print("--- End of Critical Debug ---")
113
 
114
  # running on sequences img
115
  img = self.img_in(img)
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