Skip to content

Commit

Permalink
Add parameters for LLM sampling (#324)
Browse files Browse the repository at this point in the history
* Add parameters for sampling

* Update index.js

* Update index.js
  • Loading branch information
Linchenn authored Mar 25, 2024
1 parent d863beb commit 252a41d
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions examples/llm_inference/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,25 @@ async function runDemo() {

submit.value = 'Loading the model...'
LlmInference
.createFromModelPath(genaiFileset, modelFileName)
.createFromOptions(genaiFileset, {
baseOptions: {modelAssetPath: modelFileName},
// maxTokens: 512, // The maximum number of tokens (input tokens + output
// // tokens) the model handles.
// randomSeed: 1, // The random seed used during text generation.
// topK: 1, // The number of tokens the model considers at each step of
// // generation. Limits predictions to the top k most-probable
// // tokens. Setting randomSeed is required for this to make
// // effects.
// temperature:
// 1.0, // The amount of randomness introduced during generation.
// // Setting randomSeed is required for this to make effects.
})
.then(llm => {
llmInference = llm;
submit.disabled = false;
submit.value = 'Get Response'
}).catch(() =>{
})
.catch(() => {
alert('Failed to initialize the task.');
});
}
Expand Down

0 comments on commit 252a41d

Please sign in to comment.