@genai-fi/nanogpt 0.2.3 → 0.2.5
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/TeachableLLM.js +6 -4
- package/dist/data/docx.d.ts +1 -0
- package/dist/data/docx.js +15 -0
- package/dist/data/parquet.js +7 -5
- package/dist/data/pdf.d.ts +1 -0
- package/dist/data/pdf.js +14 -0
- package/dist/data/textLoader.js +24 -14
- package/dist/index-D5v913EJ.js +4 -0
- package/dist/{index-B8nyc6IR.js → index-DcaSvB38.js} +462 -506
- package/dist/index-Tf7vU29b.js +1023 -0
- package/dist/index-xuotMAFm.js +118 -0
- package/dist/{jszip.min-pMIn3RZH.js → jszip.min-CjP2V1VV.js} +42 -52
- package/dist/layers/TiedEmbedding.js +1 -1
- package/dist/parquet-BRl5lE_I.js +44956 -0
- package/dist/pdf-kJD-f258.js +19481 -0
- package/dist/training/AdamExt.js +1 -1
- package/dist/utilities/load.js +5 -5
- package/dist/utilities/save.js +1 -1
- package/package.json +4 -2
- package/dist/parquet-DpcqBLb0.js +0 -39727
package/dist/data/textLoader.js
CHANGED
|
@@ -1,43 +1,53 @@
|
|
|
1
|
-
import { p as
|
|
2
|
-
import { loadParquet as
|
|
3
|
-
|
|
1
|
+
import { p as s } from "../papaparse.min-C8l2Kvo1.js";
|
|
2
|
+
import { loadParquet as u } from "./parquet.js";
|
|
3
|
+
import { loadPDF as m } from "./pdf.js";
|
|
4
|
+
import { loadDOCX as f } from "./docx.js";
|
|
5
|
+
function l(e, t) {
|
|
4
6
|
const r = e.findIndex((n) => n.toLowerCase() === t.toLowerCase());
|
|
5
7
|
return r === -1 ? 0 : r;
|
|
6
8
|
}
|
|
7
|
-
function
|
|
9
|
+
function x(e) {
|
|
8
10
|
return e.every((t) => t.length < 64);
|
|
9
11
|
}
|
|
10
|
-
function
|
|
12
|
+
function w(e) {
|
|
11
13
|
return e.split(".").pop() || "";
|
|
12
14
|
}
|
|
13
|
-
function
|
|
14
|
-
switch (
|
|
15
|
+
function h(e) {
|
|
16
|
+
switch (w(e)) {
|
|
15
17
|
case "parquet":
|
|
16
18
|
return "application/parquet";
|
|
17
19
|
case "csv":
|
|
18
20
|
return "text/csv";
|
|
19
21
|
case "txt":
|
|
20
22
|
return "text/plain";
|
|
23
|
+
case "pdf":
|
|
24
|
+
return "application/pdf";
|
|
25
|
+
case "docx":
|
|
26
|
+
return "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
21
27
|
default:
|
|
22
28
|
return "unknown";
|
|
23
29
|
}
|
|
24
30
|
}
|
|
25
|
-
async function
|
|
26
|
-
const r = e.type !== "" ? e.type :
|
|
31
|
+
async function C(e, t) {
|
|
32
|
+
const r = e.type !== "" ? e.type : h(e.name);
|
|
27
33
|
if (r === "application/parquet")
|
|
28
|
-
return
|
|
34
|
+
return u(e, t?.maxSize, t?.column);
|
|
35
|
+
if (r === "application/pdf")
|
|
36
|
+
return m(e, t?.maxSize);
|
|
37
|
+
if (r === "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
|
|
38
|
+
return f(e);
|
|
29
39
|
if (r === "text/csv") {
|
|
30
40
|
const n = await e.text();
|
|
31
41
|
return new Promise((c, o) => {
|
|
32
|
-
|
|
42
|
+
s.parse(n, {
|
|
33
43
|
header: !1,
|
|
34
44
|
skipEmptyLines: !0,
|
|
35
45
|
complete: (a) => {
|
|
36
46
|
if (a.errors.length > 0)
|
|
37
47
|
o(new Error("Error parsing file"));
|
|
38
48
|
else {
|
|
39
|
-
const p =
|
|
40
|
-
c(i.map((
|
|
49
|
+
const p = l(a.data[0], t?.column || "text"), i = t?.hasHeader ?? x(a.data[0]) ? a.data.slice(1) : a.data;
|
|
50
|
+
c(i.map((d) => d[p]));
|
|
41
51
|
}
|
|
42
52
|
},
|
|
43
53
|
error: (a) => {
|
|
@@ -50,5 +60,5 @@ async function g(e, t) {
|
|
|
50
60
|
throw new Error(`Unsupported file type: ${r}`);
|
|
51
61
|
}
|
|
52
62
|
export {
|
|
53
|
-
|
|
63
|
+
C as default
|
|
54
64
|
};
|