[feat] topp

This commit is contained in:
kwaroran
2023-12-03 19:21:53 +09:00
parent 390e3bcb62
commit 7abce105c8
3 changed files with 14 additions and 3 deletions

View File

@@ -292,6 +292,8 @@
{:else} {:else}
<SliderInput min={0} max={200} bind:value={$DataBase.temperature}/> <SliderInput min={0} max={200} bind:value={$DataBase.temperature}/>
{/if} {/if}
<SliderInput min={0} max={2} step={0.01} bind:value={$DataBase.top_p}/>
<span class="text-textcolor2 mb-6 text-sm">{($DataBase.temperature / 100).toFixed(2)}</span> <span class="text-textcolor2 mb-6 text-sm">{($DataBase.temperature / 100).toFixed(2)}</span>
{#if $DataBase.aiModel === 'textgen_webui' || $DataBase.aiModel === 'mancer' || $DataBase.aiModel.startsWith('local_')} {#if $DataBase.aiModel === 'textgen_webui' || $DataBase.aiModel === 'mancer' || $DataBase.aiModel.startsWith('local_')}

View File

@@ -299,6 +299,8 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
frequency_penalty: arg.frequencyPenalty || (db.frequencyPenalty / 100), frequency_penalty: arg.frequencyPenalty || (db.frequencyPenalty / 100),
logit_bias: bias, logit_bias: bias,
stream: false, stream: false,
topP: db.top_p,
}) })
if(db.generationSeed > 0){ if(db.generationSeed > 0){
@@ -670,6 +672,7 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
'stopping_strings': stopStrings, 'stopping_strings': stopStrings,
'seed': -1, 'seed': -1,
add_bos_token: db.ooba.add_bos_token, add_bos_token: db.ooba.add_bos_token,
topP: db.top_p,
prompt: proompt prompt: proompt
} }
@@ -775,7 +778,7 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
max_tokens: maxTokens, max_tokens: maxTokens,
stop: stopStrings, stop: stopStrings,
temperature: temperature, temperature: temperature,
top_p: db.topP topP: db.top_p,
} }
const url = new URL(db.textgenWebUIBlockingURL) const url = new URL(db.textgenWebUIBlockingURL)

View File

@@ -351,6 +351,7 @@ export function setDatabase(data:Database){
data.reverseProxyOobaArgs ??= { data.reverseProxyOobaArgs ??= {
mode: 'instruct' mode: 'instruct'
} }
data.top_p ??= 1
changeLanguage(data.language) changeLanguage(data.language)
DataBase.set(data) DataBase.set(data)
} }
@@ -542,6 +543,7 @@ export interface Database{
huggingfaceKey:string huggingfaceKey:string
allowAllExtentionFiles?:boolean allowAllExtentionFiles?:boolean
translatorPrompt:string translatorPrompt:string
top_p: number,
} }
export interface customscript{ export interface customscript{
@@ -737,6 +739,7 @@ export interface botPreset{
localStopStrings?: string[] localStopStrings?: string[]
customProxyRequestModel?: string customProxyRequestModel?: string
reverseProxyOobaArgs?: OobaChatCompletionRequestParams reverseProxyOobaArgs?: OobaChatCompletionRequestParams
top_p?: number
} }
@@ -930,7 +933,8 @@ export const presetTemplate:botPreset = {
ainconfig: cloneDeep(defaultAIN), ainconfig: cloneDeep(defaultAIN),
reverseProxyOobaArgs: { reverseProxyOobaArgs: {
mode: 'instruct' mode: 'instruct'
} },
top_p: 1
} }
@@ -986,7 +990,8 @@ export function saveCurrentPreset(){
localStopStrings: db.localStopStrings, localStopStrings: db.localStopStrings,
autoSuggestPrompt: db.autoSuggestPrompt, autoSuggestPrompt: db.autoSuggestPrompt,
customProxyRequestModel: db.customProxyRequestModel, customProxyRequestModel: db.customProxyRequestModel,
reverseProxyOobaArgs: cloneDeep(db.reverseProxyOobaArgs) ?? null reverseProxyOobaArgs: cloneDeep(db.reverseProxyOobaArgs) ?? null,
top_p: db.top_p ?? 1
} }
db.botPresets = pres db.botPresets = pres
setDatabase(db) setDatabase(db)
@@ -1055,6 +1060,7 @@ export function setPreset(db:Database, newPres: botPreset){
db.reverseProxyOobaArgs = cloneDeep(newPres.reverseProxyOobaArgs) ?? { db.reverseProxyOobaArgs = cloneDeep(newPres.reverseProxyOobaArgs) ?? {
mode: 'instruct' mode: 'instruct'
} }
db.top_p = newPres.top_p ?? 1
return db return db
} }