diff --git a/vllm/model_executor/layers/rotary_embedding.py b/vllm/model_executor/layers/rotary_embedding.py index 523250c30807..9a7a168d8ddc 100644 --- a/vllm/model_executor/layers/rotary_embedding.py +++ b/vllm/model_executor/layers/rotary_embedding.py @@ -22,6 +22,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """Rotary Positional Embeddings.""" +import functools import math from typing import Any, Dict, List, Optional, Tuple, Union @@ -1404,6 +1405,7 @@ def get_next_input_positions( ] @staticmethod + @functools.lru_cache(maxsize=1024) def get_next_input_positions_tensor( mrope_position_delta: int, context_len: int,