Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions lightllm/common/basemodel/prefill_cuda_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,18 @@ def __init__(self, decode_cuda_graph: CudaGraph, tp_world_size: int):
self.enable_prefill_microbatch_overlap = self.args.enable_prefill_microbatch_overlap
self.max_handle_token_num = self.args.prefill_cudagraph_max_handle_token

graph_handle_token_nums = []
for i in range(2048):
token_num = int(2 ** (2 * i))
if 1 < token_num < self.max_handle_token_num:
graph_handle_token_nums.append(token_num)
graph_handle_token_nums = (
list(range(4, 33, 4))
+ list(range(48, 257, 16))
+ list(range(288, 513, 32))
+ list(range(576, 1024 + 1, 64))
+ list(range(1280, 4096 + 1, 256))
+ list(range(4608, self.max_handle_token_num + 1, 512))
)
graph_handle_token_nums = [e for e in graph_handle_token_nums if e <= self.max_handle_token_num]
graph_handle_token_nums.append(self.max_handle_token_num)

graph_handle_token_nums = list(set(graph_handle_token_nums))
graph_handle_token_nums = list(set[int](graph_handle_token_nums))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Using set[int](...) at runtime will raise a TypeError: 'types.GenericAlias' object is not callable in Python. Subscription of built-in types like set[...] is only for type annotations and cannot be instantiated directly. Use set(...) instead.

Suggested change
graph_handle_token_nums = list(set[int](graph_handle_token_nums))
graph_handle_token_nums = list(set(graph_handle_token_nums))

graph_handle_token_nums.sort()
if self.args.enable_tpsp_mix_mode:
graph_handle_token_nums = [
Expand Down
Loading