Skip to content

dew.registry

Name the things a run is made of.

One Registry per kind, including model components such as mixers, towers and projectors. A registry is a decorator, a mapping and an attribute view over the same table, so models["simple_dit"], models.SimpleDiT and the class are one object. A name or a field the table does not know raises.

The registries are empty at import. Each member registers itself where it is defined, so importing a package fills its table and the registry module imports none of them.

NameSummary
REGISTRIES
RegistryNames one kind of thing: a decorator, a mapping and an attribute view.
datasets
dtype_nameReturn the name resolve_dtype accepts for a dtype, for a logged config.
encoders
metrics
mixers
models
objectives
presets
projectors
resolve_dtypeResolve a dtype for a module field: a jnp dtype, one of its names, or None.
samplers
schedules
towers
with_precisionReturn a model config with the run’s compute dtype and attention kernel in it.

attribute source

REGISTRIES = (models, presets, samplers, datasets, encoders, metrics, objectives, mixers, towers, projectors, schedules)

class source

class Registry(kind: str, *, record: Literal['name', 'kind'] = 'name')

Names one kind of thing: a decorator, a mapping and an attribute view.

union: type[Built] | types.UnionType

Return Union[...] of the members, for a tyro subcommand over the table.

def name_of(member: Named) -> str

Return the name a member was registered under. The table is scanned by identity, so this takes a member of any registry, whatever it makes.

def build(
name: str,
record: Mapping[str, object] = NO_RECORD,
/,
**fields: Configured = {},
) -> Built

Construct the member called name from a record, keyword fields, or both.

A field the member does not declare is an error. Fields arrive from JSON as often as from code, so a field whose declared type is a value builds from a record here, where a logged config becomes an object: models.build("m", attention={"heads": 8}) and models.build("m", attention=Attention(heads=8)) agree.

A whole parsed config is the positional record: its values are unnarrowed, and narrowing them against the member’s declared types is this method’s job, so the splat happens here rather than at a caller that would have to know the member’s fields to write it.

attribute source

datasets: Registry[type[DatasetSpec], DatasetSpec] = Registry('dataset')
Registered nameObject
array_record_imagesArrayRecordImages
cc12mCC12M
cc3mCC3M
chat_messagesChatMessages
combined_30mCombined30M
combined_msml612CombinedMsml612
combined_onlineCombinedOnline
diffusiondbDiffusionDB
hfHubDataset
hf_imagesHFImages
laion12m_cocoLaion12mCoco
laion2b_aestheticLaion2bAesthetic
local_videosLocalVideos
oxford_flowers102OxfordFlowers
packed_tokensPackedTokens
preference_pairsPreferencePairs
promptsPrompts
tfdsPreparedTFDS
token_windowsTokenWindows
voxceleb2VoxCeleb2

function source

def dtype_name(value: DTypeLike | None) -> DtypeName | None

Return the name resolve_dtype accepts for a dtype, for a logged config.

attribute source

encoders: Registry[type[ConditionEncoder[Any]], ConditionEncoder[Any]] = Registry('encoder')
Registered nameObject
char_tableCharTable
clip_textCLIPText
diffusion_textDiffusionConditioner
qwen_image_textdew.inputs.diffusion.QwenImageConditioner
t5T5Text

attribute source

metrics: Registry[Callable[..., Metric], Metric] = Registry('metric')
Registered nameObject
clipclip
clip_scoreclip_score_metric
fidFID
knn_probeknn_probe
linear_probelinear_probe
perplexityperplexity
psnrpsnr
ssimssim

attribute source

mixers: Registry[type[MixerBase], MixerBase] = Registry('mixer', record='kind')
Registered nameObject
attentiondew.nn.mixers.attention.AttentionMixer
deepseek_v4dew.nn.deepseek_v4.DeepseekV4Mixer
gated_delta_netdew.nn.mixers.gated_delta_net.GatedDeltaNetMixer
kimi_delta_attentiondew.nn.kda.KimiDeltaAttentionMixer
kpool_sparse_attentiondew.nn.dsa_kpool.KPoolSparseAttentionMixer
llama4dew.nn.llama4.Llama4Mixer
mamba2dew.nn.mixers.mamba2.Mamba2Mixer
mladew.nn.mla.MLAMixer

