@genai-fi/nanogpt 0.23.0 → 1.0.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/README.md +78 -281
- package/dist/{DatasetBuilder-C0iJT29K.js → DatasetBuilder-DU1G1OKX.js} +20 -23
- package/dist/{RealDiv-CNsvC4AU.js → RealDiv-CSnvtN2E.js} +20 -20
- package/dist/{Reshape-dnm9bO3B.js → Reshape-BlylqwWy.js} +12 -12
- package/dist/TeachableLLM.d.ts +10 -15
- package/dist/TeachableLLM.js +201 -2
- package/dist/api/responses.d.ts +81 -0
- package/dist/api/responses.js +169 -0
- package/dist/api/training.d.ts +70 -0
- package/dist/api/training.js +205 -0
- package/dist/data/docx.js +9 -3036
- package/dist/data/stream.d.ts +8 -8
- package/dist/data/stream.js +1 -1
- package/dist/data/textLoader.d.ts +1 -1
- package/dist/data/textLoader.js +2 -2
- package/dist/data.d.ts +3 -0
- package/dist/data.js +12 -0
- package/dist/{dist-BqAU9-yi.js → dist-CwK5S7Ls.js} +2168 -2168
- package/dist/{gpgpu_math-DBYEAAdI.js → gpgpu_math-20tPK8LM.js} +458 -458
- package/dist/{Generator.d.ts → inference/Generator.d.ts} +16 -44
- package/dist/inference/Generator.js +271 -0
- package/dist/inference/tokenisePrompt.d.ts +4 -0
- package/dist/inference/tokenisePrompt.js +13 -0
- package/dist/inference/types.d.ts +44 -8
- package/dist/inference/utilities.d.ts +9 -0
- package/dist/inference/utilities.js +20 -0
- package/dist/jszip.min-DKa1Rjyn.js +3033 -0
- package/dist/{kernel_funcs_utils-D-mATnGR.js → kernel_funcs_utils-ql8Y8qPn.js} +96 -93
- package/dist/layers/MLP.d.ts +1 -1
- package/dist/layers/PositionEmbedding.d.ts +2 -1
- package/dist/layers/PositionEmbedding.js +1 -1
- package/dist/layers/RMSNorm.d.ts +1 -1
- package/dist/layers/TiedEmbedding.js +1 -1
- package/dist/layers.d.ts +4 -0
- package/dist/layers.js +14 -0
- package/dist/loader/load.js +58 -2
- package/dist/loader/loadHF.d.ts +1 -1
- package/dist/loader/loadHF.js +17 -2
- package/dist/loader/loadTransformers.js +46 -2
- package/dist/loader/newZipLoad.js +25 -2
- package/dist/loader/oldZipLoad.d.ts +1 -1
- package/dist/loader/oldZipLoad.js +37 -2
- package/dist/loader/save.js +75 -2
- package/dist/loader/types.d.ts +3 -3
- package/dist/main.d.ts +34 -43
- package/dist/main.js +12327 -20
- package/dist/{matMulGelu-BAIgQaRx.js → matMulGelu-CBoqTZM7.js} +2 -2
- package/dist/models/NanoGPTV1.js +95 -2
- package/dist/models/NanoGPTV2.js +86 -2
- package/dist/models/factory.js +13 -2
- package/dist/models/model.js +76 -2
- package/dist/models.d.ts +4 -0
- package/dist/models.js +14 -0
- package/dist/ops/dot16.js +1 -1
- package/dist/ops/matMulGelu.js +1 -1
- package/dist/ops/webgl/adamAdjust.js +1 -1
- package/dist/ops/webgl/fusedSoftmax.js +2 -2
- package/dist/ops/webgl/gelu.js +2 -2
- package/dist/ops/webgl/log.js +5 -5
- package/dist/ops/webgl/matMulGelu.js +1 -1
- package/dist/ops/webgl/matMulMul.js +1 -1
- package/dist/{stream-BjdpSNqB.js → stream-BpAwcvHz.js} +565 -561
- package/dist/{tfjs_backend-CydPRQTc.js → tfjs_backend-h5weiy1O.js} +36 -36
- package/dist/tokenise.d.ts +4 -0
- package/dist/tokenise.js +15 -0
- package/dist/tokeniser/CharTokeniser.js +18 -20
- package/dist/tokeniser/bpe.js +18 -22
- package/dist/training/BasicTrainer.d.ts +5 -10
- package/dist/training/BasicTrainer.js +80 -88
- package/dist/training/DatasetBuilder.d.ts +4 -4
- package/dist/training/DatasetBuilder.js +1 -1
- package/dist/training/PreTrainer.js +1 -1
- package/dist/training/SFTTrainer.js +1 -1
- package/dist/training/configure.d.ts +3 -0
- package/dist/training/configure.js +32 -0
- package/dist/training/factory.d.ts +6 -0
- package/dist/training/factory.js +8 -0
- package/dist/training/prepareData.d.ts +22 -0
- package/dist/training/prepareData.js +49 -0
- package/dist/training/tasks/TokenStore.d.ts +2 -1
- package/dist/training/tasks/TokenStore.js +8 -5
- package/dist/training/tasks/tokenStream.d.ts +17 -0
- package/dist/training/tasks/tokenStream.js +46 -0
- package/dist/training/types.d.ts +14 -1
- package/dist/training/validateOptions.d.ts +2 -0
- package/dist/training/validateOptions.js +19 -0
- package/dist/training/validation.js +4 -2
- package/dist/utilities/arrayShape.d.ts +1 -0
- package/dist/utilities/arrayShape.js +8 -0
- package/dist/utilities/random.d.ts +1 -0
- package/dist/utilities/random.js +19 -0
- package/dist/utilities/waitForModel.d.ts +1 -1
- package/dist/v4-BK7K-jy_.js +30 -0
- package/package.json +8 -2
- package/dist/Generator.js +0 -2
- package/dist/Trainer-DBsyWJ4s.js +0 -228
- package/dist/Trainer.d.ts +0 -45
- package/dist/Trainer.js +0 -2
- package/dist/main-BSaDGH7I.js +0 -13274
- package/dist/training/tasks/ConversationTask.d.ts +0 -17
- package/dist/training/tasks/ConversationTask.js +0 -29
- package/dist/training/tasks/PretrainingTask.d.ts +0 -17
- package/dist/training/tasks/PretrainingTask.js +0 -42
- package/dist/training/tasks/StartSentenceTask.d.ts +0 -18
- package/dist/training/tasks/StartSentenceTask.js +0 -45
- package/dist/training/tasks/Task.d.ts +0 -29
- package/dist/training/tasks/Task.js +0 -50
- package/dist/training/tasks/splitter.d.ts +0 -5
- package/dist/training/tasks/splitter.js +0 -18
package/dist/loader/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IGenerateOptions } from '../../inference/types';
|
|
2
2
|
import { LoRAConfig } from '../../models/config';
|
|
3
3
|
import { default as Model, ModelForwardAttributes, TrainingState } from '../../models/model';
|
|
4
4
|
import { ITokeniser } from '../../tokeniser/type';
|
|
@@ -42,7 +42,7 @@ export interface ActionLogEntry {
|
|
|
42
42
|
timestamp: number;
|
|
43
43
|
duration: number;
|
|
44
44
|
tokensProcessed: number;
|
|
45
|
-
options: TrainingOptions |
|
|
45
|
+
options: TrainingOptions | IGenerateOptions;
|
|
46
46
|
}
|
|
47
47
|
export interface TransformersMetadata {
|
|
48
48
|
name?: string;
|
|
@@ -55,7 +55,7 @@ export interface TransformersMetadata {
|
|
|
55
55
|
mode?: ModelMode;
|
|
56
56
|
pretrainingData?: DatasetMetadata[];
|
|
57
57
|
pretrainingSettings?: TrainingOptions;
|
|
58
|
-
generationSettings?:
|
|
58
|
+
generationSettings?: IGenerateOptions;
|
|
59
59
|
actionLog?: ActionLogEntry[];
|
|
60
60
|
[key: string]: unknown;
|
|
61
61
|
}
|
package/dist/main.d.ts
CHANGED
|
@@ -1,54 +1,45 @@
|
|
|
1
|
-
import { default as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { default as Evaluator } from './training/Evaluator';
|
|
2
|
+
import { AdamWOptimizer } from './training/AdamW';
|
|
3
|
+
import { estimateParameterCount, estimateMemoryUsage, estimateTrainingMemoryUsage, estimateResources, validateConfig } from './utilities/parameters';
|
|
4
|
+
import { default as topP } from './utilities/topP';
|
|
5
|
+
import { sliceUint16Shards, sliceUint8Shards } from './utilities/tokens';
|
|
6
|
+
import { default as performanceTest } from './utilities/performance';
|
|
7
|
+
import { sentenceEmbeddings, sentenceEmbeddingsTensor } from './utilities/sentences';
|
|
4
8
|
import { pack16 } from './ops/pack16';
|
|
5
9
|
import { unpack16 } from './ops/unpack16';
|
|
6
|
-
import { default as CausalSelfAttention } from './layers/CausalSelfAttention';
|
|
7
|
-
import { default as MLP } from './layers/MLP';
|
|
8
|
-
import { default as TransformerBlock } from './layers/TransformerBlock';
|
|
9
|
-
import { default as RoPECache } from './layers/RoPECache';
|
|
10
|
-
export { default as NanoGPT } from './models/NanoGPTV1';
|
|
11
10
|
export { default as TeachableLLM } from './TeachableLLM';
|
|
12
|
-
export
|
|
13
|
-
export { default as BPETokeniser } from './tokeniser/bpe';
|
|
14
|
-
export { default as waitForModel } from './utilities/waitForModel';
|
|
15
|
-
export { default as generateDatasetID } from './utilities/datasetID';
|
|
16
|
-
export { default as loadTextData } from './data/textLoader';
|
|
17
|
-
export type { ConversationStream, ConversationCursor } from './data/stream';
|
|
18
|
-
export { MemoryConversationStream } from './data/stream';
|
|
19
|
-
export type { DatasetMetadata, ModelMode } from './loader/types';
|
|
20
|
-
export { default as Generator, type IGenerator } from './Generator';
|
|
21
|
-
export { default as Evaluator } from './training/Evaluator';
|
|
22
|
-
export { default as Trainer } from './Trainer';
|
|
23
|
-
export type { IGenerateOptions } from './Generator';
|
|
24
|
-
export { type ModelForwardAttributes, default as Model } from './models/model';
|
|
11
|
+
export * as tokenise from './tokenise';
|
|
25
12
|
export type { ITokeniser, Conversation, Roles } from './tokeniser/type';
|
|
26
|
-
export
|
|
13
|
+
export * as data from './data';
|
|
14
|
+
export type { ConversationStream } from './data/stream';
|
|
15
|
+
export type { DatasetMetadata, ModelMode } from './loader/types';
|
|
16
|
+
export * as models from './models';
|
|
27
17
|
export type { GPTConfig } from './models/config';
|
|
28
|
-
export {
|
|
29
|
-
export {
|
|
30
|
-
export {
|
|
31
|
-
export {
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
18
|
+
export type { ModelForwardAttributes } from './models/model';
|
|
19
|
+
export type { IGenerateOptions, IGeneratorResponse, IGeneratorOutput, GeneratorConversation } from './inference/types';
|
|
20
|
+
export type { TrainingOptions, TrainingLogEntry } from './training/types';
|
|
21
|
+
export type { ITrainingJob } from './api/training';
|
|
22
|
+
export declare const training: {
|
|
23
|
+
Evaluator: typeof Evaluator;
|
|
24
|
+
AdamWOptimizer: typeof AdamWOptimizer;
|
|
25
|
+
};
|
|
26
|
+
export declare const utilities: {
|
|
27
|
+
estimateParameterCount: typeof estimateParameterCount;
|
|
28
|
+
estimateMemoryUsage: typeof estimateMemoryUsage;
|
|
29
|
+
estimateTrainingMemoryUsage: typeof estimateTrainingMemoryUsage;
|
|
30
|
+
estimateResources: typeof estimateResources;
|
|
31
|
+
validateConfig: typeof validateConfig;
|
|
32
|
+
topP: typeof topP;
|
|
33
|
+
sliceUint16Shards: typeof sliceUint16Shards;
|
|
34
|
+
sliceUint8Shards: typeof sliceUint8Shards;
|
|
35
|
+
performanceTest: typeof performanceTest;
|
|
36
|
+
sentenceEmbeddings: typeof sentenceEmbeddings;
|
|
37
|
+
sentenceEmbeddingsTensor: typeof sentenceEmbeddingsTensor;
|
|
37
38
|
};
|
|
38
|
-
declare const ops: {
|
|
39
|
+
export declare const ops: {
|
|
39
40
|
pack16: typeof pack16;
|
|
40
41
|
unpack16: typeof unpack16;
|
|
41
42
|
};
|
|
42
|
-
export
|
|
43
|
-
export { selectBackend } from './backend';
|
|
44
|
-
export { default as performanceTest } from './utilities/performance';
|
|
45
|
-
export declare const layers: {
|
|
46
|
-
CausalSelfAttention: typeof CausalSelfAttention;
|
|
47
|
-
MLP: typeof MLP;
|
|
48
|
-
TransformerBlock: typeof TransformerBlock;
|
|
49
|
-
RoPECache: typeof RoPECache;
|
|
50
|
-
};
|
|
51
|
-
export { AdamWOptimizer } from './training/AdamW';
|
|
43
|
+
export * as layers from './layers';
|
|
52
44
|
export { default as checks } from './checks';
|
|
53
45
|
export type { TensorStatistics } from './checks/weights';
|
|
54
|
-
export { sentenceEmbeddings, sentenceEmbeddingsTensor } from './utilities/sentences';
|