From 2cdcf54dd84d5df44e5f9adc305c6bd28a2a3260 Mon Sep 17 00:00:00 2001 From: mappu Date: Sat, 8 Apr 2023 15:48:16 +1200 Subject: [PATCH] webui: synchronize context size value for clientside warning --- api.go | 22 +++++++++++----------- webui.go | 6 ++++-- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/api.go b/api.go index be2faf2..8bd059f 100644 --- a/api.go +++ b/api.go @@ -12,6 +12,17 @@ import ( */ import "C" +// Constant LLaMA parameters + +const ( + ParamContextSize = 512 // RAM requirements: 512 needs 800MB KV (~3216MB overall), 2048 needs 3200MB KV (~??? overall) + ParamTopK = 40 + ParamTopP = 0.95 + ParamTemperature = 0.08 + ParamRepeatPenalty = 1.10 + ParamRepeatPenaltyWindowSize = 64 +) + func (this *Application) POST_Chat(w http.ResponseWriter, r *http.Request) { flusher, ok := w.(http.Flusher) if !ok { @@ -52,17 +63,6 @@ func (this *Application) POST_Chat(w http.ResponseWriter, r *http.Request) { w.WriteHeader(200) flusher.Flush() // Flush before any responses, so the webui knows things are happening - // Constant LLaMA parameters - - const ( - ParamContextSize = 512 // RAM requirements: 512 needs 800MB KV (~3216MB overall), 2048 needs 3200MB KV (~??? overall) - ParamTopK = 40 - ParamTopP = 0.95 - ParamTemperature = 0.08 - ParamRepeatPenalty = 1.10 - ParamRepeatPenaltyWindowSize = 64 - ) - // Start a new LLaMA session lparams := C.llama_context_default_params() diff --git a/webui.go b/webui.go index 9ad08f0..90e3339 100644 --- a/webui.go +++ b/webui.go @@ -1,6 +1,7 @@ package main import ( + "fmt" "html" "net/http" @@ -44,7 +45,8 @@ button {