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_learning fallback that collapses the prompt encoder to a single prompt_embeddings tensor (destructive for XPE, which stores multi-component state via modules_to_save).

  • Preserve the full upstream save_embedding_layers handling, the PEFT_TYPE_TO_PREFIX_MAPPING branch (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

xpe_get_peft_model_state_dict(model[, state_dict, ...])

See module docstring. Mirrors upstream except the prompt-learning collapse.

xpe_set_peft_model_state_dict(model, peft_model_state_dict)

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_embeddings single-tensor load and instead does a non-strict prompt_encoder.load_state_dict so XPE’s multi-component state loads.