MCPcopy Create free account
hub / github.com/ScalingIntelligence/tokasaurus / ScriptConfig

Class ScriptConfig

tokasaurus/benchmarks/bench_model.py:30–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28
29
30class ScriptConfig(pydra.Config):
31 def __init__(self):
32 self.server_config = ServerConfig()
33 self.sc = pydra.Alias("server_config")
34 self.server_config.kv_cache_num_tokens = 1024 * 512
35
36 self.num_dec = 1
37 self.dec_len = 1024
38
39 self.num_pre = 0
40 self.pre_len = 1024
41
42 self.num_hyd = 0
43 self.hyd_shared_len = 1024
44 self.hyd_unique_len = 32
45
46 self.dtype = "bfloat16"
47 self.pp_rank = 0
48 self.num_iters = 10
49 self.num_warmup = 5
50 self.compile = False
51 self.dynamic = True
52 self.fullgraph = True
53
54 self.profile = False
55 self.profile_name = "bench_model"
56
57 self.non_blocking = True
58 self.plan_before = False
59 self.only_plan = False
60
61 self.graph = False
62
63 def prof(self):
64 self.profile = True
65 self.num_warmup = 3
66 self.num_iters = 10
67 self.num_profile_repeat = 3
68
69 def total_tokens(self):
70 return self.num_dec + self.num_pre * self.pre_len + self.num_hyd
71
72 def finalize(self):
73 self.server_config.max_tokens_per_forward = self.total_tokens()
74 self.server_config.max_seqs_per_forward = self.total_tokens()
75
76 if self.graph:
77 assert self.plan_before and not self.only_plan
78
79 def l8(self):
80 self.server_config.model = "meta-llama/Llama-3.1-8B-Instruct"
81 self.server_config.kv_cache_num_tokens = 1024 * 192
82
83 def l70(self):
84 self.server_config.model = "meta-llama/Llama-3.1-70B-Instruct"
85
86 def l1(self):
87 self.server_config.model = "meta-llama/Llama-3.2-1B-Instruct"

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected