Skip to content

Commit 391254a

Browse files
committed
Clean up code and rename sanity-checks
1 parent d714736 commit 391254a

File tree

6 files changed

+4
-37
lines changed

6 files changed

+4
-37
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,5 +324,4 @@ node_modules
324324
lib
325325
.parcel-cache
326326

327-
examples/tests
328327
**/.next

examples/get-started-latency-breakdown/src/get_started_latency_breakdown.ts

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ async function main() {
4545
setLabel("init-label", report.text);
4646
};
4747
// Option 1: If we do not specify appConfig, we use `prebuiltAppConfig` defined in `config.ts`
48-
// const selectedModel = "Llama-3.1-8B-Instruct-q4f32_1-MLC";
4948
const selectedModel = "Qwen3-0.6B-q0f32-MLC";
5049
const engine: webllm.MLCEngineInterface = await webllm.CreateMLCEngine(
5150
selectedModel,
@@ -61,34 +60,6 @@ async function main() {
6160
},
6261
);
6362

64-
// Option 2: Specify your own model other than the prebuilt ones
65-
// const appConfig: webllm.AppConfig = {
66-
// model_list: [
67-
// {
68-
// model: "https://huggingface.co/mlc-ai/Llama-3.1-8B-Instruct-q4f32_1-MLC",
69-
// model_id: "Llama-3.1-8B-Instruct-q4f32_1-MLC",
70-
// model_lib:
71-
// webllm.modelLibURLPrefix +
72-
// webllm.modelVersion +
73-
// "/Llama-3_1-8B-Instruct-q4f32_1-ctx4k_cs1k-webgpu.wasm",
74-
// overrides: {
75-
// context_window_size: 2048,
76-
// },
77-
// },
78-
// ],
79-
// };
80-
// const engine: webllm.MLCEngineInterface = await webllm.CreateMLCEngine(
81-
// selectedModel,
82-
// { appConfig: appConfig, initProgressCallback: initProgressCallback },
83-
// );
84-
85-
// Option 3: Instantiate MLCEngine() and call reload() separately
86-
// const engine: webllm.MLCEngineInterface = new webllm.MLCEngine({
87-
// appConfig: appConfig, // if do not specify, we use webllm.prebuiltAppConfig
88-
// initProgressCallback: initProgressCallback,
89-
// });
90-
// await engine.reload(selectedModel);
91-
9263
const latencyBreakdown: LatencyBreakdown = {
9364
logitProcessorTime: [],
9465
logitBiasTime: [],
@@ -97,7 +68,7 @@ async function main() {
9768
totalTime: [],
9869
grammarBitmaskTime: [],
9970
};
100-
// want decode_tokens_per_s, e2e_latency_s, time_per_output_token_s, completion_tokens
71+
10172
const decodeTokensPerS: number[] = [];
10273
const completionTokens: number[] = [];
10374
const e2eLatencyS: number[] = [];
File renamed without changes.

examples/sanity-checks/package.json renamed to examples/tests/scripts/sanity_checks/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"name": "sanity-checks",
2+
"name": "tests",
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {
6-
"start": "parcel src/sanity_checks.html --port 8889",
7-
"build": "parcel build src/sanity_checks.html --dist-dir lib"
6+
"start": "parcel sanity_checks.html --port 8889",
7+
"build": "parcel build sanity_checks.html --dist-dir lib"
88
},
99
"devDependencies": {
1010
"buffer": "^5.7.1",
File renamed without changes.

examples/sanity-checks/src/sanity_checks.ts renamed to examples/tests/scripts/sanity_checks/sanity_checks.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ async function testLogitProcessor(
7171
async function testLogitBias(modelId: string, appConfig: webllm.AppConfig) {
7272
// Set logit_bias to strongly favor token 0
7373
const prompt = "Test logit bias.";
74-
// const t0 = performance.now();
7574
const engine: webllm.MLCEngineInterface = await createEngine(
7675
modelId,
7776
appConfig,
@@ -128,7 +127,6 @@ async function testPenalties(modelId: string, appConfig: webllm.AppConfig) {
128127
async function testLogprobs(modelId: string, appConfig: webllm.AppConfig) {
129128
// Test logprobs: check that logprobs are returned and sum to ~1 after exp
130129
const prompt = "Test logprobs.";
131-
const t0 = performance.now();
132130
const engine: webllm.MLCEngineInterface = await createEngine(
133131
modelId,
134132
appConfig,
@@ -140,7 +138,6 @@ async function testLogprobs(modelId: string, appConfig: webllm.AppConfig) {
140138
logprobs: true,
141139
top_logprobs: 5,
142140
});
143-
const t1 = performance.now();
144141
const logprobs = reply.choices[0]?.logprobs;
145142

146143
let logprobsAllCloseTo1 = true;

0 commit comments

Comments
 (0)