Skip to content

Commit

Permalink
fix: local generations not considering n_predict for context building
Browse files Browse the repository at this point in the history
  • Loading branch information
Vali-98 committed Jul 30, 2024
1 parent cff18ad commit 01570c6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/constants/APIState/LocalAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@ class LocalAPI extends APIBase {
buildPayload = () => {
const payloadFields = this.getSamplerFields()
const rep_pen = payloadFields?.['penalty_repeat']
const n_predict =
(typeof payloadFields?.['n_predict'] === 'number' && payloadFields?.['n_predict']) || 0

const localPreset: LlamaPreset = this.getObject(Global.LocalPreset)
return {
...payloadFields,
penalize_nl: typeof rep_pen === 'number' && rep_pen > 1,
n_threads: localPreset.threads,
prompt: this.buildTextCompletionContext(localPreset.context_length),
prompt: this.buildTextCompletionContext(localPreset.context_length - n_predict),
stop: this.constructStopSequence(),
emit_partial_completion: true,
}
Expand Down

0 comments on commit 01570c6

Please sign in to comment.