MCPcopy Create free account
hub / github.com/0hq/WebGPT / load

Method load

tokenizer.js:30–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28 }
29
30 async load() {
31 console.log("Loading simple tokenizer...");
32 this.encoder = await (await fetch("weights/tokenization/simple_tokens.json")).json();
33 this.decoder = Object.keys(this.encoder).reduce((acc, x) => ({ ...acc, [this.encoder[x]]: x }), {});
34 this.vocab_size = Object.keys(this.encoder).length;
35 }
36
37 encode(str) {
38 return str.split("").map((x) => this.encoder[x]);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected