@genai-fi/nanogpt 0.5.5 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -91,19 +91,19 @@ class a {
91
91
  }
92
92
  static loadModel(t) {
93
93
  const e = new a();
94
- return f(t).then(({ model: i, tokeniser: o }) => {
95
- e._model = i, e._tokeniser = o, e._config = i.config, e.setStatus("warmup"), m(i).then(() => {
94
+ return f(t).then(({ model: i, tokeniser: s }) => {
95
+ e._model = i, e._tokeniser = s, e._config = i.config, e.setStatus("warmup"), m(i).then(() => {
96
96
  e.setStatus("ready"), e.ee.emit("loaded");
97
- }).catch((s) => {
98
- e.setStatus("error"), e.ee.emit("error", s);
97
+ }).catch((o) => {
98
+ e.setStatus("error"), e.ee.emit("error", o);
99
99
  });
100
100
  }).catch((i) => {
101
101
  e.setStatus("error"), e.ee.emit("error", i);
102
102
  }), e;
103
103
  }
104
104
  static create(t, e = {}) {
105
- const i = { ...h, ...e }, o = t === "char" ? new c(i.vocabSize) : new g(i.vocabSize), s = new l(i), r = new a(o, s);
106
- return r.setStatus("warmup"), m(s).then(() => {
105
+ const i = { ...h, ...e }, s = t === "char" ? new c(i.vocabSize) : new g(i.vocabSize), o = new l(i), r = new a(s, o);
106
+ return r.setStatus("warmup"), m(o).then(() => {
107
107
  r.tokeniser.trained ? (r.setStatus("ready"), r.ee.emit("loaded")) : (r.setStatus("awaitingTokens"), r.ee.emit("loaded"), r.tokeniser.once("trainStatus", (n) => {
108
108
  n === "trained" && r.setStatus("ready");
109
109
  }));
@@ -134,10 +134,10 @@ class a {
134
134
  if (!this._model || !this._tokeniser)
135
135
  throw new Error("Model or tokeniser is not initialized.");
136
136
  const t = new p(this._model, this._tokeniser);
137
- return t.on("start", () => this.setStatus("training")), t.on("stop", () => this.setStatus("ready")), t.on("log", async (e) => {
138
- const i = this.ee.listeners("trainStep");
139
- for (const o of i)
140
- await o(e);
137
+ return t.on("start", () => this.setStatus("training")), t.on("stop", () => this.setStatus("ready")), t.on("log", async (e, i) => {
138
+ const s = this.ee.listeners("trainStep");
139
+ for (const o of s)
140
+ await o(e, i);
141
141
  }), t;
142
142
  }
143
143
  train(t, e) {
package/dist/main.d.ts CHANGED
@@ -8,5 +8,6 @@ export type { ITrainerOptions } from './Trainer';
8
8
  export type { IGenerateOptions } from './Generator';
9
9
  export type { TrainingLogEntry } from './NanoGPTModel';
10
10
  export type { ITokeniser } from './tokeniser/type';
11
+ export type { TrainingProgress } from './training/Trainer';
11
12
  export type { GPTConfig } from './config';
12
13
  export { estimateParameterCount, estimateMemoryUsage, estimateTrainingMemoryUsage, estimateResources, validateConfig, } from './utilities/parameters';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genai-fi/nanogpt",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "type": "module",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",