owiedotch commited on
Commit
bcbb2f9
1 Parent(s): 6bf5e2b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -122,6 +122,8 @@ def process(
122
  for _ in tqdm(range(num_samples)):
123
  shape = (1, 4, height // 8, width // 8)
124
  x_T = torch.randn(shape, device=device, dtype=torch.float32)
 
 
125
 
126
  if not tile_diffusion:
127
  samples = sampler.sample_ccsr(
@@ -129,9 +131,8 @@ def process(
129
  positive_prompt=positive_prompt, negative_prompt=negative_prompt, x_T=x_T,
130
  cfg_scale=cfg_scale,
131
  color_fix_type="adain" if use_color_fix else "none",
132
- # Add unconditional embeddings for classifier-free guidance
133
- unconditional_guidance_scale=cfg_scale,
134
- unconditional_conditioning=None # You might need to define this based on your model
135
  )
136
  else:
137
  samples = sampler.sample_with_tile_ccsr(
@@ -140,9 +141,8 @@ def process(
140
  positive_prompt=positive_prompt, negative_prompt=negative_prompt, x_T=x_T,
141
  cfg_scale=cfg_scale,
142
  color_fix_type="adain" if use_color_fix else "none",
143
- # Add unconditional embeddings for classifier-free guidance
144
- unconditional_guidance_scale=cfg_scale,
145
- unconditional_conditioning=None # You might need to define this based on your model
146
  )
147
 
148
  x_samples = samples.clamp(0, 1)
 
122
  for _ in tqdm(range(num_samples)):
123
  shape = (1, 4, height // 8, width // 8)
124
  x_T = torch.randn(shape, device=device, dtype=torch.float32)
125
+ # Create unconditional embeddings for classifier-free guidance
126
+ uc = model.get_learned_conditioning([""])
127
 
128
  if not tile_diffusion:
129
  samples = sampler.sample_ccsr(
 
131
  positive_prompt=positive_prompt, negative_prompt=negative_prompt, x_T=x_T,
132
  cfg_scale=cfg_scale,
133
  color_fix_type="adain" if use_color_fix else "none",
134
+ # Pass unconditional embeddings to the sampler
135
+ unconditional_conditioning=uc,
 
136
  )
137
  else:
138
  samples = sampler.sample_with_tile_ccsr(
 
141
  positive_prompt=positive_prompt, negative_prompt=negative_prompt, x_T=x_T,
142
  cfg_scale=cfg_scale,
143
  color_fix_type="adain" if use_color_fix else "none",
144
+ # Pass unconditional embeddings to the sampler
145
+ unconditional_conditioning=uc,
 
146
  )
147
 
148
  x_samples = samples.clamp(0, 1)