Skip to content

Commit 59218c7

Browse files
committed
allow changing github org for individual backends
1 parent ba2061e commit 59218c7

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

build.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import os.path
3333
import pathlib
3434
import platform
35+
import re
3536
import stat
3637
import subprocess
3738
import sys
@@ -2063,14 +2064,14 @@ def tensorrtllm_postbuild(cmake_script, repo_install_dir, tensorrtllm_be_dir):
20632064
def backend_build(
20642065
be,
20652066
cmake_script,
2066-
tag,
2067+
tag_org,
20672068
build_dir,
20682069
install_dir,
2069-
github_organization,
20702070
images,
20712071
components,
20722072
library_paths,
20732073
):
2074+
tag, github_organization = tag_org
20742075
repo_build_dir = os.path.join(build_dir, be, "build")
20752076
repo_install_dir = os.path.join(build_dir, be, "install")
20762077

@@ -2083,8 +2084,8 @@ def backend_build(
20832084
if be == "tensorrtllm":
20842085
github_organization = (
20852086
"https://github.com/NVIDIA"
2086-
if "triton-inference-server" in FLAGS.github_organization
2087-
else FLAGS.github_organization
2087+
if "triton-inference-server" in github_organization
2088+
else github_organization
20882089
)
20892090
repository_name = "TensorRT-LLM"
20902091
cmake_script.gitclone(repository_name, tag, be, github_organization)
@@ -2133,11 +2134,11 @@ def backend_build(
21332134
def backend_clone(
21342135
be,
21352136
clone_script,
2136-
tag,
2137+
tag_org,
21372138
build_dir,
21382139
install_dir,
2139-
github_organization,
21402140
):
2141+
tag, github_organization = tag_org
21412142
clone_script.commentln(8)
21422143
clone_script.comment(f"'{be}' backend")
21432144
clone_script.comment("Delete this section to remove backend from build")
@@ -2677,7 +2678,7 @@ def enable_all():
26772678
"--backend",
26782679
action="append",
26792680
required=False,
2680-
help='Include specified backend in build as <backend-name>[:<repo-tag>]. If <repo-tag> starts with "pull/" then it refers to a pull-request reference, otherwise <repo-tag> indicates the git tag/branch to use for the build. If the version is non-development then the default <repo-tag> is the release branch matching the container version (e.g. version YY.MM -> branch rYY.MM); otherwise the default <repo-tag> is "main" (e.g. version YY.MMdev -> branch main).',
2681+
help='Include specified backend in build as <backend-name>[:<repo-tag>][:<org>]. If <repo-tag> starts with "pull/" then it refers to a pull-request reference, otherwise <repo-tag> indicates the git tag/branch to use for the build. If the version is non-development then the default <repo-tag> is the release branch matching the container version (e.g. version YY.MM -> branch rYY.MM); otherwise the default <repo-tag> is "main" (e.g. version YY.MMdev -> branch main). <org> allows using a forked repository instead of the default --github-organization value.',
26812682
)
26822683
parser.add_argument(
26832684
"--repo-tag",
@@ -2900,11 +2901,14 @@ def enable_all():
29002901
# Initialize map of backends to build and repo-tag for each.
29012902
backends = {}
29022903
for be in FLAGS.backend:
2903-
parts = be.split(":")
2904+
pattern = r"(https?:\/\/[^\s:]+)|:"
2905+
parts = list(filter(None,re.split(pattern, be)))
29042906
if len(parts) == 1:
29052907
parts.append(default_repo_tag)
2906-
log('backend "{}" at tag/branch "{}"'.format(parts[0], parts[1]))
2907-
backends[parts[0]] = parts[1]
2908+
if len(parts) == 2:
2909+
parts.append(FLAGS.github_organization)
2910+
log('backend "{}" at tag/branch "{}" from org "{}"'.format(parts[0], parts[1], parts[2]))
2911+
backends[parts[0]] = parts[1:]
29082912

29092913
if "vllm" in backends:
29102914
if "python" not in backends:
@@ -3115,7 +3119,6 @@ def enable_all():
31153119
backends[be],
31163120
script_build_dir,
31173121
script_install_dir,
3118-
github_organization,
31193122
)
31203123
else:
31213124
backend_build(
@@ -3124,7 +3127,6 @@ def enable_all():
31243127
backends[be],
31253128
script_build_dir,
31263129
script_install_dir,
3127-
github_organization,
31283130
images,
31293131
components,
31303132
library_paths,

0 commit comments

Comments
 (0)