@genai-fi/nanogpt 1.7.1 → 1.7.2
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.
- package/dist/nanogpt.js +4 -6
- package/package.json +1 -1
package/dist/nanogpt.js
CHANGED
|
@@ -32578,17 +32578,15 @@ var RW = {
|
|
|
32578
32578
|
for (; this.running;) {
|
|
32579
32579
|
let e = await f;
|
|
32580
32580
|
if (f = d.next(), e.done) break;
|
|
32581
|
-
let n = e.value, a = Date.now(), c = a
|
|
32582
|
-
c && (l = a);
|
|
32583
|
-
let p = (t?.metrics?.includes("gradientStatistics") || !1) && c, m = this.trainStep(s, n, !1, p, c);
|
|
32581
|
+
let n = e.value, a = Date.now() - l >= i, c = (t?.metrics?.includes("gradientStatistics") || !1) && a, p = this.trainStep(s, n, !1, c, a);
|
|
32584
32582
|
if (t.debug) {
|
|
32585
|
-
let e = (await
|
|
32583
|
+
let e = (await p.data())[0];
|
|
32586
32584
|
if (isNaN(e) || !isFinite(e)) throw console.error("Invalid loss value:", e), console.error("Batch xs:", await n.xs.array()), console.error("Batch ys:", await n.ys.array()), console.error("State:", s), Error("Loss is NaN or Infinity");
|
|
32587
32585
|
console.log(`Step ${s.step}: Loss = ${e}`);
|
|
32588
32586
|
}
|
|
32589
32587
|
n.xs.dispose(), n.ys.dispose(), s.step++, s.totalSteps++;
|
|
32590
|
-
let
|
|
32591
|
-
|
|
32588
|
+
let m = s.step >= o;
|
|
32589
|
+
a || m ? (await this.performLogging(p, n.xs.shape[0], u, r), l = Date.now()) : (s.gradientNorm &&= (s.gradientNorm.dispose(), void 0), s.accuracy &&= (s.accuracy.dispose(), void 0)), p.dispose(), m && this.stop();
|
|
32592
32590
|
}
|
|
32593
32591
|
} catch (e) {
|
|
32594
32592
|
throw console.error("Training error:", e), z(), e;
|