/** * export/safetensors.ts — export weights to the HF-native `.safetensors` format. * * Layout (the safetensors spec): an 8-byte little-endian u64 header length, then a * JSON header mapping each tensor name → {dtype, shape, data_offsets:[start,end]} * (offsets relative to the start of the byte buffer that follows the header), then * the concatenated raw tensor bytes. Round-trips losslessly in F32; F16 halves the * size. Loadable by `safetensors`, `transformers`, and transformers.js. */ import type { EvermindLM } from "../lm/evermind_lm.js"; import { type NamedTensor } from "./tensors.js"; export interface SafetensorsOptions { /** Store tensors as float16 (half the size). Default false (float32). */ fp16?: boolean; /** Extra `__metadata__` string entries (e.g. format provenance). */ metadata?: Record; } /** Serialise the given named tensors to a `.safetensors` byte buffer. */ export declare function tensorsToSafetensors(tensors: NamedTensor[], opts?: SafetensorsOptions): Uint8Array; /** Export a trained LM's weights to `.safetensors`. */ export declare function exportSafetensors(lm: EvermindLM, opts?: SafetensorsOptions): Uint8Array; //# sourceMappingURL=safetensors.d.ts.map