micm_nlp.models.xpe.save_load¶
XPE-aware save/load helpers.
These are drop-in replacements for peft.utils.save_and_load.get_peft_model_state_dict
and peft.utils.save_and_load.set_peft_model_state_dict. They:
Skip the
is_prompt_learningfallback that collapses the prompt encoder to a singleprompt_embeddingstensor (destructive for XPE, which stores multi-component state viamodules_to_save).Preserve the full upstream
save_embedding_layershandling, thePEFT_TYPE_TO_PREFIX_MAPPINGbranch (safe no-op for XPE), and the MPT post-load branch.
See refactor.xpe.md TP5/TP6 for the delta vs upstream peft 0.14.0.
Functions¶
|
See module docstring. Mirrors upstream except the prompt-learning collapse. |
|
See module docstring. Mirrors upstream except it skips the destructive |
Module Contents¶
- micm_nlp.models.xpe.save_load.xpe_get_peft_model_state_dict(model, state_dict=None, adapter_name='default', unwrap_compiled=False, save_embedding_layers='auto')¶
See module docstring. Mirrors upstream except the prompt-learning collapse.
- micm_nlp.models.xpe.save_load.xpe_set_peft_model_state_dict(model, peft_model_state_dict, adapter_name='default', ignore_mismatched_sizes: bool = False, low_cpu_mem_usage: bool = False)¶
See module docstring. Mirrors upstream except it skips the destructive
prompt_embeddingssingle-tensor load and instead does a non-strictprompt_encoder.load_state_dictso XPE’s multi-component state loads.