@mineproness/tensorloop 2.1.54 → 2.1.55

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mineproness/tensorloop",
3
- "version": "2.1.54",
3
+ "version": "2.1.55",
4
4
  "description": "Raw-JAVASCRIPT Based Matirx and AI LLM Package called Tensorloop.",
5
5
  "keywords": [
6
6
  "ai",
@@ -1,7 +1,10 @@
1
- export default class Model{
1
+ export default class Model {
2
2
  constructor(embeddingSize: number, contextSize: number, configs: {
3
3
  dirname: string,
4
4
  activation: "gelu" | "relu",
5
5
  })
6
- train(text: string, batchSize: number, batchExecution: number, epochs: number, learningRate: number) : void
7
- }
6
+ train(pair: {
7
+ inputIDX: number[],
8
+ targetIDX: number[]
9
+ }[], batchSize: number, batchExecution: number, epochs: number, learningRate: number): void
10
+ }
@@ -38,18 +38,13 @@ export default class Model {
38
38
  activation: configs.activation
39
39
  })
40
40
  }
41
- train(text = "", epochs = 500, learningRate = 0.01) {
41
+ train(pair = {
42
+ inputIDX: [],
43
+ targetIDX: []
44
+ }, epochs = 500, learningRate = 0.01) {
42
45
  process.stdout.write("\x1Bc")
43
46
  console.log("Preparing Training Pairs....")
44
- const tokens = text.split(/\r?\n/).map((e) => e.trim()).filter((e) => e.length > 0).map((e) => e + " <EOS>").map((e) => this.tokenizer.encoder(e).tokenIDs).flat()
45
- const trainingPair = []
46
- for (let a = 0; a + this.contextSize < tokens.length; a++) {
47
- trainingPair.push({
48
- inputIDX: tokens.slice(a, a + this.contextSize),
49
- targetIDX: tokens.slice(a + 1, a + this.contextSize + 1)
50
- })
51
- if (trainingPair.length == 4000) break;
52
- }
47
+ const trainingPair = pair
53
48
  let firstRun = true;
54
49
  console.log(`TotalPairs: ${trainingPair.length}`)
55
50
  if (trainingPair.length == 0 || !trainingPair) throw new Error(`The Batch Execution ${batchExecution} is doesn't exist.`);