From 4eb4e252ebc82fb349a1ce4463137d677aad064e Mon Sep 17 00:00:00 2001 From: Will Lin Date: Sat, 4 Jul 2026 00:16:50 +0000 Subject: [PATCH] [bugfix]: preserve tokenizer_kwargs customizations across update_model_arch TextEncoderArchConfig.__post_init__ rebuilt tokenizer_kwargs from scratch, and TextEncoderLoader.load -> update_model_arch re-runs __post_init__, silently wiping customizations applied by pipeline configs (kandinsky5/gen3c/longcat set 'padding'; multi-prompt kandinsky5 runs then crash on ragged sequences). Merge defaults under existing keys instead of rebuilding. Co-Authored-By: Claude Fable 5 --- fastvideo/configs/models/encoders/base.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fastvideo/configs/models/encoders/base.py b/fastvideo/configs/models/encoders/base.py index 6763116c1..1ce6167f2 100644 --- a/fastvideo/configs/models/encoders/base.py +++ b/fastvideo/configs/models/encoders/base.py @@ -43,11 +43,16 @@ class TextEncoderArchConfig(EncoderArchConfig): require_processor: bool = False def __post_init__(self) -> None: - self.tokenizer_kwargs = { + # update_model_arch re-runs __post_init__ after pipeline configs may + # have customized tokenizer_kwargs (e.g. kandinsky5/gen3c/longcat set + # "padding"); rebuilding the dict here would silently wipe those + # customizations, so only fill in defaults for keys not already set. + defaults = { "truncation": True, "max_length": self.text_len, "return_tensors": "pt", } + self.tokenizer_kwargs = defaults | self.tokenizer_kwargs @dataclass