mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-08-02 21:28:59 +02:00
47 lines
1.9 KiB
Diff
47 lines
1.9 KiB
Diff
diff --git a/ldm/dream/conditioning.py b/ldm/dream/conditioning.py
|
|
index dfa1089..e4908ad 100644
|
|
--- a/ldm/dream/conditioning.py
|
|
+++ b/ldm/dream/conditioning.py
|
|
@@ -12,8 +12,8 @@ log_tokenization() print out colour-coded tokens and warn if trunca
|
|
import re
|
|
import torch
|
|
|
|
-def get_uc_and_c(prompt, model, log_tokens=False, skip_normalize=False):
|
|
- uc = model.get_learned_conditioning([''])
|
|
+def get_uc_and_c(prompt, model, log_tokens=False, skip_normalize=False, negative_prompt=''):
|
|
+ uc = model.get_learned_conditioning([negative_prompt])
|
|
|
|
# get weighted sub-prompts
|
|
weighted_subprompts = split_weighted_subprompts(
|
|
diff --git a/ldm/generate.py b/ldm/generate.py
|
|
index 8f67403..d88ce2d 100644
|
|
--- a/ldm/generate.py
|
|
+++ b/ldm/generate.py
|
|
@@ -205,6 +205,7 @@ class Generate:
|
|
init_mask = None,
|
|
fit = False,
|
|
strength = None,
|
|
+ init_img_is_path = True,
|
|
# these are specific to GFPGAN/ESRGAN
|
|
gfpgan_strength= 0,
|
|
save_original = False,
|
|
@@ -303,11 +304,15 @@ class Generate:
|
|
uc, c = get_uc_and_c(
|
|
prompt, model=self.model,
|
|
skip_normalize=skip_normalize,
|
|
- log_tokens=self.log_tokenization
|
|
+ log_tokens=self.log_tokenization,
|
|
+ negative_prompt=(args['negative_prompt'] if 'negative_prompt' in args else '')
|
|
)
|
|
|
|
- (init_image,mask_image) = self._make_images(init_img,init_mask, width, height, fit)
|
|
-
|
|
+ if init_img_is_path:
|
|
+ (init_image,mask_image) = self._make_images(init_img,init_mask, width, height, fit)
|
|
+ else:
|
|
+ (init_image,mask_image) = (init_img, init_mask)
|
|
+
|
|
if (init_image is not None) and (mask_image is not None):
|
|
generator = self._make_inpaint()
|
|
elif init_image is not None:
|