Skip to content

Commit

Permalink
Cherry-picking vLLM backend changes (#6404)
Browse files Browse the repository at this point in the history
* Update build.py to build vLLM backend (#6394)

* Add Python backend when vLLM backend built (#6397)

---------

Co-authored-by: dyastremsky <58150256+dyastremsky@users.noreply.github.com>
  • Loading branch information
tanmayv25 and dyastremsky authored Oct 10, 2023
1 parent f04d9de commit c7fbd3c
Showing 1 changed file with 74 additions and 11 deletions.
85 changes: 74 additions & 11 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"py310_23.1.0-1", # Conda version
"9.1.0.1", # TRT version for building TRT-LLM backend
"12.2", # CUDA version for building TRT-LLM backend
"0.2.0", # vLLM version
)
}

Expand Down Expand Up @@ -1332,6 +1333,16 @@ def dockerfile_prepare_container_linux(argmap, backends, enable_gpu, target_mach
argmap["TRT_LLM_TRT_VERSION"], argmap["TRT_LLM_CUDA_VERSION"]
)

if "vllm" in backends:
# [DLIS-5606] Build Conda environment for vLLM backend
# Remove Pip install once vLLM backend moves to Conda environment.
df += """
# vLLM needed for vLLM backend
RUN pip3 install vllm=={}
""".format(
TRITON_VERSION_MAP[FLAGS.version][9]
)

df += """
WORKDIR /opt/tritonserver
RUN rm -fr /opt/tritonserver/*
Expand Down Expand Up @@ -1839,6 +1850,39 @@ def backend_build(
cmake_script.blankln()


def backend_clone(
be,
clone_script,
tag,
build_dir,
install_dir,
github_organization,
):
clone_script.commentln(8)
clone_script.comment(f"'{be}' backend")
clone_script.comment("Delete this section to remove backend from build")
clone_script.comment()
clone_script.mkdir(build_dir)
clone_script.cwd(build_dir)
clone_script.gitclone(backend_repo(be), tag, be, github_organization)

repo_target_dir = os.path.join(install_dir, "backends")
clone_script.mkdir(repo_target_dir)
backend_dir = os.path.join(repo_target_dir, be)
clone_script.rmdir(backend_dir)
clone_script.mkdir(backend_dir)

clone_script.cp(
os.path.join(build_dir, be, "src", "model.py"),
backend_dir,
)

clone_script.comment()
clone_script.comment(f"end '{be}' backend")
clone_script.commentln(8)
clone_script.blankln()


def repo_agent_build(
ra, cmake_script, build_dir, install_dir, repoagent_repo, repoagents
):
Expand Down Expand Up @@ -2504,6 +2548,15 @@ def enable_all():
log('backend "{}" at tag/branch "{}"'.format(parts[0], parts[1]))
backends[parts[0]] = parts[1]

if "vllm" in backends:
if "python" not in backends:
log(
"vLLM backend requires Python backend, adding Python backend with tag {}".format(
backends["vllm"]
)
)
backends["python"] = backends["vllm"]

# Initialize map of repo agents to build and repo-tag for each.
repoagents = {}
for be in FLAGS.repoagent:
Expand Down Expand Up @@ -2691,17 +2744,27 @@ def enable_all():
else:
github_organization = FLAGS.github_organization

backend_build(
be,
cmake_script,
backends[be],
script_build_dir,
script_install_dir,
github_organization,
images,
components,
library_paths,
)
if be == "vllm":
backend_clone(
be,
cmake_script,
backends[be],
script_build_dir,
script_install_dir,
github_organization,
)
else:
backend_build(
be,
cmake_script,
backends[be],
script_build_dir,
script_install_dir,
github_organization,
images,
components,
library_paths,
)

# Commands to build each repo agent...
for ra in repoagents:
Expand Down

0 comments on commit c7fbd3c

Please sign in to comment.