Model Binders

Base Binder

Base Model Binder

Abstract base class for architecture-specific weight mapping.

class ual_adapter.binders.base.ModelBinder[source]

Abstract base class for model-specific binders.

Binders handle the mapping between AIR semantic roles and model-specific parameter names.

__init__()[source]

Initialize the binder.

map_weights(weights: Dict[str, Tensor], target_model_info: Dict[str, Any]) Dict[str, Tensor][source]

Map weights to target model naming convention.

Parameters:
  • weights – Dictionary of weights with AIR or source names

  • target_model_info – Information about the target model

Returns:

Dictionary with mapped weight names

get_fused_modules() List[str][source]

Get list of fused modules (e.g., combined QKV projections).

Returns:

List of fused module patterns

supports_architecture(architecture: str) bool[source]

Check if this binder supports a given architecture.

Parameters:

architecture – Architecture name to check

Returns:

True if supported

Architecture Binders

Architecture-Specific Model Binders

Implementations for GPT-2, LLaMA, Pythia, and other model families.

class ual_adapter.binders.architectures.GPT2Binder[source]

Binder for GPT-2 family models.

class ual_adapter.binders.architectures.LLaMABinder[source]

Binder for LLaMA family models.

class ual_adapter.binders.architectures.PythiaBinder[source]

Binder for Pythia/GPT-NeoX family models.

class ual_adapter.binders.architectures.QwenBinder[source]

Binder for Qwen family models.

class ual_adapter.binders.architectures.MistralBinder[source]

Binder for Mistral family models.

class ual_adapter.binders.architectures.PhiBinder[source]

Binder for Microsoft Phi family models.

class ual_adapter.binders.architectures.BERTBinder[source]

Binder for BERT family models.

class ual_adapter.binders.architectures.T5Binder[source]

Binder for T5 family models.

class ual_adapter.binders.architectures.GenericBinder[source]

Generic binder for unknown architectures.

Binder Registry

Binder Registry

Manages registration and retrieval of architecture-specific binders.

class ual_adapter.binders.registry.BinderRegistry[source]

Registry for model binders.

Manages the mapping between architecture names and their corresponding binder implementations.

__init__()[source]

Initialize the binder registry.

register(architecture: str, binder_class: Type[ModelBinder]) None[source]

Register a new binder for an architecture.

Parameters:
  • architecture – Architecture name (case-insensitive)

  • binder_class – Binder class to register

get_binder(architecture: str) ModelBinder[source]

Get a binder instance for the specified architecture.

Parameters:

architecture – Architecture name

Returns:

Binder instance for the architecture

list_supported_architectures() list[source]

List all supported architectures.

Returns:

List of architecture names

is_architecture_supported(architecture: str) bool[source]

Check if an architecture is supported.

Parameters:

architecture – Architecture name to check

Returns:

True if architecture is supported