Skip to content

Commit c7fbd3c

Browse files
Cherry-picking vLLM backend changes (#6404)
* Update build.py to build vLLM backend (#6394) * Add Python backend when vLLM backend built (#6397) --------- Co-authored-by: dyastremsky <[email protected]>
1 parent f04d9de commit c7fbd3c

File tree

1 file changed

+74
-11
lines changed

1 file changed

+74
-11
lines changed

build.py

+74-11
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"py310_23.1.0-1", # Conda version
8181
"9.1.0.1", # TRT version for building TRT-LLM backend
8282
"12.2", # CUDA version for building TRT-LLM backend
83+
"0.2.0", # vLLM version
8384
)
8485
}
8586

@@ -1332,6 +1333,16 @@ def dockerfile_prepare_container_linux(argmap, backends, enable_gpu, target_mach
13321333
argmap["TRT_LLM_TRT_VERSION"], argmap["TRT_LLM_CUDA_VERSION"]
13331334
)
13341335

1336+
if "vllm" in backends:
1337+
# [DLIS-5606] Build Conda environment for vLLM backend
1338+
# Remove Pip install once vLLM backend moves to Conda environment.
1339+
df += """
1340+
# vLLM needed for vLLM backend
1341+
RUN pip3 install vllm=={}
1342+
""".format(
1343+
TRITON_VERSION_MAP[FLAGS.version][9]
1344+
)
1345+
13351346
df += """
13361347
WORKDIR /opt/tritonserver
13371348
RUN rm -fr /opt/tritonserver/*
@@ -1839,6 +1850,39 @@ def backend_build(
18391850
cmake_script.blankln()
18401851

18411852

1853+
def backend_clone(
1854+
be,
1855+
clone_script,
1856+
tag,
1857+
build_dir,
1858+
install_dir,
1859+
github_organization,
1860+
):
1861+
clone_script.commentln(8)
1862+
clone_script.comment(f"'{be}' backend")
1863+
clone_script.comment("Delete this section to remove backend from build")
1864+
clone_script.comment()
1865+
clone_script.mkdir(build_dir)
1866+
clone_script.cwd(build_dir)
1867+
clone_script.gitclone(backend_repo(be), tag, be, github_organization)
1868+
1869+
repo_target_dir = os.path.join(install_dir, "backends")
1870+
clone_script.mkdir(repo_target_dir)
1871+
backend_dir = os.path.join(repo_target_dir, be)
1872+
clone_script.rmdir(backend_dir)
1873+
clone_script.mkdir(backend_dir)
1874+
1875+
clone_script.cp(
1876+
os.path.join(build_dir, be, "src", "model.py"),
1877+
backend_dir,
1878+
)
1879+
1880+
clone_script.comment()
1881+
clone_script.comment(f"end '{be}' backend")
1882+
clone_script.commentln(8)
1883+
clone_script.blankln()
1884+
1885+
18421886
def repo_agent_build(
18431887
ra, cmake_script, build_dir, install_dir, repoagent_repo, repoagents
18441888
):
@@ -2504,6 +2548,15 @@ def enable_all():
25042548
log('backend "{}" at tag/branch "{}"'.format(parts[0], parts[1]))
25052549
backends[parts[0]] = parts[1]
25062550

2551+
if "vllm" in backends:
2552+
if "python" not in backends:
2553+
log(
2554+
"vLLM backend requires Python backend, adding Python backend with tag {}".format(
2555+
backends["vllm"]
2556+
)
2557+
)
2558+
backends["python"] = backends["vllm"]
2559+
25072560
# Initialize map of repo agents to build and repo-tag for each.
25082561
repoagents = {}
25092562
for be in FLAGS.repoagent:
@@ -2691,17 +2744,27 @@ def enable_all():
26912744
else:
26922745
github_organization = FLAGS.github_organization
26932746

2694-
backend_build(
2695-
be,
2696-
cmake_script,
2697-
backends[be],
2698-
script_build_dir,
2699-
script_install_dir,
2700-
github_organization,
2701-
images,
2702-
components,
2703-
library_paths,
2704-
)
2747+
if be == "vllm":
2748+
backend_clone(
2749+
be,
2750+
cmake_script,
2751+
backends[be],
2752+
script_build_dir,
2753+
script_install_dir,
2754+
github_organization,
2755+
)
2756+
else:
2757+
backend_build(
2758+
be,
2759+
cmake_script,
2760+
backends[be],
2761+
script_build_dir,
2762+
script_install_dir,
2763+
github_organization,
2764+
images,
2765+
components,
2766+
library_paths,
2767+
)
27052768

27062769
# Commands to build each repo agent...
27072770
for ra in repoagents:

0 commit comments

Comments
 (0)