@orkestrel/train 0.0.1 → 0.0.2
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.
|
@@ -2138,6 +2138,8 @@ export declare type FinetunerEventMap = {
|
|
|
2138
2138
|
readonly checkpoint: readonly [event: FinetunerCheckpointEvent];
|
|
2139
2139
|
/** Emitted once after export completes. */
|
|
2140
2140
|
readonly done: readonly [result: FinetunerResult];
|
|
2141
|
+
/** Emitted, while a listener holds it, with one boundary timing in milliseconds. */
|
|
2142
|
+
readonly metric: readonly [name: TrainMetricName, value: number];
|
|
2141
2143
|
};
|
|
2142
2144
|
|
|
2143
2145
|
/**
|
|
@@ -4752,6 +4754,16 @@ export declare function traceHead(options: HeadTraceOptions): Promise<HeadTraceR
|
|
|
4752
4754
|
*/
|
|
4753
4755
|
export declare function traceSections(options: SectionTraceOptions): Promise<SectionTraceResult>;
|
|
4754
4756
|
|
|
4757
|
+
/**
|
|
4758
|
+
* Lists every boundary timing metric name emitted by `Finetuner`, in milliseconds.
|
|
4759
|
+
*
|
|
4760
|
+
* @example
|
|
4761
|
+
* ```ts
|
|
4762
|
+
* TRAIN_METRICS.includes('step') // true
|
|
4763
|
+
* ```
|
|
4764
|
+
*/
|
|
4765
|
+
export declare const TRAIN_METRICS: readonly ["step", "accumulate", "update", "rotation"];
|
|
4766
|
+
|
|
4755
4767
|
/**
|
|
4756
4768
|
* Fits and calibrates a frozen-feature decision head over an `@orkestrel/infer` backbone's features, and writes
|
|
4757
4769
|
* the head file `@orkestrel/infer`'s `createHead` loads.
|
|
@@ -5123,6 +5135,16 @@ export declare interface TrainerSettings {
|
|
|
5123
5135
|
readonly penalties: readonly number[];
|
|
5124
5136
|
}
|
|
5125
5137
|
|
|
5138
|
+
/**
|
|
5139
|
+
* Names one runtime boundary timing emitted by `Finetuner`.
|
|
5140
|
+
*
|
|
5141
|
+
* @example
|
|
5142
|
+
* ```ts
|
|
5143
|
+
* const name: TrainMetricName = 'update'
|
|
5144
|
+
* ```
|
|
5145
|
+
*/
|
|
5146
|
+
export declare type TrainMetricName = (typeof TRAIN_METRICS)[number];
|
|
5147
|
+
|
|
5126
5148
|
/**
|
|
5127
5149
|
* Requests one held-fold adapter scale calibration sweep through `createTrainQueue`.
|
|
5128
5150
|
*
|
package/dist/src/core/index.d.ts
CHANGED
|
@@ -2138,6 +2138,8 @@ export declare type FinetunerEventMap = {
|
|
|
2138
2138
|
readonly checkpoint: readonly [event: FinetunerCheckpointEvent];
|
|
2139
2139
|
/** Emitted once after export completes. */
|
|
2140
2140
|
readonly done: readonly [result: FinetunerResult];
|
|
2141
|
+
/** Emitted, while a listener holds it, with one boundary timing in milliseconds. */
|
|
2142
|
+
readonly metric: readonly [name: TrainMetricName, value: number];
|
|
2141
2143
|
};
|
|
2142
2144
|
|
|
2143
2145
|
/**
|
|
@@ -4752,6 +4754,16 @@ export declare function traceHead(options: HeadTraceOptions): Promise<HeadTraceR
|
|
|
4752
4754
|
*/
|
|
4753
4755
|
export declare function traceSections(options: SectionTraceOptions): Promise<SectionTraceResult>;
|
|
4754
4756
|
|
|
4757
|
+
/**
|
|
4758
|
+
* Lists every boundary timing metric name emitted by `Finetuner`, in milliseconds.
|
|
4759
|
+
*
|
|
4760
|
+
* @example
|
|
4761
|
+
* ```ts
|
|
4762
|
+
* TRAIN_METRICS.includes('step') // true
|
|
4763
|
+
* ```
|
|
4764
|
+
*/
|
|
4765
|
+
export declare const TRAIN_METRICS: readonly ["step", "accumulate", "update", "rotation"];
|
|
4766
|
+
|
|
4755
4767
|
/**
|
|
4756
4768
|
* Fits and calibrates a frozen-feature decision head over an `@orkestrel/infer` backbone's features, and writes
|
|
4757
4769
|
* the head file `@orkestrel/infer`'s `createHead` loads.
|
|
@@ -5123,6 +5135,16 @@ export declare interface TrainerSettings {
|
|
|
5123
5135
|
readonly penalties: readonly number[];
|
|
5124
5136
|
}
|
|
5125
5137
|
|
|
5138
|
+
/**
|
|
5139
|
+
* Names one runtime boundary timing emitted by `Finetuner`.
|
|
5140
|
+
*
|
|
5141
|
+
* @example
|
|
5142
|
+
* ```ts
|
|
5143
|
+
* const name: TrainMetricName = 'update'
|
|
5144
|
+
* ```
|
|
5145
|
+
*/
|
|
5146
|
+
export declare type TrainMetricName = (typeof TRAIN_METRICS)[number];
|
|
5147
|
+
|
|
5126
5148
|
/**
|
|
5127
5149
|
* Requests one held-fold adapter scale calibration sweep through `createTrainQueue`.
|
|
5128
5150
|
*
|
package/dist/src/core/index.js
CHANGED
|
@@ -901,6 +901,20 @@ var FINETUNER_LIMIT = 2048;
|
|
|
901
901
|
*/
|
|
902
902
|
var FINETUNER_SEED = 0;
|
|
903
903
|
/**
|
|
904
|
+
* Lists every boundary timing metric name emitted by `Finetuner`, in milliseconds.
|
|
905
|
+
*
|
|
906
|
+
* @example
|
|
907
|
+
* ```ts
|
|
908
|
+
* TRAIN_METRICS.includes('step') // true
|
|
909
|
+
* ```
|
|
910
|
+
*/
|
|
911
|
+
var TRAIN_METRICS = Object.freeze([
|
|
912
|
+
"step",
|
|
913
|
+
"accumulate",
|
|
914
|
+
"update",
|
|
915
|
+
"rotation"
|
|
916
|
+
]);
|
|
917
|
+
/**
|
|
904
918
|
* Holds the `general.type` value written into every GGUF v3 section patch file.
|
|
905
919
|
*
|
|
906
920
|
* @example
|
|
@@ -7803,6 +7817,8 @@ var Finetuner = class {
|
|
|
7803
7817
|
let epochTokens = 0;
|
|
7804
7818
|
for (let stepOffset = 0; stepOffset < remainingSteps; stepOffset += 1) {
|
|
7805
7819
|
checkSignal(signal, "The fine-tuning");
|
|
7820
|
+
const metered = this.#emitter.count("metric") > 0;
|
|
7821
|
+
const begun = metered ? performance.now() : 0;
|
|
7806
7822
|
const [batch, epochFinished] = this.#drawBatch(trainIndices, settings.loop.batch);
|
|
7807
7823
|
await this.#backward.zero();
|
|
7808
7824
|
let batchLossWeighted = 0;
|
|
@@ -7812,13 +7828,16 @@ var Finetuner = class {
|
|
|
7812
7828
|
const rowIndex = batch[slot];
|
|
7813
7829
|
const span = rowIndex === void 0 ? void 0 : spans[rowIndex];
|
|
7814
7830
|
if (span === void 0) continue;
|
|
7831
|
+
const accumulating = metered ? performance.now() : 0;
|
|
7815
7832
|
const reading = await this.#backward.accumulate(span, signal);
|
|
7833
|
+
if (metered) this.#emitter.emit("metric", "accumulate", performance.now() - accumulating);
|
|
7816
7834
|
batchLossWeighted += reading.loss * reading.count;
|
|
7817
7835
|
batchTokens += reading.count;
|
|
7818
7836
|
}
|
|
7819
7837
|
checkSignal(signal, "The fine-tuning");
|
|
7820
7838
|
const nextStep = this.#step + 1;
|
|
7821
7839
|
const rate = computeFinetunerRate(nextStep, totalSteps, settings.optimizer.rate, settings.optimizer.warmup, settings.optimizer.schedule);
|
|
7840
|
+
const updating = metered ? performance.now() : 0;
|
|
7822
7841
|
const norm = await this.#backward.step({
|
|
7823
7842
|
step: nextStep,
|
|
7824
7843
|
rate,
|
|
@@ -7829,6 +7848,13 @@ var Finetuner = class {
|
|
|
7829
7848
|
clip: settings.optimizer.clip,
|
|
7830
7849
|
scale: 1 / batch.length
|
|
7831
7850
|
}, signal);
|
|
7851
|
+
if (metered) {
|
|
7852
|
+
const interval = settings.section?.interval;
|
|
7853
|
+
const rotates = settings.mode === "section" && interval !== void 0 && nextStep % interval === 0;
|
|
7854
|
+
const finished = performance.now();
|
|
7855
|
+
this.#emitter.emit("metric", rotates ? "rotation" : "update", finished - updating);
|
|
7856
|
+
this.#emitter.emit("metric", "step", finished - begun);
|
|
7857
|
+
}
|
|
7832
7858
|
this.#step = nextStep;
|
|
7833
7859
|
const stepLoss = batchTokens > 0 ? batchLossWeighted / batchTokens : 0;
|
|
7834
7860
|
totalLossWeighted += batchLossWeighted;
|
|
@@ -8261,6 +8287,6 @@ function createTrainQueue(options) {
|
|
|
8261
8287
|
}
|
|
8262
8288
|
});
|
|
8263
8289
|
}
|
|
8264
|
-
export { ADAM_EPSILON, ADAM_FIRST, ADAM_SECOND, ADAPTER_CALIBRATION_SCALES, CALIBRATION_PRIOR, CALIBRATION_RATE, CALIBRATION_STEPS, CHECKPOINT_FILE_EXTENSION, CHECKPOINT_ID_PATTERN, CHECKPOINT_KEYS, CHECKPOINT_MODES, CHECKPOINT_TENSOR_PREFIXES, CHECKPOINT_TYPE, CHECKPOINT_VERSION, FINETUNER_BATCH, FINETUNER_CLIP, FINETUNER_DECAY, FINETUNER_EPOCHS, FINETUNER_EPSILON, FINETUNER_FIRST, FINETUNER_LIMIT, FINETUNER_RATE, FINETUNER_SCHEDULES, FINETUNER_SECOND, FINETUNER_SEED, FINETUNER_WARMUP, FIT_BATCH, FIT_MESSAGE, FIT_PROGRAM, FIT_RATE, FIT_SLICE, FIT_SLOTS, FIT_STEPS, Finetuner, HEAD_FILE_EXTENSION, MERGE_CHUNK_BYTES, MERGE_GGUF_FORMATS, MERGE_ROW_STRIP, MERGE_SOURCE_FORMATS, PEFT_BASE_LAYERS_PREFIX, PEFT_BASE_QWEN35_PREFIX, PEFT_LAYERS_PREFIX, PEFT_QWEN35_PREFIX, PEFT_TARGET_SPECS, PEFT_TENSOR_PATTERN, PRECISION_FORMATS, ROW_KEYS, SECTION_PATCH_TYPE, SECTION_PATCH_VERSION, SECTION_SAFETENSORS_SPECS, SerialFitter, TRAINER_FOLDS, TRAINER_FOLD_FLOOR, TRAINER_PENALTIES, TRAINER_REPEATS, TRAINER_SEED, ThreadFitter, Trainer, addLoRAStrip, admitFinetuneRows, admitRows, assignFolds, buildAdapterGGUF, buildAdapterPEFT, buildCheckpointGGUF, buildFeatureMatrix, buildFitSetup, buildHeadWeights, buildOperatingTable, buildSafetensors, buildSectionGGUF, buildSplits, calibrateAdapter, checkAdapterArchitecture, checkCheckpointId, checkFitJobs, checkFitterContext, checkFolds, checkLabels, checkPEFTConfig, checkRowProvenance, collectConversationRows, collectJudgmentRows, collectRows, combineAdapters, computeAUC, computeAccuracy, computeCalibrationGradient, computeClassWeights, computeDatasetDigest, computeDistributions, computeErrors, computeFinetuneDatasetDigest, computeFinetunerRate, computeGradient, computeHeadLogits, computeHeadName, computeLabelAUCs, computeLogistic, computeOutputs, computeProbabilities, computeStandard, countChanges, countFlips, countFormatChanges, createFinetuner, createTrainQueue, deinterleaveRotary, diffWeights, encodeGGUFValues, encodeQ4KValues, encodeQ80Values, encodeSafetensorsValues, encodeStates, extractScores, fitCalibration, ggufToPEFT, inferAnswerLabel, inferRowLabels, inferStrata, isByteSink, isCheckpoint, isCheckpointId, isCheckpointMode, isCheckpointTarget, isFinetuneRow, isFinetunerSchedule, isMergeGGUFFormat, isPEFTBundle, isPEFTConfig, isPrecisionFormat, isTrainerRow, mergeGGUF, mergeSafetensors, peftToGGUF, permuteDeltaPair, permuteHeadBlocks, permuteRotaryPair, permuteSectionEntry, poolOutcomes, readAdapterPEFT, readCheckpointGGUF, readFitWeights, readSafetensorsHeader, readSectionGGUF, readTrainerCSV, readTrainerRows, refitTracedHead, renderFinetunePrompt, renderRowRefusal, resolveFinetunerSettings, resolveTrainerSettings, selectPenalty, stepAdam, stepCheckpointAdam, stepRandom, traceHead, traceSections, writeByteSink };
|
|
8290
|
+
export { ADAM_EPSILON, ADAM_FIRST, ADAM_SECOND, ADAPTER_CALIBRATION_SCALES, CALIBRATION_PRIOR, CALIBRATION_RATE, CALIBRATION_STEPS, CHECKPOINT_FILE_EXTENSION, CHECKPOINT_ID_PATTERN, CHECKPOINT_KEYS, CHECKPOINT_MODES, CHECKPOINT_TENSOR_PREFIXES, CHECKPOINT_TYPE, CHECKPOINT_VERSION, FINETUNER_BATCH, FINETUNER_CLIP, FINETUNER_DECAY, FINETUNER_EPOCHS, FINETUNER_EPSILON, FINETUNER_FIRST, FINETUNER_LIMIT, FINETUNER_RATE, FINETUNER_SCHEDULES, FINETUNER_SECOND, FINETUNER_SEED, FINETUNER_WARMUP, FIT_BATCH, FIT_MESSAGE, FIT_PROGRAM, FIT_RATE, FIT_SLICE, FIT_SLOTS, FIT_STEPS, Finetuner, HEAD_FILE_EXTENSION, MERGE_CHUNK_BYTES, MERGE_GGUF_FORMATS, MERGE_ROW_STRIP, MERGE_SOURCE_FORMATS, PEFT_BASE_LAYERS_PREFIX, PEFT_BASE_QWEN35_PREFIX, PEFT_LAYERS_PREFIX, PEFT_QWEN35_PREFIX, PEFT_TARGET_SPECS, PEFT_TENSOR_PATTERN, PRECISION_FORMATS, ROW_KEYS, SECTION_PATCH_TYPE, SECTION_PATCH_VERSION, SECTION_SAFETENSORS_SPECS, SerialFitter, TRAINER_FOLDS, TRAINER_FOLD_FLOOR, TRAINER_PENALTIES, TRAINER_REPEATS, TRAINER_SEED, TRAIN_METRICS, ThreadFitter, Trainer, addLoRAStrip, admitFinetuneRows, admitRows, assignFolds, buildAdapterGGUF, buildAdapterPEFT, buildCheckpointGGUF, buildFeatureMatrix, buildFitSetup, buildHeadWeights, buildOperatingTable, buildSafetensors, buildSectionGGUF, buildSplits, calibrateAdapter, checkAdapterArchitecture, checkCheckpointId, checkFitJobs, checkFitterContext, checkFolds, checkLabels, checkPEFTConfig, checkRowProvenance, collectConversationRows, collectJudgmentRows, collectRows, combineAdapters, computeAUC, computeAccuracy, computeCalibrationGradient, computeClassWeights, computeDatasetDigest, computeDistributions, computeErrors, computeFinetuneDatasetDigest, computeFinetunerRate, computeGradient, computeHeadLogits, computeHeadName, computeLabelAUCs, computeLogistic, computeOutputs, computeProbabilities, computeStandard, countChanges, countFlips, countFormatChanges, createFinetuner, createTrainQueue, deinterleaveRotary, diffWeights, encodeGGUFValues, encodeQ4KValues, encodeQ80Values, encodeSafetensorsValues, encodeStates, extractScores, fitCalibration, ggufToPEFT, inferAnswerLabel, inferRowLabels, inferStrata, isByteSink, isCheckpoint, isCheckpointId, isCheckpointMode, isCheckpointTarget, isFinetuneRow, isFinetunerSchedule, isMergeGGUFFormat, isPEFTBundle, isPEFTConfig, isPrecisionFormat, isTrainerRow, mergeGGUF, mergeSafetensors, peftToGGUF, permuteDeltaPair, permuteHeadBlocks, permuteRotaryPair, permuteSectionEntry, poolOutcomes, readAdapterPEFT, readCheckpointGGUF, readFitWeights, readSafetensorsHeader, readSectionGGUF, readTrainerCSV, readTrainerRows, refitTracedHead, renderFinetunePrompt, renderRowRefusal, resolveFinetunerSettings, resolveTrainerSettings, selectPenalty, stepAdam, stepCheckpointAdam, stepRandom, traceHead, traceSections, writeByteSink };
|
|
8265
8291
|
|
|
8266
8292
|
//# sourceMappingURL=index.js.map
|