-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3c75320
commit cc5740f
Showing
12 changed files
with
131 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Copyright 2023 The HuggingFace Team All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
FROM huggingface/optimum-nvidia:latest | ||
|
||
# Ignore interactive questions during `docker build` | ||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
# Run as non-root user | ||
ARG USER_ID | ||
ARG GROUP_ID | ||
|
||
RUN addgroup --gid $GROUP_ID user | ||
RUN adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID user | ||
|
||
# Add local bin to PATH | ||
ENV PATH="/home/user/.local/bin:${PATH}" | ||
|
||
# Add user to sudoers | ||
RUN adduser user sudo | ||
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers | ||
|
||
# Change user | ||
USER user | ||
WORKDIR /home/user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from dataclasses import dataclass | ||
from logging import getLogger | ||
|
||
from omegaconf import OmegaConf | ||
|
||
from ...import_utils import tesnorrt_version | ||
from ..config import BackendConfig | ||
|
||
LOGGER = getLogger("tensorrt-llm") | ||
|
||
OmegaConf.register_new_resolver("tensorrt_llm_version", tesnorrt_version) | ||
|
||
SUPPORTED_DTYPES = ["float16", "bfloat16", "float32"] | ||
|
||
|
||
@dataclass | ||
class TRTLLMConfig(BackendConfig): | ||
name: str = "tensorrt_llm" | ||
version: str = "${tensorrt_llm_version:}" | ||
_target_: str = "optimum_benchmark.backends.tensorrt_llm.backend.TRTLLMBackend" | ||
|
||
# build config | ||
tp: int = 1 | ||
pp: int = 1 | ||
use_fp8: bool = False | ||
dtype: str = "float16" | ||
optimization_level: int = 2 | ||
use_cuda_graph: bool = False | ||
gpus_per_node: int = "${available_gpus:}" | ||
world_size: int = "${backend.gpus_per_node}" | ||
|
||
max_batch_size: int = "${benchmark.input_shapes.batch_size}" | ||
max_prompt_length: int = "${benchmark.input_shapes.sequence_length}" | ||
max_new_tokens: int = "${benchmark.new_tokens}" | ||
|
||
def __post_init__(self) -> None: | ||
super().__post_init__() | ||
|
||
if self.dtype not in SUPPORTED_DTYPES: | ||
raise ValueError(f"dtype must be one of float16, bfloat16, float32, got {self.dtype}") | ||
|
||
if self.gpus_per_node != self.world_size: | ||
raise ValueError(f"gpus_per_node ({self.gpus_per_node}) != world_size ({self.world_size})") | ||
|
||
if self.world_size != self.pp * self.tp: | ||
raise ValueError(f"world_size ({self.gpus_per_node}) != pp ({self.pp}) * tp ({self.tp})") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
MODEL_TYPE_TO_TRTLLMMODEL = {"llama": "optimum.nvidia.models.llama.LlamaForCausalLM"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters