A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 14, 05:30 UTC
[Bugfix] Fix broken Florence-2 model (#23426)
Signed-off-by: 汪志鹏 <wangzhipeng628@gmail.com> Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn> Co-authored-by: 汪志鹏 <wangzhipeng628@gmail.com>
Isotr0py committed
Aug 23, 2025 at 01:50 UTC
cd7a3df26f351bae0261168232898cec39ed7304
1 file changed
+6
-2
vllm/model_executor/models/florence2.py
+6
-2
@@ -647,7 +647,8 @@ class Florence2LanguageModel(nn.Module):
647
648
encoder_hidden_states = None
649
650
- if inputs_embeds is not None or encoder_input_ids.numel() > 0:
650
+ if ((inputs_embeds is not None and inputs_embeds.numel() > 0)
651
+ or encoder_input_ids.numel() > 0):
652
# Run encoder attention if a non-zero number of encoder tokens
653
# are provided as input
654
encoder_hidden_states = self.encoder(input_ids=encoder_input_ids,
@@ -681,6 +682,8 @@ class Florence2LanguageForConditionalGeneration(nn.Module, SupportsV0Only):
682
self.lm_head = BartParallelLMHead(self.vocab_size,
683
config.d_model,
684
embed_scale=embed_scale)
685
+ if self.config.tie_word_embeddings:
686
+ self.lm_head.tie_weights(self.model.shared)
687
688
self.logits_processor = LogitsProcessor(self.vocab_size,
689
config.vocab_size)
@@ -749,7 +752,8 @@ class Florence2LanguageForConditionalGeneration(nn.Module, SupportsV0Only):
752
else:
753
if "final_logits_bias" in name:
754
continue
752
- if self.config.tie_word_embeddings and "embed_tokens" in name:
755
+ if self.config.tie_word_embeddings and ("embed_tokens" in name
756
+ or "lm_head" in name):
757
continue
758
param = params_dict[name]
759
weight_loader = getattr(param, "weight_loader",