[Bugfix]Repeated add modelslim quant_config and bugfix with "enable-piecewise-cuda-graph" on NPU (#17511)
This commit is contained in:
@@ -805,8 +805,11 @@ class ModelConfig:
|
||||
# Parse quantization method from the HF and ModelSlim model config, if available.
|
||||
# Only one function should return config, other should return None.
|
||||
cfg_list = []
|
||||
cfg_list.append(self._parse_quant_hf_config())
|
||||
cfg_list.append(self._find_quant_modelslim_config())
|
||||
hf_config = self._parse_quant_hf_config()
|
||||
modelslim_config = self._find_quant_modelslim_config()
|
||||
quant_config = modelslim_config or hf_config
|
||||
if quant_config is not None:
|
||||
cfg_list.append(quant_config)
|
||||
|
||||
# Filter out None values
|
||||
cfg_list = [item for item in cfg_list if item is not None]
|
||||
|
||||
@@ -777,7 +777,7 @@ class Scheduler(
|
||||
self.prefill_delayer = PrefillDelayer(
|
||||
dp_size=self.dp_size,
|
||||
attn_tp_size=self.attn_tp_size,
|
||||
cpu_group=self.tp_worker.get_tp_group().cpu_group,
|
||||
cpu_group=self.tp_cpu_group,
|
||||
server_args=self.server_args,
|
||||
metrics_collector=(
|
||||
self.metrics_collector if self.enable_metrics else None
|
||||
|
||||
@@ -221,7 +221,11 @@ class LlamaAttention(nn.Module):
|
||||
hidden_states: torch.Tensor,
|
||||
forward_batch: ForwardBatch,
|
||||
) -> torch.Tensor:
|
||||
if not _is_npu or not hasattr(self.rotary_emb, "get_cos_sin_with_position"):
|
||||
if (
|
||||
not _is_npu
|
||||
or not hasattr(self.rotary_emb, "get_cos_sin_with_position")
|
||||
or forward_batch.forward_mode.is_extend()
|
||||
):
|
||||
q, k, v = self.forward_prepare_native(
|
||||
positions=positions,
|
||||
hidden_states=hidden_states,
|
||||
|
||||
@@ -181,7 +181,7 @@ class Qwen3Attention(nn.Module):
|
||||
if get_global_server_args().rl_on_policy_target is not None:
|
||||
hidden_states = hidden_states.bfloat16()
|
||||
|
||||
if not _is_npu:
|
||||
if not _is_npu or forward_batch.forward_mode.is_extend():
|
||||
q, k, v = self.forward_prepare_native(
|
||||
positions=positions,
|
||||
hidden_states=hidden_states,
|
||||
@@ -299,7 +299,7 @@ class Qwen3DecoderLayer(nn.Module):
|
||||
forward_batch,
|
||||
cache=(
|
||||
[self.mlp.gate_up_proj.weight, self.mlp.down_proj.weight]
|
||||
if _is_npu
|
||||
if _is_npu and not get_global_server_args().enable_piecewise_cuda_graph
|
||||
else None
|
||||
),
|
||||
)
|
||||
|
||||
@@ -619,7 +619,7 @@ class Qwen3MoeAttention(nn.Module):
|
||||
):
|
||||
if hidden_states.shape[0] == 0:
|
||||
return hidden_states, forward_batch, None
|
||||
if not _is_npu:
|
||||
if not _is_npu or forward_batch.forward_mode.is_extend():
|
||||
return self.forward_prepare_native(
|
||||
positions=positions,
|
||||
hidden_states=hidden_states,
|
||||
|
||||
Reference in New Issue
Block a user