@cyberlangke/tokkit-microsoft 1.1.0

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/index.cjs ADDED
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var index_exports = {};
21
+ __export(index_exports, {
22
+ registerBuiltins: () => registerBuiltins
23
+ });
24
+ module.exports = __toCommonJS(index_exports);
25
+ var import_tokkit_core = require("@cyberlangke/tokkit-core");
26
+ __reExport(index_exports, require("@cyberlangke/tokkit-core"), module.exports);
27
+ const BUILTIN_FAMILIES = [
28
+ {
29
+ family: "phi-1",
30
+ aliases: ["phi1", "phi_1"],
31
+ models: ["microsoft/phi-1", "microsoft/phi-1_5", "microsoft/phi-2"],
32
+ modulePath: "./generated/phi_1.js"
33
+ },
34
+ {
35
+ family: "phi-3-mini",
36
+ aliases: ["phi3-mini", "phi_3_mini"],
37
+ models: ["microsoft/Phi-3-mini-4k-instruct", "microsoft/Phi-3-mini-128k-instruct"],
38
+ modulePath: "./generated/phi_3_mini.js"
39
+ },
40
+ {
41
+ family: "phi-3-medium",
42
+ aliases: ["phi3-medium", "phi_3_medium"],
43
+ models: [
44
+ "microsoft/Phi-3-medium-4k-instruct",
45
+ "microsoft/Phi-3-medium-128k-instruct"
46
+ ],
47
+ modulePath: "./generated/phi_3_medium.js"
48
+ },
49
+ {
50
+ family: "phi-3.5",
51
+ aliases: ["phi3.5", "phi_3_5"],
52
+ models: ["microsoft/Phi-3.5-mini-instruct", "microsoft/Phi-3.5-MoE-instruct"],
53
+ modulePath: "./generated/phi_3_5.js"
54
+ },
55
+ {
56
+ family: "phi-4",
57
+ aliases: ["phi4", "phi_4"],
58
+ models: ["microsoft/phi-4"],
59
+ modulePath: "./generated/phi_4.js"
60
+ },
61
+ {
62
+ family: "phi-4-mini",
63
+ aliases: ["phi4-mini", "phi_4_mini"],
64
+ models: ["microsoft/Phi-4-mini-instruct"],
65
+ modulePath: "./generated/phi_4_mini.js"
66
+ },
67
+ {
68
+ family: "phi-4-mini-flash",
69
+ aliases: ["phi4-mini-flash", "phi_4_mini_flash"],
70
+ models: ["microsoft/Phi-4-mini-flash-reasoning"],
71
+ modulePath: "./generated/phi_4_mini_flash.js"
72
+ },
73
+ {
74
+ family: "phi-4-mini-reasoning",
75
+ aliases: ["phi4-mini-reasoning", "phi_4_mini_reasoning"],
76
+ models: ["microsoft/Phi-4-mini-reasoning"],
77
+ modulePath: "./generated/phi_4_mini_reasoning.js"
78
+ },
79
+ {
80
+ family: "phi-4-reasoning",
81
+ aliases: ["phi4-reasoning", "phi_4_reasoning"],
82
+ models: ["microsoft/Phi-4-reasoning", "microsoft/Phi-4-reasoning-plus"],
83
+ modulePath: "./generated/phi_4_reasoning.js"
84
+ },
85
+ {
86
+ family: "phi-moe",
87
+ aliases: ["phi_moe"],
88
+ models: ["microsoft/Phi-mini-MoE-instruct", "microsoft/Phi-tiny-MoE-instruct"],
89
+ modulePath: "./generated/phi_moe.js"
90
+ }
91
+ ];
92
+ function registerBuiltins() {
93
+ for (const spec of BUILTIN_FAMILIES) {
94
+ (0, import_tokkit_core.registerTokenizerFamily)({
95
+ family: spec.family,
96
+ aliases: [...spec.aliases],
97
+ models: [...spec.models],
98
+ load: () => loadFamilyAsset(spec.modulePath)
99
+ });
100
+ }
101
+ }
102
+ async function loadFamilyAsset(modulePath) {
103
+ const module2 = await import(modulePath);
104
+ return (0, import_tokkit_core.unpackPackedAsset)(module2.default);
105
+ }
106
+ registerBuiltins();
107
+ // Annotate the CommonJS export names for ESM import in node:
108
+ 0 && (module.exports = {
109
+ registerBuiltins,
110
+ ...require("@cyberlangke/tokkit-core")
111
+ });
@@ -0,0 +1,16 @@
1
+ export * from '@cyberlangke/tokkit-core';
2
+
3
+ /**
4
+ * Microsoft family 包公共入口。
5
+ * 输入:Microsoft family 名称或其模型别名。
6
+ * 输出:自动注册 Microsoft 内置 family,并复用 core 的公共 API。
7
+ */
8
+
9
+ /**
10
+ * 注册 Microsoft 子包内置的 family。
11
+ * 输入:无。
12
+ * 输出:Microsoft 相关 family 被写入全局注册表。
13
+ */
14
+ declare function registerBuiltins(): void;
15
+
16
+ export { registerBuiltins };
@@ -0,0 +1,16 @@
1
+ export * from '@cyberlangke/tokkit-core';
2
+
3
+ /**
4
+ * Microsoft family 包公共入口。
5
+ * 输入:Microsoft family 名称或其模型别名。
6
+ * 输出:自动注册 Microsoft 内置 family,并复用 core 的公共 API。
7
+ */
8
+
9
+ /**
10
+ * 注册 Microsoft 子包内置的 family。
11
+ * 输入:无。
12
+ * 输出:Microsoft 相关 family 被写入全局注册表。
13
+ */
14
+ declare function registerBuiltins(): void;
15
+
16
+ export { registerBuiltins };
package/dist/index.js ADDED
@@ -0,0 +1,85 @@
1
+ import { registerTokenizerFamily, unpackPackedAsset } from "@cyberlangke/tokkit-core";
2
+ export * from "@cyberlangke/tokkit-core";
3
+ const BUILTIN_FAMILIES = [
4
+ {
5
+ family: "phi-1",
6
+ aliases: ["phi1", "phi_1"],
7
+ models: ["microsoft/phi-1", "microsoft/phi-1_5", "microsoft/phi-2"],
8
+ modulePath: "./generated/phi_1.js"
9
+ },
10
+ {
11
+ family: "phi-3-mini",
12
+ aliases: ["phi3-mini", "phi_3_mini"],
13
+ models: ["microsoft/Phi-3-mini-4k-instruct", "microsoft/Phi-3-mini-128k-instruct"],
14
+ modulePath: "./generated/phi_3_mini.js"
15
+ },
16
+ {
17
+ family: "phi-3-medium",
18
+ aliases: ["phi3-medium", "phi_3_medium"],
19
+ models: [
20
+ "microsoft/Phi-3-medium-4k-instruct",
21
+ "microsoft/Phi-3-medium-128k-instruct"
22
+ ],
23
+ modulePath: "./generated/phi_3_medium.js"
24
+ },
25
+ {
26
+ family: "phi-3.5",
27
+ aliases: ["phi3.5", "phi_3_5"],
28
+ models: ["microsoft/Phi-3.5-mini-instruct", "microsoft/Phi-3.5-MoE-instruct"],
29
+ modulePath: "./generated/phi_3_5.js"
30
+ },
31
+ {
32
+ family: "phi-4",
33
+ aliases: ["phi4", "phi_4"],
34
+ models: ["microsoft/phi-4"],
35
+ modulePath: "./generated/phi_4.js"
36
+ },
37
+ {
38
+ family: "phi-4-mini",
39
+ aliases: ["phi4-mini", "phi_4_mini"],
40
+ models: ["microsoft/Phi-4-mini-instruct"],
41
+ modulePath: "./generated/phi_4_mini.js"
42
+ },
43
+ {
44
+ family: "phi-4-mini-flash",
45
+ aliases: ["phi4-mini-flash", "phi_4_mini_flash"],
46
+ models: ["microsoft/Phi-4-mini-flash-reasoning"],
47
+ modulePath: "./generated/phi_4_mini_flash.js"
48
+ },
49
+ {
50
+ family: "phi-4-mini-reasoning",
51
+ aliases: ["phi4-mini-reasoning", "phi_4_mini_reasoning"],
52
+ models: ["microsoft/Phi-4-mini-reasoning"],
53
+ modulePath: "./generated/phi_4_mini_reasoning.js"
54
+ },
55
+ {
56
+ family: "phi-4-reasoning",
57
+ aliases: ["phi4-reasoning", "phi_4_reasoning"],
58
+ models: ["microsoft/Phi-4-reasoning", "microsoft/Phi-4-reasoning-plus"],
59
+ modulePath: "./generated/phi_4_reasoning.js"
60
+ },
61
+ {
62
+ family: "phi-moe",
63
+ aliases: ["phi_moe"],
64
+ models: ["microsoft/Phi-mini-MoE-instruct", "microsoft/Phi-tiny-MoE-instruct"],
65
+ modulePath: "./generated/phi_moe.js"
66
+ }
67
+ ];
68
+ function registerBuiltins() {
69
+ for (const spec of BUILTIN_FAMILIES) {
70
+ registerTokenizerFamily({
71
+ family: spec.family,
72
+ aliases: [...spec.aliases],
73
+ models: [...spec.models],
74
+ load: () => loadFamilyAsset(spec.modulePath)
75
+ });
76
+ }
77
+ }
78
+ async function loadFamilyAsset(modulePath) {
79
+ const module = await import(modulePath);
80
+ return unpackPackedAsset(module.default);
81
+ }
82
+ registerBuiltins();
83
+ export {
84
+ registerBuiltins
85
+ };
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@cyberlangke/tokkit-microsoft",
3
+ "version": "1.1.0",
4
+ "description": "Microsoft tokenizer families for tokkit.",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "COPYRIGHT"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsup",
22
+ "dev": "tsup --watch"
23
+ },
24
+ "dependencies": {
25
+ "@cyberlangke/tokkit-core": "1.1.0"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/1cyberlangke1/tokkit.git"
33
+ },
34
+ "homepage": "https://github.com/1cyberlangke1/tokkit#readme",
35
+ "bugs": {
36
+ "url": "https://github.com/1cyberlangke1/tokkit/issues"
37
+ },
38
+ "author": "cyberlangke",
39
+ "license": "MIT"
40
+ }