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 77from pathlib import Path
88from typing import Optional
99
10+ import pygit2
11+
1012
1113def underline (title : str , character : str = "=" ) -> str :
1214 return f"{ title } \n { character * len (title )} "
@@ -82,14 +84,16 @@ def collect_script_paths(examples_subdir: str) -> list[Path]:
8284 llmapi_doc_paths = [
8385 doc_dir / f"{ path .stem } .rst" for path in llmapi_script_paths
8486 ]
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"
8690
8791 # Collect source paths for trtllm-serve examples
8892 serve_script_paths = collect_script_paths ("serve" )
8993 serve_doc_paths = [
9094 doc_dir / f"{ path .stem } .rst" for path in serve_script_paths
9195 ]
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"
9397
9498 def _get_lines_without_metadata (filename : str ) -> str :
9599 """Get line ranges that exclude metadata lines.
@@ -147,7 +151,6 @@ def write_scripts(base_url: str,
147151 logging .warning (f"Ignoring file: { script_path .name } " )
148152 continue
149153 script_url = f"{ base_url } /{ script_path .name } "
150-
151154 # Determine language based on file extension
152155 language = "python" if script_path .suffix == ".py" else "bash"
153156
You can’t perform that action at this time.
0 commit comments