Unverified Commit 7906d1d2 authored by Lianmin Zheng's avatar Lianmin Zheng Committed by GitHub
Browse files

Remove the unused write_with_records (#2972)

parent 81d27c8e
......@@ -158,7 +158,6 @@ class ImageInputs:
im_end_id: Optional[torch.Tensor] = None
slice_start_id: Optional[torch.Tensor] = None
slice_end_id: Optional[torch.Tensor] = None
tgt_sizes: Optional[list] = None
@staticmethod
......
......@@ -49,7 +49,6 @@ class ReqToTokenPool:
size: int,
max_context_len: int,
device: str,
use_records: bool,
enable_memory_saver: bool,
):
memory_saver_adapter = TorchMemorySaverAdapter.create(
......@@ -64,17 +63,9 @@ class ReqToTokenPool:
(size, max_context_len), dtype=torch.int32, device=device
)
self.free_slots = list(range(size))
self.write_records = []
self.use_records = use_records
if self.use_records:
self.write = self.write_with_records
else:
self.write = self.write_without_records
def write(self, indices, values):
# Keep the signature for type checking. It will be assigned during runtime.
raise NotImplementedError()
self.req_to_token[indices] = values
def available_size(self):
return len(self.free_slots)
......@@ -96,23 +87,6 @@ class ReqToTokenPool:
def clear(self):
self.free_slots = list(range(self.size))
self.write_records = []
def write_without_records(self, indices, values):
self.req_to_token[indices] = values
def write_with_records(self, indices, values):
self.req_to_token[indices] = values
self.write_records.append((indices, values))
def get_write_records(self):
ret = self.write_records
self.write_records = []
return ret
def apply_write_records(self, write_records: List[Tuple]):
for indices, values in write_records:
self.req_to_token[indices] = values
class BaseTokenToKVPool:
......
......@@ -617,7 +617,6 @@ class ModelRunner:
size=max_num_reqs + 1,
max_context_len=self.model_config.context_len + 4,
device=self.device,
use_records=False,
enable_memory_saver=self.server_args.enable_memory_saver,
)
if (
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment