fix firstToken, minor ui changes (#971)

This commit is contained in:
Radamés Ajna
2023-09-26 22:01:59 -07:00
committed by GitHub
parent ce0a4e3a85
commit 9571b200c9
2 changed files with 101 additions and 100 deletions

View File

@ -50,6 +50,7 @@ async function generate(data) {
tokenizerURL,
prompt,
temp,
top_p,
repeatPenalty,
seed,
maxSeqLen,
@ -59,11 +60,17 @@ async function generate(data) {
const model = await Llama2C.getInstance(weightsURL, modelID, tokenizerURL);
self.postMessage({ status: "loading", message: "Initializing model" });
model.init_with_prompt(prompt, temp, repeatPenalty, seed);
const firstToken = model.init_with_prompt(
prompt,
temp,
top_p,
repeatPenalty,
seed
);
const seq_len = model.get_seq_len();
let sentence = "";
let sentence = firstToken;
let maxTokens = maxSeqLen ? maxSeqLen : seq_len - prompt.length - 1;
let startTime = performance.now();
let tokensCount = 0;