[V1] Do not store None in self.generators (#11038)
Signed-off-by: Woosuk Kwon <woosuk.kwon@berkeley.edu>
This commit is contained in:
@@ -102,6 +102,8 @@ class InputBatch:
|
|||||||
self.top_k_reqs: Set[str] = set()
|
self.top_k_reqs: Set[str] = set()
|
||||||
|
|
||||||
# req_index -> generator
|
# req_index -> generator
|
||||||
|
# NOTE(woosuk): The indices of the requests that do not have their own
|
||||||
|
# generator should not be included in the dictionary.
|
||||||
self.generators: Dict[int, torch.Generator] = {}
|
self.generators: Dict[int, torch.Generator] = {}
|
||||||
|
|
||||||
self.num_logprobs: Dict[str, int] = {}
|
self.num_logprobs: Dict[str, int] = {}
|
||||||
@@ -147,7 +149,10 @@ class InputBatch:
|
|||||||
if sampling_params.top_k > 0:
|
if sampling_params.top_k > 0:
|
||||||
self.top_k_reqs.add(req_id)
|
self.top_k_reqs.add(req_id)
|
||||||
|
|
||||||
self.generators[req_index] = request.generator
|
# NOTE(woosuk): self.generators should not include the requests that
|
||||||
|
# do not have their own generator.
|
||||||
|
if request.generator is not None:
|
||||||
|
self.generators[req_index] = request.generator
|
||||||
|
|
||||||
num_logprobs = sampling_params.logprobs
|
num_logprobs = sampling_params.logprobs
|
||||||
if num_logprobs is not None and num_logprobs > 0:
|
if num_logprobs is not None and num_logprobs > 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user