okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
ffa7a90b7
main
1"""The four decode-speed evaluation prompts (essay, code edit, translation, explanation).""" 2 3CODE = '''import os, json 4 5def load(path): 6with open(path) as f: 7return json.load(f) 8 9def save(path, data): 10tmp = path + ".tmp" 11with open(tmp, "w") as f: 12json.dump(data, f, indent=2) 13os.replace(tmp, path) 14 15def merge(a, b): 16out = dict(a) 17for k, v in b.items(): 18if k in out and isinstance(out[k], dict) and isinstance(v, dict): 19out[k] = merge(out[k], v) 20else: 21out[k] = v 22return out 23 24def find_files(root, ext): 25result = [] 26for d, _, files in os.walk(root): 27for name in files: 28if name.endswith(ext): 29result.append(os.path.join(d, name)) 30return sorted(result) 31 32def main(root): 33cfg = {} 34for p in find_files(root, ".json"): 35cfg = merge(cfg, load(p)) 36save(os.path.join(root, "merged.json"), cfg) 37return len(cfg) 38''' 39EN = ("Mixture-of-experts models activate only a small subset of their parameters for each token, " 40"which makes them attractive for consumer hardware: the total parameter count can exceed the " 41"available GPU memory, while the per-token compute stays modest. The main difficulty is memory " 42"bandwidth. When expert weights live in system RAM, every generated token must stream the selected " 43"experts through the CPU memory bus or across PCIe, and this transfer, rather than arithmetic, " 44"usually determines decoding speed." ) 45PROMPTS = [ 46 ("essay" ,"用中文写一篇大约600字的散文,主题是秋天的城市。" ), 47 ("code_edit" ,"给下面代码的每个函数加上类型注解和一行中文 docstring,其他内容保持不变,输出完整代码:\n\n" + CODE ), 48 ("translate" ,"把下面这段英文翻译成中文:\n\n" + EN ), 49 ("explain" ,"详细解释 TCP 三次握手和四次挥手的过程,以及为什么需要这样设计。" ), 50]