File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 7
7
from pathlib import Path
8
8
from typing import Optional
9
9
10
+ import pygit2
11
+
10
12
11
13
def underline (title : str , character : str = "=" ) -> str :
12
14
return f"{ title } \n { character * len (title )} "
@@ -82,14 +84,16 @@ def collect_script_paths(examples_subdir: str) -> list[Path]:
82
84
llmapi_doc_paths = [
83
85
doc_dir / f"{ path .stem } .rst" for path in llmapi_script_paths
84
86
]
85
- llmapi_script_base_url = "https://github.com/NVIDIA/TensorRT-LLM/tree/main/examples/llm-api"
87
+ repo = pygit2 .Repository ('.' )
88
+ commit_hash = str (repo .head .target )
89
+ llmapi_script_base_url = f"https://github.com/NVIDIA/TensorRT-LLM/blob/{ commit_hash } /examples/llm-api"
86
90
87
91
# Collect source paths for trtllm-serve examples
88
92
serve_script_paths = collect_script_paths ("serve" )
89
93
serve_doc_paths = [
90
94
doc_dir / f"{ path .stem } .rst" for path in serve_script_paths
91
95
]
92
- serve_script_base_url = "https://github.com/NVIDIA/TensorRT-LLM/tree/main /examples/serve"
96
+ serve_script_base_url = f "https://github.com/NVIDIA/TensorRT-LLM/blob/ { commit_hash } /examples/serve"
93
97
94
98
def _get_lines_without_metadata (filename : str ) -> str :
95
99
"""Get line ranges that exclude metadata lines.
@@ -147,7 +151,6 @@ def write_scripts(base_url: str,
147
151
logging .warning (f"Ignoring file: { script_path .name } " )
148
152
continue
149
153
script_url = f"{ base_url } /{ script_path .name } "
150
-
151
154
# Determine language based on file extension
152
155
language = "python" if script_path .suffix == ".py" else "bash"
153
156
You can’t perform that action at this time.
0 commit comments