Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
fix(qwen): remap legacy single-file VL encoder keys under transformers 5.x (#9333)
Alexander Eichhorn6ca505fe64fd
diff --git a/invokeai/backend/model_manager/load/model_loaders/qwen_image.py b/invokeai/backend/model_manager/load/model_loaders/qwen_image.pyindex 289f1c92d1..11cd497720 100644--- a/invokeai/backend/model_manager/load/model_loaders/qwen_image.py+++ b/invokeai/backend/model_manager/load/model_loaders/qwen_image.py@@ -444,7 +444,15 @@ class QwenVLEncoderCheckpointLoader(ModelLoader):# `model.language_model.X`. Apply the same conversion mapping that# `Qwen2_5_VLForConditionalGeneration.from_pretrained` would, since# `load_state_dict` does not.- key_mapping = Qwen2_5_VLForConditionalGeneration._checkpoint_conversion_mapping+ #+ # transformers ≤4.x exposed this as `_checkpoint_conversion_mapping`, but 5.x+ # dropped it (returns `{}`), so we fall back to the legacy mapping ourselves.+ # The negative lookahead keeps already-converted checkpoints untouched, so the+ # remap is safe to apply to both legacy and new-layout single-file checkpoints.+ key_mapping = Qwen2_5_VLForConditionalGeneration._checkpoint_conversion_mapping or {+ r"^visual": "model.visual",+ r"^model(?!\.(language_model|visual))": "model.language_model",+ }if key_mapping:remapped_sd: dict[str, torch.Tensor] = {}for old_key, tensor in sd.items():