nyanko7 commited on
Commit
212cf37
1 Parent(s): 6e97454

Update modules/model.py

Browse files
Files changed (1) hide show
  1. modules/model.py +6 -1
modules/model.py CHANGED
@@ -367,8 +367,12 @@ class StableDiffusionPipeline(DiffusionPipeline):
367
  ).input_ids
368
 
369
  dotmap = v["map"] < 255
 
 
 
 
370
  arr = torch.from_numpy(
371
- dotmap.astype(float) * float(v["weight"]) * g_strength
372
  )
373
  img_state.append((v_input, arr))
374
 
@@ -599,6 +603,7 @@ class StableDiffusionPipeline(DiffusionPipeline):
599
  # 2. Define call parameters
600
  batch_size = 1 if isinstance(prompt, str) else len(prompt)
601
  device = self._execution_device
 
602
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
603
  # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
604
  # corresponds to doing no classifier free guidance.
 
367
  ).input_ids
368
 
369
  dotmap = v["map"] < 255
370
+ out = dotmap.astype(float)
371
+ if v["mask_outsides"]:
372
+ out[out==0] = -1
373
+
374
  arr = torch.from_numpy(
375
+ out * float(v["weight"]) * g_strength
376
  )
377
  img_state.append((v_input, arr))
378
 
 
603
  # 2. Define call parameters
604
  batch_size = 1 if isinstance(prompt, str) else len(prompt)
605
  device = self._execution_device
606
+ latents = latents.to(device, dtype=self.unet.dtype)
607
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
608
  # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
609
  # corresponds to doing no classifier free guidance.