ZhouZJ36DL commited on
Commit
4ca21ee
·
1 Parent(s): 27ccb0f

modified: src/flux/model.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
@@ -111,12 +111,6 @@ 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
- '''
115
- print(f"[DEBUG_Sample] query:\n{query}")
116
- print(f"[DEBUG_Sample] key :\n{key}")
117
- print(f"[DEBUG_Sample] value :\n{value}")
118
- print(f"[DEBUG_Sample] attn_weight values:\n{attn_weight}")
119
- '''
120
  if not info['inverse']:
121
  # GENERATE MASK
122
  txt_img_cross = attn_weight[:, :, -img_shape:, :txt_shape] # lower left part
@@ -135,7 +129,7 @@ def scaled_dot_product_attention(query, key, value, txt_shape, img_shape, cur_st
135
  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)
136
  save_image(mask_img.unsqueeze(0), save_path)
137
  # Debug information
138
- print(f"[DEBUG] cur_step: {cur_step}, cur_block: {cur_block}")
139
 
140
  #print(f"[DEBUG] norm_heatmap values:\n{norm_heatmap}")
141
  #print(f"[DEBUG] mask_img (before thresholding) stats: min={mask_img.min().item()}, max={mask_img.max().item()}, mean={mask_img.mean().item()}")
 
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
 
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
 
134
  #print(f"[DEBUG] norm_heatmap values:\n{norm_heatmap}")
135
  #print(f"[DEBUG] mask_img (before thresholding) stats: min={mask_img.min().item()}, max={mask_img.max().item()}, mean={mask_img.mean().item()}")
src/flux/model.py CHANGED
@@ -90,17 +90,13 @@ class Flux(nn.Module):
90
  if img.ndim != 3 or txt.ndim != 3:
91
  raise ValueError("Input img and txt tensors must have 3 dimensions.")
92
 
93
- print(f"img_{cur_step}:{img}")
94
- print(f"img_ids_{cur_step}:{img_ids}")
95
- print(f"txt_{cur_step}:{txt}")
96
- print(f"txt_ids_{cur_step}:{txt_ids}")
97
  # --- CRITICAL DEBUG: Check the device of self.img_in's parameters ---
98
  weight_device = self.img_in.weight.device
99
  bias_device = self.img_in.bias.device if self.img_in.bias is not None else "N/A (None)"
100
  #print(f"self.img_in.weight device: {weight_device}")
101
  #print(f"self.img_in.bias device: {bias_device}")
102
- print("Model img_in weight sample:", self.img_in.weight[0, :10]) # Print first 10 elements of first row
103
- print("Model img_in bias sample:", self.img_in.bias[:10]) # Print first 10 elements o
104
  # --- FIX: Explicitly move img to the device of img_in's weight if they differ ---
105
  # This is the core fix if the mismatch is here
106
  if img.device != weight_device:
@@ -120,8 +116,8 @@ class Flux(nn.Module):
120
  img = self.img_in(img)
121
  vec = self.time_in(timestep_embedding(timesteps, 256))
122
 
123
- print(f"self.img_in(img)_{cur_step}:{img}")
124
- print(f"self.time_in(timestep_embedding(timesteps, 256))_{cur_step}:{vec}")
125
 
126
  if self.params.guidance_embed:
127
  if guidance is None:
 
90
  if img.ndim != 3 or txt.ndim != 3:
91
  raise ValueError("Input img and txt tensors must have 3 dimensions.")
92
 
 
 
 
 
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
+ #print("Model img_in weight sample:", self.img_in.weight[0, :10]) # Print first 10 elements of first row
99
+ #print("Model img_in bias sample:", self.img_in.bias[:10]) # Print first 10 elements o
100
  # --- FIX: Explicitly move img to the device of img_in's weight if they differ ---
101
  # This is the core fix if the mismatch is here
102
  if img.device != weight_device:
 
116
  img = self.img_in(img)
117
  vec = self.time_in(timestep_embedding(timesteps, 256))
118
 
119
+ #print(f"self.img_in(img)_{cur_step}:{img}")
120
+ #print(f"self.time_in(timestep_embedding(timesteps, 256))_{cur_step}:{vec}")
121
 
122
  if self.params.guidance_embed:
123
  if guidance is None:
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