mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2026-06-27 23:50:20 -05:00
gen-libllama-abi: compile sort-key regex once outside the lambda
Agent-Logs-Url: https://github.com/ggml-org/llama.cpp/sessions/cd21903e-afd2-477a-8285-0a2d46e1398c Co-authored-by: ggerganov <1991296+ggerganov@users.noreply.github.com>
This commit is contained in:
parent
51b679a5d6
commit
4943e3a396
@ -152,7 +152,13 @@ def extract_signatures(header_text: str) -> list[str]:
|
||||
if sig and '(' in sig:
|
||||
sigs.append(sig)
|
||||
|
||||
sigs.sort(key=lambda s: re.search(r'\b(llama_\w+)\s*\(', s).group(1) if re.search(r'\b(llama_\w+)\s*\(', s) else s)
|
||||
_name_re = re.compile(r'\b(llama_\w+)\s*\(')
|
||||
|
||||
def _sort_key(s: str) -> str:
|
||||
m = _name_re.search(s)
|
||||
return m.group(1) if m else s
|
||||
|
||||
sigs.sort(key=_sort_key)
|
||||
return sigs
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user