Expand description
HuggingFace safetensors weight loading and key resolution.
Functions§
- detect_
weight_ prefix - Detect the common prefix for transformer weight keys.
- load_
hf_ weights - Load and merge safetensors shards from disk.
- resolve_
bias - Resolve an optional bias tensor by logical suffix (e.g.
layers.0.self_attn.q_proj). ReturnsNonewhen the model has no bias for that layer (e.g. Llama/Mistral). - resolve_
lm_ head - Resolve lm_head — may live outside the model prefix.
- resolve_
weight - Resolve a weight tensor by logical suffix (e.g.
layers.0.self_attn.q_proj). - tie_
word_ embeddings_ from_ config