You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ChatModule] Add GenerationConfig and set up unit tests (mlc-ai#298)
This PR adds `GenerationConfig`, which allows per-generation configs.
See `get-started.ts` for its example usage:
```typescript
let genConfig: webllm.GenerationConfig = {
presence_penalty: 0.5,
frequency_penalty: 0.5,
max_gen_len: 20,
// stop: ["is", "Canada"] // for demonstration purpose
}
const prompt0 = "What is the capital of Canada?";
const reply0 = await chat.generate(prompt0, generateProgressCallback, 1, genConfig);
```
In addition to the existing fields in `mlc-chat-config.json`, we also
support OpenAI-like fields `frequency_penalty`, `presence_penalty`, and
`stop` to prepare for the incoming OpenAI-like APIs.
This PR also sets up unit tests; use `npm test` to run tests. However,
some work needs to be done to support end-to-end testing (e.g. accessing
WebGPU in a test environment).
All prebuilt WASMs are updated correspondingly:
mlc-ai/binary-mlc-llm-libs#90 as we introduced a
new API in tvmjs's `runtime.ts` via
apache/tvm#16504.
Note that the update of Llama WASMs is breaking in the sense that users
will have to update their WebLLM npm.
0 commit comments