Merge remote-tracking branch 'origin/main' into dev/vllm-align
This commit is contained in:
commit
663976b8ca
2 files changed
+3
-17
No files matched your search
@@ -1588,20 +1588,6 @@ class HunyuanFusedMoE(SharedFusedMoE):
|
|||||||
self._init_hook_handle.remove()
|
self._init_hook_handle.remove()
|
||||||
|
|
||||||
def forward(self, hidden_states, router_logits):
|
def forward(self, hidden_states, router_logits):
|
||||||
from vllm.model_executor.layers.fused_moe.layer import get_forward_context
|
|
||||||
|
|
||||||
ctx = get_forward_context()
|
|
||||||
if not ctx.remaining_moe_layers:
|
|
||||||
import re
|
|
||||||
|
|
||||||
moe_names = [name for name in ctx.no_compile_layers.keys() if ".mlp.experts" in name]
|
|
||||||
|
|
||||||
def get_layer_num(name):
|
|
||||||
match = re.search(r"layers\.(\d+)\.mlp", name)
|
|
||||||
return int(match.group(1)) if match else -1
|
|
||||||
|
|
||||||
moe_names.sort(key=get_layer_num, reverse=True)
|
|
||||||
ctx.remaining_moe_layers.extend(moe_names)
|
|
||||||
return super().forward(hidden_states, router_logits)
|
return super().forward(hidden_states, router_logits)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -804,9 +804,6 @@ class HunyuanImage3Pipeline(HunyuanImage3PreTrainedModel, GenerationMixin):
|
|||||||
)
|
)
|
||||||
kwargs["num_image_tokens"] = num_image_tokens
|
kwargs["num_image_tokens"] = num_image_tokens
|
||||||
# 50 and 5.0 hard code
|
# 50 and 5.0 hard code
|
||||||
from vllm.forward_context import set_forward_context
|
|
||||||
|
|
||||||
with set_forward_context(None, self.vllm_config):
|
|
||||||
results = self.pipeline(
|
results = self.pipeline(
|
||||||
batch_size=len(batch_gen_image_info),
|
batch_size=len(batch_gen_image_info),
|
||||||
image_size=[batch_gen_image_info[0].image_height, batch_gen_image_info[0].image_width],
|
image_size=[batch_gen_image_info[0].image_height, batch_gen_image_info[0].image_width],
|
||||||
@@ -929,6 +926,9 @@ class HunyuanImage3Pipeline(HunyuanImage3PreTrainedModel, GenerationMixin):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
|
# decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
|
||||||
|
from vllm.forward_context import set_forward_context
|
||||||
|
|
||||||
|
with set_forward_context(None, self.vllm_config):
|
||||||
outputs = self.model(
|
outputs = self.model(
|
||||||
input_ids=input_ids,
|
input_ids=input_ids,
|
||||||
attention_mask=attention_mask,
|
attention_mask=attention_mask,
|
||||||
|
|||||||
Reference in new issue
Block a user