Commit 3f5e3627 authored by Sam McLeod's avatar Sam McLeod
Browse files

feat: add num_keep, num_batch

parent 162643a4
...@@ -751,6 +751,14 @@ async def generate_chat_completion( ...@@ -751,6 +751,14 @@ async def generate_chat_completion(
if model_info.params.get("num_ctx", None): if model_info.params.get("num_ctx", None):
payload["options"]["num_ctx"] = model_info.params.get("num_ctx", None) payload["options"]["num_ctx"] = model_info.params.get("num_ctx", None)
if model_info.params.get("num_batch", None):
payload["options"]["num_batch"] = model_info.params.get(
"num_batch", None
)
if model_info.params.get("num_keep", None):
payload["options"]["num_keep"] = model_info.params.get("num_keep", None)
if model_info.params.get("repeat_last_n", None): if model_info.params.get("repeat_last_n", None):
payload["options"]["repeat_last_n"] = model_info.params.get( payload["options"]["repeat_last_n"] = model_info.params.get(
"repeat_last_n", None "repeat_last_n", None
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
top_p: null, top_p: null,
tfs_z: null, tfs_z: null,
num_ctx: null, num_ctx: null,
num_batch: null,
num_keep: null,
max_tokens: null, max_tokens: null,
use_mmap: null, use_mmap: null,
use_mlock: null, use_mlock: null,
...@@ -565,6 +567,98 @@ ...@@ -565,6 +567,98 @@
{/if} {/if}
</div> </div>
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('Batch Size (num_batch)')}</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
type="button"
on:click={() => {
params.num_batch = (params?.num_batch ?? null) === null ? 512 : null;
}}
>
{#if (params?.num_batch ?? null) === null}
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
{:else}
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
{/if}
</button>
</div>
{#if (params?.num_batch ?? null) !== null}
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<input
id="steps-range"
type="range"
min="256"
max="8192"
step="256"
bind:value={params.num_batch}
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
/>
</div>
<div class="">
<input
bind:value={params.num_batch}
type="number"
class=" bg-transparent text-center w-14"
min="256"
step="256"
/>
</div>
</div>
{/if}
</div>
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">
{$i18n.t('Tokens To Keep On Context Refresh (num_keep)')}
</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
type="button"
on:click={() => {
params.num_keep = (params?.num_keep ?? null) === null ? 24 : null;
}}
>
{#if (params?.num_keep ?? null) === null}
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
{:else}
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
{/if}
</button>
</div>
{#if (params?.num_keep ?? null) !== null}
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<input
id="steps-range"
type="range"
min="-1"
max="10240000"
step="1"
bind:value={params.num_keep}
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
/>
</div>
<div class="">
<input
bind:value={params.num_keep}
type="number"
class=" bg-transparent text-center w-14"
min="-1"
step="1"
/>
</div>
</div>
{/if}
</div>
<div class=" py-0.5 w-full justify-between"> <div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between"> <div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('Max Tokens (num_predict)')}</div> <div class=" self-center text-xs font-medium">{$i18n.t('Max Tokens (num_predict)')}</div>
......
...@@ -55,6 +55,8 @@ ...@@ -55,6 +55,8 @@
stop: null, stop: null,
tfs_z: null, tfs_z: null,
num_ctx: null, num_ctx: null,
num_batch: null,
num_keep: null,
max_tokens: null max_tokens: null
}; };
...@@ -308,6 +310,8 @@ ...@@ -308,6 +310,8 @@
top_p: params.top_p !== null ? params.top_p : undefined, top_p: params.top_p !== null ? params.top_p : undefined,
tfs_z: params.tfs_z !== null ? params.tfs_z : undefined, tfs_z: params.tfs_z !== null ? params.tfs_z : undefined,
num_ctx: params.num_ctx !== null ? params.num_ctx : undefined, num_ctx: params.num_ctx !== null ? params.num_ctx : undefined,
num_batch: params.num_batch !== null ? params.num_batch : undefined,
num_keep: params.num_keep !== null ? params.num_keep : undefined,
max_tokens: params.max_tokens !== null ? params.max_tokens : undefined, max_tokens: params.max_tokens !== null ? params.max_tokens : undefined,
use_mmap: params.use_mmap !== null ? params.use_mmap : undefined, use_mmap: params.use_mmap !== null ? params.use_mmap : undefined,
use_mlock: params.use_mlock !== null ? params.use_mlock : undefined, use_mlock: params.use_mlock !== null ? params.use_mlock : undefined,
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
"Bad Response": "استجابة خطاء", "Bad Response": "استجابة خطاء",
"Banners": "لافتات", "Banners": "لافتات",
"Base Model (From)": "النموذج الأساسي (من)", "Base Model (From)": "النموذج الأساسي (من)",
"Batch Size (num_batch)": "",
"before": "قبل", "before": "قبل",
"Being lazy": "كون كسول", "Being lazy": "كون كسول",
"Brave Search API Key": "مفتاح واجهة برمجة تطبيقات البحث الشجاع", "Brave Search API Key": "مفتاح واجهة برمجة تطبيقات البحث الشجاع",
...@@ -522,6 +523,7 @@ ...@@ -522,6 +523,7 @@
"Today": "اليوم", "Today": "اليوم",
"Toggle settings": "فتح وأغلاق الاعدادات", "Toggle settings": "فتح وأغلاق الاعدادات",
"Toggle sidebar": "فتح وأغلاق الشريط الجانبي", "Toggle sidebar": "فتح وأغلاق الشريط الجانبي",
"Tokens To Keep On Context Refresh (num_keep)": "",
"Tools": "", "Tools": "",
"Top K": "Top K", "Top K": "Top K",
"Top P": "Top P", "Top P": "Top P",
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
"Bad Response": "Невалиден отговор от API", "Bad Response": "Невалиден отговор от API",
"Banners": "Банери", "Banners": "Банери",
"Base Model (From)": "Базов модел (от)", "Base Model (From)": "Базов модел (от)",
"Batch Size (num_batch)": "",
"before": "преди", "before": "преди",
"Being lazy": "Да бъдеш мързелив", "Being lazy": "Да бъдеш мързелив",
"Brave Search API Key": "Смел ключ за API за търсене", "Brave Search API Key": "Смел ключ за API за търсене",
...@@ -518,6 +519,7 @@ ...@@ -518,6 +519,7 @@
"Today": "днес", "Today": "днес",
"Toggle settings": "Toggle settings", "Toggle settings": "Toggle settings",
"Toggle sidebar": "Toggle sidebar", "Toggle sidebar": "Toggle sidebar",
"Tokens To Keep On Context Refresh (num_keep)": "",
"Tools": "", "Tools": "",
"Top K": "Top K", "Top K": "Top K",
"Top P": "Top P", "Top P": "Top P",
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
"Bad Response": "খারাপ প্রতিক্রিয়া", "Bad Response": "খারাপ প্রতিক্রিয়া",
"Banners": "ব্যানার", "Banners": "ব্যানার",
"Base Model (From)": "বেস মডেল (থেকে)", "Base Model (From)": "বেস মডেল (থেকে)",
"Batch Size (num_batch)": "",
"before": "পূর্ববর্তী", "before": "পূর্ববর্তী",
"Being lazy": "অলস হওয়া", "Being lazy": "অলস হওয়া",
"Brave Search API Key": "সাহসী অনুসন্ধান API কী", "Brave Search API Key": "সাহসী অনুসন্ধান API কী",
...@@ -518,6 +519,7 @@ ...@@ -518,6 +519,7 @@
"Today": "আজ", "Today": "আজ",
"Toggle settings": "সেটিংস টোগল", "Toggle settings": "সেটিংস টোগল",
"Toggle sidebar": "সাইডবার টোগল", "Toggle sidebar": "সাইডবার টোগল",
"Tokens To Keep On Context Refresh (num_keep)": "",
"Tools": "", "Tools": "",
"Top K": "Top K", "Top K": "Top K",
"Top P": "Top P", "Top P": "Top P",
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
"Bad Response": "Resposta Erroni", "Bad Response": "Resposta Erroni",
"Banners": "Banners", "Banners": "Banners",
"Base Model (From)": "Model base (des de)", "Base Model (From)": "Model base (des de)",
"Batch Size (num_batch)": "",
"before": "abans", "before": "abans",
"Being lazy": "Ser l'estupidez", "Being lazy": "Ser l'estupidez",
"Brave Search API Key": "Clau API Brave Search", "Brave Search API Key": "Clau API Brave Search",
...@@ -519,6 +520,7 @@ ...@@ -519,6 +520,7 @@
"Today": "Avui", "Today": "Avui",
"Toggle settings": "Commuta configuracions", "Toggle settings": "Commuta configuracions",
"Toggle sidebar": "Commuta barra lateral", "Toggle sidebar": "Commuta barra lateral",
"Tokens To Keep On Context Refresh (num_keep)": "",
"Tools": "", "Tools": "",
"Top K": "Top K", "Top K": "Top K",
"Top P": "Top P", "Top P": "Top P",
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
"Bad Response": "", "Bad Response": "",
"Banners": "", "Banners": "",
"Base Model (From)": "", "Base Model (From)": "",
"Batch Size (num_batch)": "",
"before": "", "before": "",
"Being lazy": "", "Being lazy": "",
"Brave Search API Key": "", "Brave Search API Key": "",
...@@ -518,6 +519,7 @@ ...@@ -518,6 +519,7 @@
"Today": "", "Today": "",
"Toggle settings": "I-toggle ang mga setting", "Toggle settings": "I-toggle ang mga setting",
"Toggle sidebar": "I-toggle ang sidebar", "Toggle sidebar": "I-toggle ang sidebar",
"Tokens To Keep On Context Refresh (num_keep)": "",
"Tools": "", "Tools": "",
"Top K": "Top K", "Top K": "Top K",
"Top P": "Ibabaw nga P", "Top P": "Ibabaw nga P",
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
"Bad Response": "Schlechte Antwort", "Bad Response": "Schlechte Antwort",
"Banners": "Banner", "Banners": "Banner",
"Base Model (From)": "Basismodell (von)", "Base Model (From)": "Basismodell (von)",
"Batch Size (num_batch)": "",
"before": "bereits geteilt", "before": "bereits geteilt",
"Being lazy": "Faul sein", "Being lazy": "Faul sein",
"Brave Search API Key": "API-Schlüssel für die Brave-Suche", "Brave Search API Key": "API-Schlüssel für die Brave-Suche",
...@@ -518,6 +519,7 @@ ...@@ -518,6 +519,7 @@
"Today": "Heute", "Today": "Heute",
"Toggle settings": "Einstellungen umschalten", "Toggle settings": "Einstellungen umschalten",
"Toggle sidebar": "Seitenleiste umschalten", "Toggle sidebar": "Seitenleiste umschalten",
"Tokens To Keep On Context Refresh (num_keep)": "",
"Tools": "", "Tools": "",
"Top K": "Top K", "Top K": "Top K",
"Top P": "Top P", "Top P": "Top P",
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
"Bad Response": "", "Bad Response": "",
"Banners": "", "Banners": "",
"Base Model (From)": "", "Base Model (From)": "",
"Batch Size (num_batch)": "",
"before": "", "before": "",
"Being lazy": "", "Being lazy": "",
"Brave Search API Key": "", "Brave Search API Key": "",
...@@ -518,6 +519,7 @@ ...@@ -518,6 +519,7 @@
"Today": "", "Today": "",
"Toggle settings": "Toggle settings much toggle", "Toggle settings": "Toggle settings much toggle",
"Toggle sidebar": "Toggle sidebar much toggle", "Toggle sidebar": "Toggle sidebar much toggle",
"Tokens To Keep On Context Refresh (num_keep)": "",
"Tools": "", "Tools": "",
"Top K": "Top K very top", "Top K": "Top K very top",
"Top P": "Top P very top", "Top P": "Top P very top",
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
"Bad Response": "", "Bad Response": "",
"Banners": "", "Banners": "",
"Base Model (From)": "", "Base Model (From)": "",
"Batch Size (num_batch)": "",
"before": "", "before": "",
"Being lazy": "", "Being lazy": "",
"Brave Search API Key": "", "Brave Search API Key": "",
...@@ -518,6 +519,7 @@ ...@@ -518,6 +519,7 @@
"Today": "", "Today": "",
"Toggle settings": "", "Toggle settings": "",
"Toggle sidebar": "", "Toggle sidebar": "",
"Tokens To Keep On Context Refresh (num_keep)": "",
"Tools": "", "Tools": "",
"Top K": "", "Top K": "",
"Top P": "", "Top P": "",
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
"Bad Response": "", "Bad Response": "",
"Banners": "", "Banners": "",
"Base Model (From)": "", "Base Model (From)": "",
"Batch Size (num_batch)": "",
"before": "", "before": "",
"Being lazy": "", "Being lazy": "",
"Brave Search API Key": "", "Brave Search API Key": "",
...@@ -518,6 +519,7 @@ ...@@ -518,6 +519,7 @@
"Today": "", "Today": "",
"Toggle settings": "", "Toggle settings": "",
"Toggle sidebar": "", "Toggle sidebar": "",
"Tokens To Keep On Context Refresh (num_keep)": "",
"Tools": "", "Tools": "",
"Top K": "", "Top K": "",
"Top P": "", "Top P": "",
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
"Bad Response": "Respuesta incorrecta", "Bad Response": "Respuesta incorrecta",
"Banners": "Banners", "Banners": "Banners",
"Base Model (From)": "Modelo base (desde)", "Base Model (From)": "Modelo base (desde)",
"Batch Size (num_batch)": "",
"before": "antes", "before": "antes",
"Being lazy": "Ser perezoso", "Being lazy": "Ser perezoso",
"Brave Search API Key": "Clave de API de Brave Search", "Brave Search API Key": "Clave de API de Brave Search",
...@@ -519,6 +520,7 @@ ...@@ -519,6 +520,7 @@
"Today": "Hoy", "Today": "Hoy",
"Toggle settings": "Alternar configuración", "Toggle settings": "Alternar configuración",
"Toggle sidebar": "Alternar barra lateral", "Toggle sidebar": "Alternar barra lateral",
"Tokens To Keep On Context Refresh (num_keep)": "",
"Tools": "", "Tools": "",
"Top K": "Top K", "Top K": "Top K",
"Top P": "Top P", "Top P": "Top P",
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
"Bad Response": "پاسخ خوب نیست", "Bad Response": "پاسخ خوب نیست",
"Banners": "بنر", "Banners": "بنر",
"Base Model (From)": "مدل پایه (از)", "Base Model (From)": "مدل پایه (از)",
"Batch Size (num_batch)": "",
"before": "قبل", "before": "قبل",
"Being lazy": "حالت سازنده", "Being lazy": "حالت سازنده",
"Brave Search API Key": "کلید API جستجوی شجاع", "Brave Search API Key": "کلید API جستجوی شجاع",
...@@ -518,6 +519,7 @@ ...@@ -518,6 +519,7 @@
"Today": "امروز", "Today": "امروز",
"Toggle settings": "نمایش/عدم نمایش تنظیمات", "Toggle settings": "نمایش/عدم نمایش تنظیمات",
"Toggle sidebar": "نمایش/عدم نمایش نوار کناری", "Toggle sidebar": "نمایش/عدم نمایش نوار کناری",
"Tokens To Keep On Context Refresh (num_keep)": "",
"Tools": "", "Tools": "",
"Top K": "Top K", "Top K": "Top K",
"Top P": "Top P", "Top P": "Top P",
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
"Bad Response": "Epäkelpo vastaus", "Bad Response": "Epäkelpo vastaus",
"Banners": "Bannerit", "Banners": "Bannerit",
"Base Model (From)": "Perusmalli (alkaen)", "Base Model (From)": "Perusmalli (alkaen)",
"Batch Size (num_batch)": "",
"before": "ennen", "before": "ennen",
"Being lazy": "Oli laiska", "Being lazy": "Oli laiska",
"Brave Search API Key": "Brave Search API -avain", "Brave Search API Key": "Brave Search API -avain",
...@@ -518,6 +519,7 @@ ...@@ -518,6 +519,7 @@
"Today": "Tänään", "Today": "Tänään",
"Toggle settings": "Kytke asetukset", "Toggle settings": "Kytke asetukset",
"Toggle sidebar": "Kytke sivupalkki", "Toggle sidebar": "Kytke sivupalkki",
"Tokens To Keep On Context Refresh (num_keep)": "",
"Tools": "", "Tools": "",
"Top K": "Top K", "Top K": "Top K",
"Top P": "Top P", "Top P": "Top P",
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
"Bad Response": "Mauvaise réponse", "Bad Response": "Mauvaise réponse",
"Banners": "Bannières", "Banners": "Bannières",
"Base Model (From)": "Modèle de base (à partir de)", "Base Model (From)": "Modèle de base (à partir de)",
"Batch Size (num_batch)": "",
"before": "avant", "before": "avant",
"Being lazy": "En manque de temps", "Being lazy": "En manque de temps",
"Brave Search API Key": "Clé d’API de recherche brave", "Brave Search API Key": "Clé d’API de recherche brave",
...@@ -519,6 +520,7 @@ ...@@ -519,6 +520,7 @@
"Today": "Aujourd'hui", "Today": "Aujourd'hui",
"Toggle settings": "Basculer les paramètres", "Toggle settings": "Basculer les paramètres",
"Toggle sidebar": "Basculer la barre latérale", "Toggle sidebar": "Basculer la barre latérale",
"Tokens To Keep On Context Refresh (num_keep)": "",
"Tools": "", "Tools": "",
"Top K": "Top K", "Top K": "Top K",
"Top P": "Top P", "Top P": "Top P",
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
"Bad Response": "Mauvaise Réponse", "Bad Response": "Mauvaise Réponse",
"Banners": "Bannières", "Banners": "Bannières",
"Base Model (From)": "Modèle de Base (De)", "Base Model (From)": "Modèle de Base (De)",
"Batch Size (num_batch)": "",
"before": "avant", "before": "avant",
"Being lazy": "Est paresseux", "Being lazy": "Est paresseux",
"Brave Search API Key": "Clé API Brave Search", "Brave Search API Key": "Clé API Brave Search",
...@@ -519,6 +520,7 @@ ...@@ -519,6 +520,7 @@
"Today": "Aujourd'hui", "Today": "Aujourd'hui",
"Toggle settings": "Basculer les paramètres", "Toggle settings": "Basculer les paramètres",
"Toggle sidebar": "Basculer la barre latérale", "Toggle sidebar": "Basculer la barre latérale",
"Tokens To Keep On Context Refresh (num_keep)": "",
"Tools": "", "Tools": "",
"Top K": "Top K", "Top K": "Top K",
"Top P": "Top P", "Top P": "Top P",
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
"Bad Response": "תגובה שגויה", "Bad Response": "תגובה שגויה",
"Banners": "באנרים", "Banners": "באנרים",
"Base Model (From)": "דגם בסיס (מ)", "Base Model (From)": "דגם בסיס (מ)",
"Batch Size (num_batch)": "",
"before": "לפני", "before": "לפני",
"Being lazy": "להיות עצלן", "Being lazy": "להיות עצלן",
"Brave Search API Key": "מפתח API של חיפוש אמיץ", "Brave Search API Key": "מפתח API של חיפוש אמיץ",
...@@ -519,6 +520,7 @@ ...@@ -519,6 +520,7 @@
"Today": "היום", "Today": "היום",
"Toggle settings": "החלפת מצב של הגדרות", "Toggle settings": "החלפת מצב של הגדרות",
"Toggle sidebar": "החלפת מצב של סרגל הצד", "Toggle sidebar": "החלפת מצב של סרגל הצד",
"Tokens To Keep On Context Refresh (num_keep)": "",
"Tools": "", "Tools": "",
"Top K": "Top K", "Top K": "Top K",
"Top P": "Top P", "Top P": "Top P",
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
"Bad Response": "ख़राब प्रतिक्रिया", "Bad Response": "ख़राब प्रतिक्रिया",
"Banners": "बैनर", "Banners": "बैनर",
"Base Model (From)": "बेस मॉडल (से)", "Base Model (From)": "बेस मॉडल (से)",
"Batch Size (num_batch)": "",
"before": "पहले", "before": "पहले",
"Being lazy": "आलसी होना", "Being lazy": "आलसी होना",
"Brave Search API Key": "Brave सर्च एपीआई कुंजी", "Brave Search API Key": "Brave सर्च एपीआई कुंजी",
...@@ -518,6 +519,7 @@ ...@@ -518,6 +519,7 @@
"Today": "आज", "Today": "आज",
"Toggle settings": "सेटिंग्स टॉगल करें", "Toggle settings": "सेटिंग्स टॉगल करें",
"Toggle sidebar": "साइडबार टॉगल करें", "Toggle sidebar": "साइडबार टॉगल करें",
"Tokens To Keep On Context Refresh (num_keep)": "",
"Tools": "", "Tools": "",
"Top K": "शीर्ष K", "Top K": "शीर्ष K",
"Top P": "शीर्ष P", "Top P": "शीर्ष P",
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
"Bad Response": "Loš odgovor", "Bad Response": "Loš odgovor",
"Banners": "Baneri", "Banners": "Baneri",
"Base Model (From)": "Osnovni model (Od)", "Base Model (From)": "Osnovni model (Od)",
"Batch Size (num_batch)": "",
"before": "prije", "before": "prije",
"Being lazy": "Biti lijen", "Being lazy": "Biti lijen",
"Brave Search API Key": "Brave tražilica - API ključ", "Brave Search API Key": "Brave tražilica - API ključ",
...@@ -519,6 +520,7 @@ ...@@ -519,6 +520,7 @@
"Today": "Danas", "Today": "Danas",
"Toggle settings": "Prebaci postavke", "Toggle settings": "Prebaci postavke",
"Toggle sidebar": "Prebaci bočnu traku", "Toggle sidebar": "Prebaci bočnu traku",
"Tokens To Keep On Context Refresh (num_keep)": "",
"Tools": "Alati", "Tools": "Alati",
"Top K": "Top K", "Top K": "Top K",
"Top P": "Top P", "Top P": "Top P",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment