mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-07-13 02:27:11 +00:00
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:
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. "
|
||||
|
||||
Reference in New Issue
Block a user