Fix oobabooga stopping strings

This commit is contained in:
SillyLossy
2023-04-16 22:08:26 +03:00
parent 0358daa9b1
commit 247d65f30b
3 changed files with 12 additions and 3 deletions

View File

@ -558,6 +558,12 @@
Ban the eos_token. This forces the model to never end the generation prematurely. Ban the eos_token. This forces the model to never end the generation prematurely.
</div> </div>
</div> </div>
<div class="range-block">
<label class="checkbox_label" for="skip_special_tokens_textgenerationwebui">
<input type="checkbox" id="skip_special_tokens_textgenerationwebui" />
Skip Special Tokens
</label>
</div>
<hr> <hr>
<h4>Beam search</h4> <h4>Beam search</h4>
<div class="range-block"> <div class="range-block">

View File

@ -1014,8 +1014,8 @@ function substituteParams(content, _name1, _name2) {
} }
function getStoppingStrings(isImpersonate) { function getStoppingStrings(isImpersonate) {
const charString = [`\n${name2}: `]; const charString = `"\n${name2}: "`;
const userString = is_pygmalion ? [`\nYou: `] : [`\n${name1}: `]; const userString = is_pygmalion ? `"\nYou: "` : `"\n${name1}: "`;
return isImpersonate ? charString : userString; return isImpersonate ? charString : userString;
} }
@ -1886,9 +1886,10 @@ async function Generate(type, automatic_trigger, force_name2) {
'early_stopping': textgenerationwebui_settings.early_stopping, 'early_stopping': textgenerationwebui_settings.early_stopping,
'seed': textgenerationwebui_settings.seed, 'seed': textgenerationwebui_settings.seed,
'add_bos_token': textgenerationwebui_settings.add_bos_token, 'add_bos_token': textgenerationwebui_settings.add_bos_token,
'custom_stopping_strings': getStoppingStrings(isImpersonate).concat(textgenerationwebui_settings.custom_stopping_strings), 'custom_stopping_strings': JSON.stringify(getStoppingStrings(isImpersonate)),
'truncation_length': max_context, 'truncation_length': max_context,
'ban_eos_token': textgenerationwebui_settings.ban_eos_token, 'ban_eos_token': textgenerationwebui_settings.ban_eos_token,
'skip_special_tokens': textgenerationwebui_settings.skip_special_tokens,
} }
]; ];
generate_data = { "data": [JSON.stringify(data)] }; generate_data = { "data": [JSON.stringify(data)] };

View File

@ -31,6 +31,7 @@ let textgenerationwebui_settings = {
ban_eos_token: false, ban_eos_token: false,
streaming: false, streaming: false,
fn_index: 34, fn_index: 34,
skip_special_tokens: true,
}; };
let textgenerationwebui_presets = []; let textgenerationwebui_presets = [];
@ -54,6 +55,7 @@ const setting_names = [
"add_bos_token", "add_bos_token",
"ban_eos_token", "ban_eos_token",
"fn_index", "fn_index",
"skip_special_tokens",
]; ];
function selectPreset(name) { function selectPreset(name) {