Files
CalamitousFelicitousness f9d2bbe080 fix(krea2): zero-fill dormant last.up/last.down residual branch
Base ships last.up all-zeros so the branch is a no-op; pre-branch
finetunes omit both keys. A zero_init_missing spec field zero-fills
them on load instead of falling back to the base transformer.
2026-07-05 18:05:13 +01:00

16 lines
706 B
Python

from pipelines.krea2.transformer_krea2 import Krea2Transformer2DModel
from pipelines.native_transformer import TransformerSpec
# Checkpoint keys are bare (`first.`, `blocks.N.`, `txtfusion.`, ...) and the transformer's
# module tree mirrors them exactly, so no state-dict conversion is needed. The model has no
# rope/pos buffers, so the default acceptable-missing set is sufficient.
#
# `last.up`/`last.down` are a dormant zero-init residual branch (base ships last.up.weight
# all-zeros). Finetunes predating it omit both keys; zero-fill so the branch stays a no-op.
KREA2_SPEC = TransformerSpec(
cls=Krea2Transformer2DModel,
converter=None,
zero_init_missing=("last.down.", "last.up."),
)