micm_nlp.models.xpe.peft_models

XPE-scoped PeftModel subclasses, one per supported TaskType.

Replaces the legacy global monkey-patching. All overrides live on a shared _XPEPeftMixin so every task-type variant inherits the same XPE behaviour while non-XPE peft_type values still reach the stock upstream path via super().

Supported task types are registered in TASK_TYPE_TO_XPE_MODEL and resolved by xpe_model_for(). The factory (xpe.factory) uses this registry to pick the right subclass for get_xpe_model / load_xpe_pretrained — no hardcoded SEQ_CLS assumption.

Attributes

Classes

XPEPeftModelForCausalLM

PEFT causal-LM model driven by the Cross-Prompt Encoder.

XPEPeftModelForSequenceClassification

PEFT sequence-classification model driven by the Cross-Prompt Encoder.

Functions

xpe_model_for(→ type[peft.PeftModel])

Resolve the XPE PeftModel subclass for a given task_type.

Module Contents

class micm_nlp.models.xpe.peft_models.XPEPeftModelForCausalLM

Bases: _XPEPeftMixin, peft.PeftModelForCausalLM

PEFT causal-LM model driven by the Cross-Prompt Encoder.

class micm_nlp.models.xpe.peft_models.XPEPeftModelForSequenceClassification

Bases: _XPEPeftMixin, peft.PeftModelForSequenceClassification

PEFT sequence-classification model driven by the Cross-Prompt Encoder.

micm_nlp.models.xpe.peft_models.xpe_model_for(task_type) type[peft.PeftModel]

Resolve the XPE PeftModel subclass for a given task_type.

Accepts a TaskType enum value or its string spelling (as read from adapter_config.json). Raises ValueError for unsupported task types.

micm_nlp.models.xpe.peft_models.TASK_TYPE_TO_XPE_MODEL: dict[peft.TaskType, type[peft.PeftModel]]