/** * import/evermind.ts — build a live {@link EvermindLM} FROM imported weights. * * The inverse of the export path: given a named/shaped tensor list (e.g. from * {@link safetensorsToTensors}), reconstruct the model. This is the warm-start / * weight-port seam — it lets Evermind be *initialised* from an existing * checkpoint instead of only from random init + training. * * Two entry points: * • round-trip our OWN exports — the tensor names already match the canonical * {@link evermindTensorSpec}; arch is inferred from the tensor shapes. * • warm-start a FOREIGN SSM checkpoint (e.g. Codestral-Mamba) — pass a * `rename` map that translates its tensor names into our canonical names. * Shapes must then line up with {@link evermindTensorSpec}; a mismatch throws * with the exact offending tensor (the honest failure for an incompatible * mixer, rather than silently loading garbage). */ import { EvermindLM } from "../lm/evermind_lm.js"; import { type EvermindArch, type NamedTensor } from "../export/tensors.js"; export interface ImportOptions { /** * Rename each source tensor before matching against the canonical spec. Return * `null` to drop a tensor. Use this to warm-start a foreign SSM checkpoint whose * weight names differ from Evermind's. */ rename?: (name: string) => string | null; /** * `topK` (active experts per token) is not encoded in the weights — supply it * when importing (default: min(2, numExperts)). */ topK?: number; /** Override the inferred architecture entirely (advanced). */ arch?: EvermindArch; } /** * Infer the architecture from the tensor shapes alone, so a bare safetensors * file (no config.json) can be imported. `topK` cannot be recovered from weights. */ export declare function inferArchFromTensors(tensors: NamedTensor[], topK?: number): EvermindArch; /** * Reconstruct an {@link EvermindLM} from a named tensor list. Validates every * canonical parameter is present with the right element count, then copies the * data into the model's parameter buffers (canonical order). */ export declare function importEvermindTensors(tensors: NamedTensor[], opts?: ImportOptions): EvermindLM; /** Convenience: import an {@link EvermindLM} directly from a `.safetensors` buffer. */ export declare function importEvermind(bytes: Uint8Array, opts?: ImportOptions): EvermindLM; //# sourceMappingURL=evermind.d.ts.map