[feat] added ain param
This commit is contained in:
@@ -250,6 +250,28 @@
|
||||
<input class="text-neutral-200 mb-4 p-2 bg-transparent input-text focus:bg-selected" bind:value={$DataBase.ooba.formating.seperator}>
|
||||
</div>
|
||||
{/if}
|
||||
{:else if $DataBase.aiModel.startsWith('novellist')}
|
||||
<span class="text-neutral-200">Top P</span>
|
||||
<input class="text-neutral-200 p-2 bg-transparent input-text focus:bg-selected" type="range" min="0" max="2" step="0.01" bind:value={$DataBase.ainconfig.top_p}>
|
||||
<span class="text-gray-400 mb-6 text-sm">{($DataBase.ainconfig.top_p).toFixed(2)}</span>
|
||||
<span class="text-neutral-200">Reputation Penalty</span>
|
||||
<input class="text-neutral-200 p-2 bg-transparent input-text focus:bg-selected" type="range" min="0" max="2" step="0.01" bind:value={$DataBase.ainconfig.rep_pen}>
|
||||
<span class="text-gray-400 mb-6 text-sm">{($DataBase.ainconfig.rep_pen).toFixed(2)}</span>
|
||||
<span class="text-neutral-200">Reputation Penalty Range</span>
|
||||
<input class="text-neutral-200 p-2 bg-transparent input-text focus:bg-selected" type="range" min="0" max="2" step="2048" bind:value={$DataBase.ainconfig.rep_pen_range}>
|
||||
<span class="text-gray-400 mb-6 text-sm">{($DataBase.ainconfig.rep_pen).toFixed(2)}</span>
|
||||
<span class="text-neutral-200">Reputation Penalty Slope</span>
|
||||
<input class="text-neutral-200 p-2 bg-transparent input-text focus:bg-selected" type="range" min="0" max="10" step="0.1" bind:value={$DataBase.ainconfig.rep_pen_slope}>
|
||||
<span class="text-gray-400 mb-6 text-sm">{($DataBase.ainconfig.rep_pen).toFixed(2)}</span>
|
||||
<span class="text-neutral-200">Top K</span>
|
||||
<input class="text-neutral-200 p-2 bg-transparent input-text focus:bg-selected" type="range" min="1" max="500" step="1" bind:value={$DataBase.ainconfig.top_k}>
|
||||
<span class="text-gray-400 mb-6 text-sm">{($DataBase.ainconfig.top_p).toFixed(2)}</span><span class="text-neutral-200">Typical P</span>
|
||||
<span class="text-neutral-200">Top A</span>
|
||||
<input class="text-neutral-200 p-2 bg-transparent input-text focus:bg-selected" type="range" min="0" max="1" step="0.01" bind:value={$DataBase.ooba.top_a}>
|
||||
<span class="text-gray-400 mb-6 text-sm">{($DataBase.ooba.top_a).toFixed(2)}</span>
|
||||
<span class="text-neutral-200">Typical P</span>
|
||||
<input class="text-neutral-200 p-2 bg-transparent input-text focus:bg-selected" type="range" min="0" max="1" step="0.01" bind:value={$DataBase.ooba.typical_p}>
|
||||
<span class="text-gray-400 mb-6 text-sm">{($DataBase.ooba.typical_p).toFixed(2)}</span>
|
||||
{:else}
|
||||
<span class="text-neutral-200">{language.frequencyPenalty} <Help key="frequencyPenalty"/></span>
|
||||
<input class="text-neutral-200 p-2 bg-transparent input-text focus:bg-selected" type="range" min="0" max="100" bind:value={$DataBase.frequencyPenalty}>
|
||||
|
||||
@@ -552,28 +552,20 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
||||
'Content-Type': 'application/json'
|
||||
};
|
||||
|
||||
// const send_body = {
|
||||
// text: stringlizeAINChat(formated, currentChar?.name ?? ''),
|
||||
// length: maxTokens,
|
||||
// temperature: temperature,
|
||||
// top_p: 0.7,
|
||||
// tailfree: 1.0,
|
||||
// rep_pen: arg.frequencyPenalty ?? (db.frequencyPenalty / 100) + 1,
|
||||
// model: aiModel === 'novellist_damsel' ? 'damsel' : 'supertrin',
|
||||
// userbadwords: ["【質問】"].join("<<|>>"),
|
||||
// };
|
||||
|
||||
const send_body = {
|
||||
text: stringlizeAINChat(formated, currentChar?.name ?? ''),
|
||||
length: maxTokens,
|
||||
temperature: 0.925,
|
||||
top_p: 0.7,
|
||||
rep_pen: 1.0625,
|
||||
top_a: 0.08,
|
||||
rep_pen_slope: 1.7,
|
||||
|
||||
temperature: temperature,
|
||||
top_p: db.ainconfig.top_p,
|
||||
top_k: db.ainconfig.top_k,
|
||||
rep_pen: db.ainconfig.rep_pen,
|
||||
top_a: db.ainconfig.top_a,
|
||||
rep_pen_slope: db.ainconfig.rep_pen_slope,
|
||||
rep_pen_range: db.ainconfig.rep_pen_range,
|
||||
typical_p: db.ainconfig.typical_p,
|
||||
badwords: db.ainconfig.badwords,
|
||||
model: aiModel === 'novellist_damsel' ? 'damsel' : 'supertrin',
|
||||
stoptokens: ["「"].join("<<|>>"),
|
||||
stoptokens: ["「"].join("<<|>>") + db.ainconfig.stoptokens,
|
||||
};
|
||||
const response = await globalFetch(api_server_url + '/api', {
|
||||
method: 'POST',
|
||||
|
||||
@@ -410,6 +410,7 @@ export interface botPreset{
|
||||
koboldURL?: string
|
||||
proxyKey:string
|
||||
ooba: OobaSettings
|
||||
ainconfig: AINsettings
|
||||
}
|
||||
|
||||
export interface Database{
|
||||
@@ -537,6 +538,7 @@ export interface Database{
|
||||
hypaMemory:boolean
|
||||
proxyRequestModel:string
|
||||
ooba:OobaSettings
|
||||
ainconfig: AINsettings
|
||||
}
|
||||
|
||||
interface hordeConfig{
|
||||
@@ -585,6 +587,18 @@ export interface Message{
|
||||
chatId?:string
|
||||
}
|
||||
|
||||
interface AINsettings{
|
||||
top_p: number,
|
||||
rep_pen: number,
|
||||
top_a: number,
|
||||
rep_pen_slope:number,
|
||||
rep_pen_range: number,
|
||||
typical_p:number
|
||||
badwords:string
|
||||
stoptokens:string
|
||||
top_k:number
|
||||
}
|
||||
|
||||
interface OobaSettings{
|
||||
max_new_tokens: number,
|
||||
do_sample: boolean,
|
||||
@@ -621,6 +635,18 @@ interface OobaSettings{
|
||||
|
||||
export const saveImage = saveImageGlobal
|
||||
|
||||
export const defaultAIN:AINsettings = {
|
||||
top_p: 0.7,
|
||||
rep_pen: 1.0625,
|
||||
top_a: 0.08,
|
||||
rep_pen_slope: 1.7,
|
||||
rep_pen_range: 1024,
|
||||
typical_p: 1.0,
|
||||
badwords: '',
|
||||
stoptokens: '',
|
||||
top_k: 140
|
||||
}
|
||||
|
||||
export const defaultOoba:OobaSettings = {
|
||||
max_new_tokens: 180,
|
||||
do_sample: true,
|
||||
@@ -654,6 +680,7 @@ export const defaultOoba:OobaSettings = {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export const presetTemplate:botPreset = {
|
||||
name: "New Preset",
|
||||
apiType: "gpt35",
|
||||
@@ -676,7 +703,8 @@ export const presetTemplate:botPreset = {
|
||||
promptPreprocess: false,
|
||||
proxyKey: '',
|
||||
bias: [],
|
||||
ooba: cloneDeep(defaultOoba)
|
||||
ooba: cloneDeep(defaultOoba),
|
||||
ainconfig: cloneDeep(defaultAIN)
|
||||
}
|
||||
|
||||
const defaultSdData:[string,string][] = [
|
||||
@@ -750,7 +778,8 @@ export function saveCurrentPreset(){
|
||||
bias: db.bias,
|
||||
koboldURL: db.koboldURL,
|
||||
proxyKey: db.proxyKey,
|
||||
ooba: db.ooba
|
||||
ooba: cloneDeep(db.ooba),
|
||||
ainconfig: cloneDeep(db.ainconfig)
|
||||
}
|
||||
db.botPresets = pres
|
||||
DataBase.set(db)
|
||||
@@ -796,6 +825,7 @@ export function changeToPreset(id =0, savecurrent = true){
|
||||
db.koboldURL = newPres.koboldURL ?? db.koboldURL
|
||||
db.proxyKey = newPres.proxyKey ?? db.proxyKey
|
||||
db.ooba = cloneDeep(newPres.ooba ?? db.ooba)
|
||||
db.ainconfig = cloneDeep(newPres.ainconfig ?? db.ainconfig)
|
||||
DataBase.set(db)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user