Skip to content

Commit 3189924

Browse files
authored
[SW-234344] Fix 'RotaryEmbedding' object has no attribute 'sin' (#1658)
## Essential Elements of an Effective PR Description Checklist - [X] The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)". - [ ] The test plan, such as providing test command. - [ ] The test results, such as pasting the results comparison before and after, or e2e results ## Purpose Fix issue reported by https://jira.habana-labs.com/browse/SW-234344 ## Test Plan ## Test Result <!--- pyml disable-next-line no-emphasis-as-heading --> Signed-off-by: Chendi.Xue <[email protected]>
1 parent ecaeb91 commit 3189924

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

vllm/model_executor/layers/rotary_embedding.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ def forward_hpu(
268268
# Prepare cos-sin caches for long-context + LoRA with offsets for every
269269
# forward, since the offset information wasn't available previously
270270
if hasattr(self, "scaling_factors") or hasattr(
271-
self, "scaling_factor") or self.sin is None:
271+
self, "scaling_factor") or not hasattr(
272+
self, "sin") or self.sin is None:
272273
self.prepare_cos_sin(positions, offsets)
273274

274275
num_tokens = positions.numel()
@@ -812,7 +813,8 @@ def forward_hpu(
812813
rope_mode: RotaryPosEmbeddingMode
813814
rope_mode = RotaryPosEmbeddingMode.BLOCKWISE
814815

815-
if hasattr(self, "scaling_factors") or self.sin is None:
816+
if hasattr(self, "scaling_factors") or not hasattr(
817+
self, "sin") or self.sin is None:
816818
self.prepare_cos_sin(positions, offsets)
817819
if self.recompute_cos_sin:
818820
self.prepare_cos_sin(positions, offsets, recompute_cos_sin=True)

0 commit comments

Comments
 (0)