[XPU] Fix Eagle3 initialization on XPU (#43957)

Signed-off-by: Chaojun Zhang <chaojun.zhang@intel.com>
Co-authored-by: Andreas Karatzas <akaratza@amd.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Kunshang Ji <kunshang.ji@intel.com>
This commit is contained in:
Chaojun Zhang
2026-07-06 08:46:05 +08:00
committed by GitHub
co-authored by Andreas Karatzas mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Kunshang Ji
parent 78a04c208d
commit d2ec433e37
3 changed files with 44 additions and 1 deletions
+20
View File
@@ -76,6 +76,26 @@ steps:
pytest -v -s v1/sample/test_logprobs.py &&
pytest -v -s v1/sample/test_logprobs_e2e.py'
- label: Basic Models Tests (Initialization)
timeout_in_minutes: 60
device: intel_gpu
no_plugin: true
working_dir: "."
env:
REGISTRY: "public.ecr.aws/q9t5s3a7"
REPO: "vllm-ci-test-repo"
VLLM_TEST_DEVICE: "xpu"
source_file_dependencies:
- vllm/
- tests/models/test_initialization.py
- tests/models/registry.py
commands:
- >-
bash .buildkite/scripts/hardware_ci/run-intel-test.sh
'export VLLM_XPU_FUSED_MOE_USE_REF=1 &&
cd tests &&
pytest -v -s models/test_initialization.py::test_can_initialize_large_subset[Eagle3MiniMaxM2ForCausalLM]'
- label: XPU CPU Offload
timeout_in_minutes: 60
device: intel_gpu
+4 -1
View File
@@ -233,7 +233,10 @@ class LlamaModel(nn.Module):
) -> tuple[torch.Tensor, torch.Tensor]:
if input_embeds is None:
input_embeds = self.embed_input_ids(input_ids)
assert hidden_states.shape[-1] == input_embeds.shape[-1]
torch._assert(
hidden_states.shape[-1] == input_embeds.shape[-1],
"hidden_states and input_embeds must have the same last dimension",
)
residual = None
for layer in self.layers:
+20
View File
@@ -1468,6 +1468,26 @@ class SpecDecodeBaseProposer:
"Sharing target model embedding weights with the draft model."
)
if share_embeddings:
draft_embed = self.model.model.embed_tokens
# Only share when both models use the same embedding width.
# Guard with isinstance so non-Tensor weights (e.g. in tests)
# are not affected — mirrors the weight-equality check above.
if isinstance(target_embed_tokens.weight, torch.Tensor) and isinstance(
draft_embed.weight, torch.Tensor
):
target_dim = target_embed_tokens.weight.shape[-1]
draft_dim = draft_embed.weight.shape[-1]
if target_dim != draft_dim:
share_embeddings = False
logger.info(
"Target embedding dim (%d) differs from draft "
"embedding dim (%d). Keeping separate embedding "
"weights.",
target_dim,
draft_dim,
)
if share_embeddings:
if hasattr(self.model.model, "embed_tokens"):
del self.model.model.embed_tokens