/** * export/tensors.ts — the canonical named-tensor view of an EvermindLM. * * Every export format (safetensors / ONNX / GGUF / HF) consumes the SAME named, * shaped tensor list — defined ONCE here so the formats never disagree about a * weight's name, shape, or order. The runtime is left untouched: we read the * model purely through its public {@link EvermindLM.config} and * {@link EvermindLM.parameters} (the AdamW-ordered flat buffers), and re-attach * the names/shapes that order implies. * * Parameter order (must mirror EvermindLM.parameters / SharedExpertMoE.parameters): * emb, * per layer l: conv[l], normConv[l], normMoe[l], * moe: router, shared.{w1,b1,w2,b2}, expert{e}.{w1,b1,w2,b2}… */ import type { EvermindLM } from "../lm/evermind_lm.js"; /** A named, shaped weight tensor (row-major, flat f32). */ export interface NamedTensor { name: string; /** Row-major dimensions, e.g. [vocab, dModel]. */ shape: number[]; data: Float32Array; } /** The flat numeric architecture an export needs (a superset of the LM config). */ export interface EvermindArch { vocabSize: number; dModel: number; numLayers: number; convKernel: number; hiddenDim: number; numExperts: number; topK: number; } /** Pull the architecture out of a live LM (or any config-shaped object). */ export declare function archOf(lm: EvermindLM): EvermindArch; /** A weight name + its expected shape, in canonical parameter order. */ export interface TensorSpec { name: string; shape: number[]; } /** The name+shape of every parameter, in EvermindLM.parameters() order. */ export declare function evermindTensorSpec(a: EvermindArch): TensorSpec[]; /** * The full named/shaped tensor list of a trained LM, zipping the deterministic * {@link evermindTensorSpec} against the live {@link EvermindLM.parameters}. The * data buffers are the model's own (no copy) — treat them as read-only. */ export declare function namedTensors(lm: EvermindLM): NamedTensor[]; /** Total trainable scalar parameters (for sizing / model-card display). */ export declare function paramCount(lm: EvermindLM): number; //# sourceMappingURL=tensors.d.ts.map