Add grammar and dynatemp for aphrodite

This commit is contained in:
Cohee 2024-02-02 20:06:46 +02:00
parent 30213c8430
commit 6d0d92aaff
2 changed files with 5 additions and 4 deletions

View File

@ -1293,7 +1293,7 @@
<input class="neo-range-input" type="number" min="0" max="5" step="1" data-for="prompt_log_probs_aphrodite" id="prompt_log_probs_aphrodite_counter_textgenerationwebui">
</div>
-->
<div data-newbie-hidden data-tg-type="ooba, koboldcpp, tabby, llamacpp" name="dynaTempBlock" class="wide100p">
<div data-newbie-hidden data-tg-type="ooba, koboldcpp, tabby, llamacpp, aphrodite" name="dynaTempBlock" class="wide100p">
<h4 class="wide100p textAlignCenter" data-i18n="DynaTemp">
<div class="flex-container alignitemscenter" style="justify-content: center;">
<div class="checkbox_label" for="dynatemp_textgenerationwebui">
@ -1480,7 +1480,7 @@
</div>
</div>
</div>
<div data-newbie-hidden data-forAphro="False" id="grammar_block_ooba" class="wide100p">
<div data-newbie-hidden id="grammar_block_ooba" class="wide100p">
<hr class="wide100p">
<h4 class="wide100p textAlignCenter" data-i18n="GBNF Grammar">GBNF Grammar
<a href="https://github.com/ggerganov/llama.cpp/blob/master/grammars/README.md" target="_blank">

View File

@ -718,7 +718,7 @@ function parseTextgenLogprobs(token, logprobs) {
switch (settings.type) {
case APHRODITE:
case OOBA: {
/** @type {Record<string, number>[]} */
/** @type {Record<string, number>[]} */
const topLogprobs = logprobs.top_logprobs;
if (!topLogprobs?.length) {
return null;
@ -803,7 +803,7 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
'model': getModel(),
'max_new_tokens': maxTokens,
'max_tokens': maxTokens,
'logprobs': power_user.request_token_probabilities ? 10: undefined,
'logprobs': power_user.request_token_probabilities ? 10 : undefined,
'temperature': settings.dynatemp ? (settings.min_temp + settings.max_temp) / 2 : settings.temp,
'top_p': settings.top_p,
'typical_p': settings.typical_p,
@ -870,6 +870,7 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
'best_of': canMultiSwipe ? settings.n : 1,
'ignore_eos': settings.ignore_eos_token_aphrodite,
'spaces_between_special_tokens': settings.spaces_between_special_tokens_aphrodite,
'grammar': settings.grammar_string,
//'logits_processors': settings.logits_processors_aphrodite,
//'logprobs': settings.log_probs_aphrodite,
//'prompt_logprobs': settings.prompt_log_probs_aphrodite,