model_support.base

model_support.base

Base interface for per-architecture model support descriptors.

Classes

Name Description
Experimental The feature runs but is unverified; enabling it warns, citing note.
ModelSupport Everything axolotl needs to know about one model architecture, in one place.
Supported The feature is known to work for this architecture.
Unsupported The feature is known-broken; enabling it raises, citing reason.

Experimental

model_support.base.Experimental(note='')

The feature runs but is unverified; enabling it warns, citing note.

ModelSupport

model_support.base.ModelSupport()

Everything axolotl needs to know about one model architecture, in one place.

New descriptors set a declarative profile and register with @register_model_support. Legacy class attributes and overridden methods remain supported while architectures migrate. Descriptors activate implicitly from the Hugging Face config.model_type.

capabilities maps a feature name to its support state: Unsupported raises when the feature is enabled, Experimental warns, Supported documents verified coverage, and a missing key means unknown — the feature falls back to its generic handling (e.g. CCE’s llama-like patch). Features consume the mapping via check_capability.

A legacy class-level capabilities/is_multimodal shadows the profile projections below; consumers read resolve_model_support for the merged view.

Profile hooks are exposed through the legacy methods for compatibility. Keep imperative patches localized to the model-support package.

Methods

Name Description
get_auto_model_cls AutoModel class selected by a declarative profile, if present.
get_processing_strategy_cls ProcessingStrategy class for the multimodal collator.
matches_cfg Whether this descriptor owns the run before model_type is known.
matches_processor Whether this descriptor owns the given multimodal processor.
post_model_load Adjust the adapter-wrapped model before generic post-load patches.
pre_config_load Patch before AutoConfig.from_pretrained; dispatched via
pre_model_load Apply model-specific patches before checkpoint load.
pre_tokenizer_load Patch before AutoTokenizer.from_pretrained; dispatched via
validate_cfg Model-specific config validation; raise ValueError on bad combos.
get_auto_model_cls
model_support.base.ModelSupport.get_auto_model_cls()

AutoModel class selected by a declarative profile, if present.

get_processing_strategy_cls
model_support.base.ModelSupport.get_processing_strategy_cls()

ProcessingStrategy class for the multimodal collator.

matches_cfg
model_support.base.ModelSupport.matches_cfg(cfg)

Whether this descriptor owns the run before model_type is known.

Needed by architectures whose config/tokenizer loading itself must be patched (remote-code models, or modeling code shipped in-tree) — typically implemented as a name match on cfg.base_model_config.

matches_processor
model_support.base.ModelSupport.matches_processor(processor)

Whether this descriptor owns the given multimodal processor.

post_model_load
model_support.base.ModelSupport.post_model_load(cfg, model)

Adjust the adapter-wrapped model before generic post-load patches.

pre_config_load
model_support.base.ModelSupport.pre_config_load(cfg)

Patch before AutoConfig.from_pretrained; dispatched via matches_cfg since model_type is not yet known.

pre_model_load
model_support.base.ModelSupport.pre_model_load(cfg)

Apply model-specific patches before checkpoint load.

pre_tokenizer_load
model_support.base.ModelSupport.pre_tokenizer_load(cfg)

Patch before AutoTokenizer.from_pretrained; dispatched via matches_cfg.

validate_cfg
model_support.base.ModelSupport.validate_cfg(cfg)

Model-specific config validation; raise ValueError on bad combos.

Supported

model_support.base.Supported(note='')

The feature is known to work for this architecture.

Unsupported

model_support.base.Unsupported(reason='')

The feature is known-broken; enabling it raises, citing reason.

Functions

Name Description
check_capability Enforce a declared capability: raise on Unsupported, warn on Experimental.

check_capability

model_support.base.check_capability(
    support,
    name,
    model_type,
    *,
    feature=None,
    hint='',
)

Enforce a declared capability: raise on Unsupported, warn on Experimental.

A missing descriptor or capability key is a no-op — unknown means the feature applies its generic fallback handling.