neetnestor commited on
Commit
668e490
1 Parent(s): 871174e

Add more stats metrics

Browse files
Files changed (4) hide show
  1. dist/index.js +0 -0
  2. package.json +1 -1
  3. src/index.js +14 -4
  4. yarn.lock +4 -4
dist/index.js CHANGED
The diff for this file is too large to render. See raw diff
 
package.json CHANGED
@@ -6,7 +6,7 @@
6
  "build": "webpack --config webpack.config.js"
7
  },
8
  "dependencies": {
9
- "@charliefruan/web-llm": "^0.2.62",
10
  "@sinclair/typebox": "^0.33.16",
11
  "ace-builds": "^1.36.2",
12
  "highlight.js": "^11.10.0"
 
6
  "build": "webpack --config webpack.config.js"
7
  },
8
  "dependencies": {
9
+ "@charliefruan/web-llm": "^0.2.75",
10
  "@sinclair/typebox": "^0.33.16",
11
  "ace-builds": "^1.36.2",
12
  "highlight.js": "^11.10.0"
src/index.js CHANGED
@@ -185,13 +185,23 @@ Patronus is a string.
185
  1
186
  )} tok/s`);
187
  }
188
- if (usage.extra.grammar_init_ms) {
189
- statsTextParts.push(`Grammar Init Overhead: ${usage.extra.grammar_init_ms.toFixed(
190
  0
191
  )} ms`);
192
  }
193
- if (usage.extra.grammar_per_token_ms) {
194
- statsTextParts.push(`Grammar Per-token Overhead: ${usage.extra.grammar_per_token_ms.toFixed(
 
 
 
 
 
 
 
 
 
 
195
  2
196
  )} ms`);
197
  }
 
185
  1
186
  )} tok/s`);
187
  }
188
+ if (usage.extra.time_per_output_token_s) {
189
+ statsTextParts.push(`Time to First Token: ${(1000 * usage.extra.time_per_output_token_s).toFixed(
190
  0
191
  )} ms`);
192
  }
193
+ if (usage.extra.time_to_first_token_s) {
194
+ statsTextParts.push(`Time Per Output Token: ${(1000 * usage.extra.time_to_first_token_s).toFixed(
195
+ 0
196
+ )} ms`);
197
+ }
198
+ if (usage.extra.grammar_init_s) {
199
+ statsTextParts.push(`Grammar Init Overhead: ${(1000 * usage.extra.grammar_init_s).toFixed(
200
+ 0
201
+ )} ms`);
202
+ }
203
+ if (usage.extra.grammar_per_token_s) {
204
+ statsTextParts.push(`Grammar Per-token Overhead: ${(1000 * usage.extra.grammar_per_token_s).toFixed(
205
  2
206
  )} ms`);
207
  }
yarn.lock CHANGED
@@ -802,10 +802,10 @@
802
  "@babel/helper-validator-identifier" "^7.25.7"
803
  to-fast-properties "^2.0.0"
804
 
805
- "@charliefruan/web-llm@^0.2.62":
806
- version "0.2.74"
807
- resolved "https://registry.yarnpkg.com/@charliefruan/web-llm/-/web-llm-0.2.74.tgz#2f2860ba15944dfada52dbae9e5c426ca9cae00a"
808
- integrity sha512-5qBdkHLLQQQHhtIzgJ6no05DjnnblDiiCG2/2IpHwf/GemqpIy7NcU866zaWCMFTdHyuQPwUR3ZSBckdPynUYA==
809
  dependencies:
810
  loglevel "^1.9.1"
811
 
 
802
  "@babel/helper-validator-identifier" "^7.25.7"
803
  to-fast-properties "^2.0.0"
804
 
805
+ "@charliefruan/web-llm@^0.2.75":
806
+ version "0.2.75"
807
+ resolved "https://registry.yarnpkg.com/@charliefruan/web-llm/-/web-llm-0.2.75.tgz#82dd22b8c540c796c779b4d1ec136e096fab8e46"
808
+ integrity sha512-L7UB5nnhJ/hQax20DgH5njw0MR3MQCI/UHppdGpN1WcPDvTr01pwhEEm0NDMopKdYgFASwcHOYC4TwMzc1ngDg==
809
  dependencies:
810
  loglevel "^1.9.1"
811