Skip to main content

merge_state_dicts

Function merge_state_dicts 

Source
pub fn merge_state_dicts(
    existing: &HashMap<String, Tensor>,
    new: &HashMap<String, Tensor>,
    strategy: &MergeStrategy,
) -> Result<HashMap<String, Tensor>>
Expand description

Merge two state dicts using the specified strategy.

§Arguments

  • existing - Current adapter weights (module_name -> tensor)
  • new - New delta weights to merge in (module_name -> tensor)
  • strategy - Merge strategy to use

§Returns

Merged state dict with the same keys as existing.