Skip to content

Fixing (1) tensor size mismatch and (2) missing prepare_cos_sin issues for Phi-3.5 #916

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 1, 2025

Conversation

mrezavand
Copy link
Collaborator

@mrezavand mrezavand commented Mar 14, 2025

Solving the two issues reported in: https://jira.habana-labs.com/browse/SW-221986

  1. vLLM both offline and online inferencing of the "microsoft/Phi-3.5-mini-instruct" model firstly complained about a missing 'prepare_cos_sin' method, that is necessary for the rotational position embeddings (RoPE):
ERROR 03-11 10:04:32 engine.py:389]   File "/home/vllm-fork/vllm/worker/hpu_model_runner.py", line 424, in _prepare_cos_sin
ERROR 03-11 10:04:32 engine.py:389]     raise AttributeError(
ERROR 03-11 10:04:32 engine.py:389] AttributeError: The module at the end of the path does not have a 'prepare_cos_sin' method.
  1. Model fails due the a size mismatch:
File "/home/vllm-fork/vllm/model_executor/layers/rotary_embedding.py", line 641, in forward
    query_rot = query_rot * cos + _rotate_neox(query_rot) * sin
RuntimeError: The size of tensor a (96) must match the size of tensor b (1024) at non-singleton dimension 3 

@michalkuligowski
Copy link

/run-gaudi-tests

@mrezavand
Copy link
Collaborator Author

@michalkuligowski I just fix the ruff issue.

@michalkuligowski
Copy link

/run-gaudi-tests

@michalkuligowski
Copy link

/run-gaudi-tests

@michalkuligowski
Copy link

/run-gaudi-tests

@michalkuligowski michalkuligowski merged commit c795cc5 into HabanaAI:habana_main Apr 1, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants