[feat] added ooba

This commit is contained in:
kwaroran
2023-07-09 21:13:47 +09:00
parent 5f8be5a06c
commit 3564190235
4 changed files with 165 additions and 18 deletions

View File

@@ -358,16 +358,16 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
'max_new_tokens': db.maxResponse,
'do_sample': true,
'temperature': (db.temperature / 100),
'top_p': 0.9,
'typical_p': 1,
'repetition_penalty': db.PresensePenalty,
'encoder_repetition_penalty': 1,
'top_k': 100,
'min_length': 0,
'no_repeat_ngram_size': 0,
'num_beams': 1,
'penalty_alpha': 0,
'length_penalty': 1,
'top_p': db.ooba.top_p,
'typical_p': db.ooba.typical_p,
'repetition_penalty': db.ooba.repetition_penalty,
'encoder_repetition_penalty': db.ooba.encoder_repetition_penalty,
'top_k': db.ooba.top_k,
'min_length': db.ooba.min_length,
'no_repeat_ngram_size': db.ooba.no_repeat_ngram_size,
'num_beams': db.ooba.num_beams,
'penalty_alpha': db.ooba.penalty_alpha,
'length_penalty': db.ooba.length_penalty,
'early_stopping': false,
'truncation_length': maxTokens,
'ban_eos_token': false,

View File

@@ -24,7 +24,26 @@ export function stringlizeChat(formated:OpenAIChat[], char:string = ''){
}
export function stringlizeChatOba(formated:OpenAIChat[], char:string = ''){
const db = get(DataBase)
let resultString:string[] = []
if(db.ooba.formating.custom){
for(const form of formated){
if(form.role === 'system'){
resultString.push(form.content)
}
else if(form.name){
resultString.push(db.ooba.formating.userPrefix + form.content + db.ooba.formating.seperator)
}
else if(form.role === 'assistant' && char){
resultString.push(db.ooba.formating.assistantPrefix + form.content + db.ooba.formating.seperator)
}
else{
resultString.push(form.content)
}
}
return resultString.join('\n\n') + `\n\n${db.ooba.formating.assistantPrefix}:`
}
for(const form of formated){
if(form.role === 'system'){
resultString.push(form.content)