pub fn save_packed_safetensors(
dir: &Path,
state_dict: &HashMap<String, Tensor>,
cast_policy: CastPolicy,
) -> Result<()>Expand description
Save a state dictionary to dir/model.safetensors and write dir/model.safetensors.index.json.
Matches upstream main.py / hub.py checkpoint layout.
ยงErrors
Returns an error if creating dir, converting tensors, or writing safetensors/index fails.