CFG: Add per-chat CFG and fixes

Per-chat CFG applies a CFG setting per-chat only rather than character
or globally. This overrides all other CFG settings (this will be changed).

Also add fixes to remove character CFG entries properly and not to
apply CFG if the scale is 1 as that won't do anything to generation.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri
2023-08-11 01:35:22 -04:00
parent 63ee7d4e10
commit 5bb6c89868
3 changed files with 74 additions and 25 deletions

View File

@ -232,7 +232,7 @@ async function generateTextGenWithStreaming(generate_data, signal) {
}
export function getTextGenGenerationData(finalPromt, this_amount_gen, isImpersonate) {
const { guidanceScale, negativePrompt } = getCfg();
const cfgValues = getCfg();
return {
'prompt': finalPromt,
@ -251,8 +251,8 @@ export function getTextGenGenerationData(finalPromt, this_amount_gen, isImperson
'penalty_alpha': textgenerationwebui_settings.penalty_alpha,
'length_penalty': textgenerationwebui_settings.length_penalty,
'early_stopping': textgenerationwebui_settings.early_stopping,
'guidance_scale': guidanceScale ?? 1,
'negative_prompt': negativePrompt ?? '',
'guidance_scale': cfgValues?.guidanceScale ?? 1,
'negative_prompt': cfgValues?.negativePrompt ?? '',
'seed': textgenerationwebui_settings.seed,
'add_bos_token': textgenerationwebui_settings.add_bos_token,
'stopping_strings': getStoppingStrings(isImpersonate, false),