attribute source

models: Registry[type[nn.Module], nn.Module] = Registry('model')
Registered nameObject
causal_transformerCausalTransformer
diffusion_gemmaDiffusionGemma
flux_transformerFluxTransformer
hierarchical_mmditHierarchicalMMDiT
hybrid_ditHybridSSMAttentionDiT
jepa_encoderJepaEncoder
jepa_predictorJepaPredictor
jepa_video_encoderJepaVideoEncoder
multimodal_transformerdew.nn.multimodal.MultimodalTransformer
qwen_image_transformerQwenImageTransformer
sd3_transformerSD3Transformer
simple_ditSimpleDiT
simple_mmditSimpleMMDiT
simple_uditSimpleUDiT
unetUnet
unet_2d_conditionUNet2DCondition
unet_3dUNet3D
uvitUViT
video_ditVideoDiT

attribute source

objectives: Registry[type[Objective], Objective] = Registry('objective')
Registered nameObject
block_diffusionBlockDiffusionObjective
diffusionDiffusionObjective
distillationDistillationObjective
dpoDPOObjective
flow_grpoFlowGRPOObjective
grpoGRPOObjective
jepaJepaObjective
lmLMObjective
masked_diffusionMaskedDiffusionObjective
ppoPPOObjective

attribute source

presets: Registry[type[Preset], Preset] = Registry('preset')
Registered nameObject
cosineCosine
edmEDM
flowFlow
karrasKarras
mdlmMDLM
sqrtSqrt

attribute source

projectors: Registry[type[ProjectorBase], ProjectorBase] = Registry('projector', record='kind')
Registered nameObject
gemmadew.nn.vision.GemmaProjector
gemma3ndew.nn.vision.Gemma3nProjector
gemma4dew.nn.vision.Gemma4Projector
llama4dew.nn.vision.Llama4Projector
qwen3_5dew.nn.vision.Qwen35Projector

function source

def resolve_dtype(value: object) -> DTypeLike | None

Resolve a dtype for a module field: a jnp dtype, one of its names, or None.

Every field named dtype is read here, wherever it arrives from, so a dtype passes through and a name becomes the dtype it names. Anything else is refused here rather than inside a module’s first cast.

attribute source

samplers: Registry[type[Solver[Any]], Solver[Any]] = Registry('sampler')
Registered nameObject
consistencyConsistency
ddimDDIM
ddpmDDPM
deisDEIS
dpmsolver_multistepDPMSolverMultistep
dpmsolver_sdeDPMSolverSDE
dpmsolver_singlestepDPMSolverSinglestep
eulerEuler
euler_ancestralEulerAncestral
flow_sdeFlowSDE
heunHeun
kdpm2KDPM2
lmsLMS
multistep_dpmMultiStepDPM
pndmPNDM
rk4RK4
tcdTCD
unipcUniPC
unmaskUnmask

attribute source

schedules: Registry[type[ScheduleBase], ScheduleBase] = Registry('schedule', record='kind')
Registered nameObject
cosineCosine
linearLinear
powerPower

attribute source

towers: Registry[type[TowerBase], TowerBase] = Registry('tower', record='kind')
Registered nameObject
gemma3ndew.nn.vision.Gemma3nVision
gemma3n_audiodew.nn.audio.Gemma3nAudio
gemma4dew.nn.vision.Gemma4Vision
gemma4_audiodew.nn.audio.Gemma4Audio
llama4dew.nn.vision.Llama4Vision
qwen3_5dew.nn.vision.Qwen35Vision
siglipdew.nn.vision.SiglipVision

function source

def with_precision(
name: str,
config: Mapping[str, object],
*,
dtype: str,
attention_impl: str,
param_dtype: str | None = None,
matmul_precision: str | None = None,
) -> Mapping[str, object]

Return a model config with the run’s compute dtype and attention kernel in it.