Model: Add fallback if negative prompt is empty
Fallback to the BOS token since an empty string won't do anything. Ideally, an empty negative prompt should not be used, but it's not the end of the world. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
parent
b378773d0a
commit
bbd4ee54ca
1 changed files with 5 additions and 1 deletions
6
model.py
6
model.py
|
|
@ -585,7 +585,11 @@ class ModelContainer:
|
|||
if cfg_scale not in [None, 1.0]:
|
||||
if self.use_cfg:
|
||||
gen_settings.cfg_scale = cfg_scale
|
||||
negative_prompt = kwargs.get("negative_prompt")
|
||||
|
||||
# If the negative prompt is empty, use the BOS token
|
||||
negative_prompt = unwrap(
|
||||
kwargs.get("negative_prompt"), self.tokenizer.bos_token
|
||||
)
|
||||
else:
|
||||
logger.warn(
|
||||
"CFG is currently disabled. "
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue