Skip to content

Commit 6abe33a

Browse files
authored
Reduce experts cache when resize (#4138)
1 parent 4462523 commit 6abe33a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lmdeploy/pytorch/messages.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,8 @@ def resize(self, size: int):
445445
"""Set size."""
446446
assert size <= self._num_real
447447
self._num_real = size
448+
if self._expert_ids is not None:
449+
self._expert_ids = self._expert_ids[:size].copy()
448450

449451
def append(self, expert_ids: np.ndarray):
450452
"""Append token ids."""

0 commit comments

Comments
 (0)