Gemma3nSafeTensorsWeightLoader
Loads Gemma 3n weights from HuggingFace SafeTensors format.
HuggingFace models use different tensor naming conventions than GGUF. This loader maps HuggingFace names to GGUF-style names used by the runtime.
Supports sharded models (multiple .safetensors files with index.json).
Key differences from GGUF:
Uses BF16 dtype (needs conversion to FP32)
Different tensor name format (model.language_model.layers.X.* vs blk.X.*)
Weight tying: embed_tokens.weight is reused for output projection
Functions
Link copied to clipboard
suspend fun <T : DType> loadToMap(ctx: ExecutionContext, dtype: KClass<T>): Gemma3nWeights<T, Float>
Load weights into a map, mapping HuggingFace names to GGUF-style names.