added presence penalty into lite ui
This commit is contained in:
parent
b814bb217d
commit
8823e8b06d
3 changed files with 17 additions and 5 deletions
|
@ -398,7 +398,7 @@ void sample_rep_pen(int n_ctx, int rep_pen_range, float rep_pen, float presence_
|
||||||
llama_token_data_array * candidates = candidates_p;
|
llama_token_data_array * candidates = candidates_p;
|
||||||
float penalty = rep_pen;
|
float penalty = rep_pen;
|
||||||
|
|
||||||
if (last_tokens_size == 0 || penalty == 1.0f) {
|
if (last_tokens_size == 0 || (penalty == 1.0f && presence_penalty==0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
18
klite.embd
18
klite.embd
File diff suppressed because one or more lines are too long
|
@ -444,7 +444,7 @@ class ServerRequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||||
genparams["max_length"] = genparams.get('max_tokens', 100)
|
genparams["max_length"] = genparams.get('max_tokens', 100)
|
||||||
presence_penalty = genparams.get('presence_penalty', genparams.get('frequency_penalty', 0.0))
|
presence_penalty = genparams.get('presence_penalty', genparams.get('frequency_penalty', 0.0))
|
||||||
genparams["presence_penalty"] = presence_penalty
|
genparams["presence_penalty"] = presence_penalty
|
||||||
if presence_penalty > 0:
|
if presence_penalty > 0 and (genparams.get('rep_pen', 0)==0):
|
||||||
genparams["rep_pen"] = 1.0
|
genparams["rep_pen"] = 1.0
|
||||||
# openai allows either a string or a list as a stop sequence
|
# openai allows either a string or a list as a stop sequence
|
||||||
if isinstance(genparams.get('stop',[]), list):
|
if isinstance(genparams.get('stop',[]), list):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue