families¶
families
¶
The registry: config.model_type -> the family's standardization toolkit.
A toolkit is one module in this package, named after the model_type
(from the checkpoint's config) it covers. Each declares:
RENAME: an nnsightrenamedict mapping the family's own module names onto the standard vocabulary (seennterp). Keys are resolved relative to every envoy in the tree, so a single-component key such as"attn"binds in every block that has one, and a key that does not resolve anywhere is simply skipped.Layer,AttentionandMlp, andLinearAttentionon a hybrid: the family's own subclasses ofnnterp.components's, overriding only what its forward spells differently.ENVOYS: an nnsightenvoysdict keying those on the family's module types (envoys=matches by type first, then by path, in a native or an alias spelling).
The module's name is its model_type (gemma3_text.py covers
gemma3_text), and that is the whole registry: lookup imports
nnterp.families.<model_type> on first use, so import nnterp loads no
transformers modeling module. To add a family, write the module beside these;
to add one from elsewhere, or to override a shipped one, pass it to register
with the model types it covers; to use one for a single load, pass it as
StandardizedTransformer(..., family=) or StandardizedVLLM(..., family=).
A model_type with neither gets default, the best-effort family, with a
warning; it is not one of known.
Another engine's families live in a package of their own under this one,
named after the engine: nnterp.families.vllm.llama is vLLM's implementation
of the llama model type, looked up with lookup("llama", engine="vllm").
There is no default on another engine: a type it has no family for raises.
UnsupportedFamily
¶
Bases: ValueError
No toolkit standardizes the checkpoint: it has no family, and the best-effort default cannot standardize it.
covers
¶
Whether a family covers model_type on engine: one registered for it, or a module of that name here.
resolve
¶
The family for a config: its own model_type where a family covers it, else its text model's.
A multimodal wrapper usually resolves through its text_config (Llava to
llama, Gemma 3 to gemma3_text). A wrapper with a family of its own,
named after the wrapper, resolves to that family whatever its text config
says: Kimi K2.5's text config says deepseek_v3 from transformers 5.20,
and kimi_k25 covers it.
known
¶
The shipped families' model types: the modules in this package (but default, which covers none), or in engine's package under it.
lookup
¶
The toolkit for model_type: a registered one, else the module of that name, imported on first use.
With neither, on transformers, default with a warning: its
standardization is a name guess, which it checks at load (raising
UnsupportedFamily when the guess finds no blocks, embedding, final norm
or head, or the stream's shape does not hold), and what a guess cannot
make safe (the contributions, the logit lens) is unavailable.
engine names another engine's families ("vllm"): its modules are
their own implementations of the same checkpoints, with their own classes
and conventions, so they are their own toolkits under the same name.
default is written against transformers' modules, so it is no fallback
there: an engine's lookup with no family raises.
| RAISES | DESCRIPTION |
|---|---|
UnsupportedFamily
|
on another engine, when there is neither. |
register
¶
Add a family toolkit without editing this package.
family is any module (or object) with RENAME and ENVOYS like
the ones here. It covers model_types; with none given, the type its
__name__ names, as a shipped module's file name does
(register(my_pkg.zamba) covers zamba). The types go into
REGISTRY, which lookup consults before the shipped modules, so a user
can also override a shipped family. engine registers it as that
engine's (engine="vllm"). Returns family.
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
when no type is given and |
all_families
¶
Every shipped family, imported: for tooling and tests, not for a load.
__getattr__
¶
nnterp.families.<model_type>: the family module, imported on first use.
Submodules¶
- afmoe
- apertus
- arcee
- bamba
- bitnet
- bloom
- codegen
- cohere
- cohere2
- dbrx
- deepseek_v2
- deepseek_v3
- deepseek_v32
- deepseek_v4
- default
- doge
- dots1
- ernie4_5
- ernie4_5_moe
- exaone4
- falcon
- falcon_h1
- falcon_mamba
- flex_olmo
- gemma
- gemma2
- gemma3_text
- gemma4_text
- gemma4_unified_text
- glm
- glm4
- glm4_moe
- glm4_moe_lite
- glm_moe_dsa
- gpt2
- gpt_bigcode
- gpt_neo
- gpt_neox
- gpt_neox_japanese
- gpt_oss
- gptj
- granite
- granite_swa
- granitemoe
- granitemoe_swa
- granitemoehybrid
- granitemoeshared
- helium
- hunyuan_v1_dense
- hunyuan_v1_moe
- hyperclovax
- jamba
- jetmoe
- kimi_k2
- kimi_linear
- laguna
- llama
- llama4_text
- mamba
- mamba2
- mimo_v2_flash
- minimax_m2
- ministral
- ministral3
- mistral
- mixtral
- mpt
- nemotron
- nemotron_h
- olmo
- olmo2
- olmo3
- olmo_hybrid
- olmoe
- opt
- persimmon
- phi
- phi3
- phimoe
- qwen2
- qwen2_5_vl_text
- qwen2_moe
- qwen2_vl_text
- qwen3
- qwen3_5_moe_text
- qwen3_5_text
- qwen3_moe
- qwen3_next
- qwen3_vl_moe_text
- qwen3_vl_text
- seed_oss
- smollm3
- solar_open
- stablelm
- starcoder2
- vaultgemma
- vllm
- xglm
- youtu
- zaya