@mineproness/tensorloop 1.0.0 → 1.0.1
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/index.js +3 -1
- package/logo.png +0 -0
- package/package.json +23 -22
- package/readme.md +71 -0
- package/src/Embedding/index.d.ts +2 -2
- package/src/Linear/index.d.ts +2 -2
- package/src/Linear/index.js +1 -1
- package/src/ReLU/index.d.ts +4 -0
- package/src/Softmax/index.d.ts +1 -1
- package/src/Tokenizer/vocabs.json +28999 -28999
- package/src/tools/index.d.ts +3 -0
- package/src/tools/index.js +5 -0
package/index.js
CHANGED
|
@@ -3,8 +3,10 @@ import { Embedding as embeddding2 } from "./src/Embedding/index.js";
|
|
|
3
3
|
import { Linear as li2 } from "./src/Linear/index.js";
|
|
4
4
|
import { Softmax as softmax2 } from "./src/Softmax/index.js";
|
|
5
5
|
import { crossEntropy } from "./src/crossEntropy/index.js";
|
|
6
|
+
import {tools} from './src/tools/index.js'
|
|
6
7
|
export const Tokenizer = tokenizer
|
|
7
8
|
export const Embedding = embeddding2
|
|
8
9
|
export const Linear = li2
|
|
9
10
|
export const Softmax = softmax2
|
|
10
|
-
export const CrossEntropy = crossEntropy
|
|
11
|
+
export const CrossEntropy = crossEntropy
|
|
12
|
+
export const Tools = tools
|
package/logo.png
ADDED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@mineproness/tensorloop",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "The most powerfull Machine Learing Libeary for AI.",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"ai",
|
|
7
|
-
"llm",
|
|
8
|
-
"Large",
|
|
9
|
-
"Language",
|
|
10
|
-
"model",
|
|
11
|
-
"Small",
|
|
12
|
-
"Language",
|
|
13
|
-
"Model"
|
|
14
|
-
],
|
|
15
|
-
"license": "MIT",
|
|
16
|
-
"author": "mineproness",
|
|
17
|
-
"type": "module",
|
|
18
|
-
"main": "index.js",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@mineproness/tensorloop",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "The most powerfull Machine Learing Libeary for AI.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ai",
|
|
7
|
+
"llm",
|
|
8
|
+
"Large",
|
|
9
|
+
"Language",
|
|
10
|
+
"model",
|
|
11
|
+
"Small",
|
|
12
|
+
"Language",
|
|
13
|
+
"Model"
|
|
14
|
+
],
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"author": "mineproness",
|
|
17
|
+
"type": "module",
|
|
18
|
+
"main": "index.js",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/mineproness-org/tensorloop.git"
|
|
22
|
+
}
|
|
23
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
A Library that Supply AI Tools and Large Language model Development tools like Embedding, Linear, ReLU, softmax etc...
|
|
4
|
+
|
|
5
|
+
## Feature
|
|
6
|
+
|
|
7
|
+
- Embedding Vectors.
|
|
8
|
+
- Linear Weights and Bias.
|
|
9
|
+
- Softmax forward and Backward.
|
|
10
|
+
- CrossEntroy for Loss Calculation.
|
|
11
|
+
- Relu for Stable Layer.
|
|
12
|
+
- Tokenizer for convert into tokens.
|
|
13
|
+
|
|
14
|
+
## Configs
|
|
15
|
+
|
|
16
|
+
You can Pass a Object in a embedding and linear function. like :-
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
import {Embedding , linear} from '@mineproness/tensorloop'
|
|
20
|
+
|
|
21
|
+
const embedding = new Embedding(1024, 2000, {
|
|
22
|
+
save: {
|
|
23
|
+
filename: "./model/vectors.bin"
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
const linear = new Embedding(1024, 2000, {
|
|
27
|
+
save: {
|
|
28
|
+
filename: ["./model/Weights.bin" , "./model/Bias.bin"]
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Linear Layer need a filename array because it need to save the Weights and Bias and always use bin extension.
|
|
34
|
+
|
|
35
|
+
## Optimizations
|
|
36
|
+
|
|
37
|
+
It is Highly Fast Because of Float 32 Array and it is can handle 1024 embedding Size.
|
|
38
|
+
We build that with Raw Javascript for Best Optimization.
|
|
39
|
+
|
|
40
|
+
## Tokenizer
|
|
41
|
+
|
|
42
|
+
It is main use to Split Words and Convert into token ids that can be again Deconvert.
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
like this Exmple
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
import { Tokenizer } from '@mineproness/tensorloop'
|
|
49
|
+
|
|
50
|
+
const tokenizer = new Tokenizer()
|
|
51
|
+
const text = "Hello, Wellcome to My Channel."
|
|
52
|
+
|
|
53
|
+
const { tokenIDs } = tokenizer.encoder(text) // ["hello", "$12" , "well" , "come", "$130"....]
|
|
54
|
+
const decoded = tokenizer.decoder(tokenIDs) // Hello, wellcome to my channel.
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
## Suggestion
|
|
58
|
+
|
|
59
|
+
I Recomened that use TypeScript for Type Safety and know what function is Exist in classes.
|
|
60
|
+
|
|
61
|
+
And Always Pair with Your tools in your Package like
|
|
62
|
+
```js
|
|
63
|
+
import {Tools} from '@mineproness/tensorloop'
|
|
64
|
+
|
|
65
|
+
const tools = new Tools()
|
|
66
|
+
|
|
67
|
+
console.log(tools.betterVector(embeedingVectors))
|
|
68
|
+
```
|
|
69
|
+
## Thanks for Visiting this Site
|
|
70
|
+
|
|
71
|
+
If You watching this, Please give me a star in Github.
|
package/src/Embedding/index.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ export class Embedding{
|
|
|
5
5
|
filename: string
|
|
6
6
|
}
|
|
7
7
|
})
|
|
8
|
-
forward(token: number | number[]) :
|
|
9
|
-
backward(token: number , inputGradient: number[], learingRate: number) : void
|
|
8
|
+
forward(token: number | number[]) : Float32Array[] | Float32Array[][]
|
|
9
|
+
backward(token: number , inputGradient: number[] | Float32Array[], learingRate: number) : void
|
|
10
10
|
}
|
package/src/Linear/index.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ export class Linear{
|
|
|
6
6
|
filename: string[]
|
|
7
7
|
}
|
|
8
8
|
})
|
|
9
|
-
forward(input : number[]) :
|
|
10
|
-
backward(outGradient : number[] , learingRate: number) :
|
|
9
|
+
forward(input : number[]) : Float32Array[]
|
|
10
|
+
backward(outGradient : number[] , learingRate: number) : Float32Array[]
|
|
11
11
|
}
|
package/src/Linear/index.js
CHANGED
|
@@ -45,7 +45,7 @@ export class Linear {
|
|
|
45
45
|
}
|
|
46
46
|
forward(input) {
|
|
47
47
|
this.input = input
|
|
48
|
-
const output =
|
|
48
|
+
const output = new Float32Array(this.Weights.length)
|
|
49
49
|
for (let a = 0; a < this.Weights.length; a++) {
|
|
50
50
|
let sum = this.Bias[a]
|
|
51
51
|
for (let t = 0; t < input.length; t++) {
|
package/src/Softmax/index.d.ts
CHANGED