convert_to_bf16

Function convert_to_bf16 

Source
pub fn convert_to_bf16(raw: &[u8], dtype: &str) -> Result<Vec<u8>>
Expand description

Host F16/F32/BF16 → BF16, byte-for-byte matching the disk adapter loader (load_adapter_safetensors): half::bf16::from_f32 (round-to-nearest-even) for the float conversions. Any other dtype is a hard error — a PEFT adapter is only ever F32 (default), F16, or BF16.