Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync with IBM/main #13

Merged
merged 155 commits into from
May 7, 2024
Merged

Conversation

dtrifiro
Copy link

@dtrifiro dtrifiro commented May 7, 2024

sync with IBM/vllm@4c758aa2

prashantgupta24 and others added 30 commits May 3, 2024 13:59
Update dockerfile.ubi to build vllm using wheels! I had to update some
`init` files since we need those packages to be picked up when building
the wheel for vllm.

### Integration tests


https://v3.travis.ibm.com/github/ai-foundation/fmaas-inference-server/builds/17962397

Image pushed to quay for testing:
```
quay.io/wxpe/tgis-vllm:release-vllm-wheel.eec7a7b
```

<img width="1020" alt="Screenshot 2024-04-23 at 12 18 00"
src="https://github.com/IBM/vllm/assets/9909241/f261bc38-d1f9-4d1a-a5d6-9db14aa362a6">

Useful command to build the above tests:
```
env:
  global:
    - REMOTE_INTEGRATION_TESTS=true
    - REMOTE_INTEGRATION_TEST_IMAGE=quay.io/wxpe/tgis-vllm:release-vllm-wheel.eec7a7b
    - REMOTE_INTEGRATION_TEST_CONFIG=product.vllm
```
---

<details>
<!-- inside this <details> section, markdown rendering does not work, so
we use raw html here. -->
<summary><b> PR Checklist (Click to Expand) </b></summary>

<p>Thank you for your contribution to vLLM! Before submitting the pull
request, please ensure the PR meets the following criteria. This helps
vLLM maintain the code quality and improve the efficiency of the review
process.</p>

<h3>PR Title and Classification</h3>
<p>Only specific types of PRs will be reviewed. The PR title is prefixed
appropriately to indicate the type of change. Please use one of the
following:</p>
<ul>
    <li><code>[Bugfix]</code> for bug fixes.</li>
<li><code>[CI/Build]</code> for build or continuous integration
improvements.</li>
<li><code>[Doc]</code> for documentation fixes and improvements.</li>
<li><code>[Model]</code> for adding a new model or improving an existing
model. Model name should appear in the title.</li>
<li><code>[Frontend]</code> For changes on the vLLM frontend (e.g.,
OpenAI API server, <code>LLM</code> class, etc.) </li>
<li><code>[Kernel]</code> for changes affecting CUDA kernels or other
compute kernels.</li>
<li><code>[Core]</code> for changes in the core vLLM logic (e.g.,
<code>LLMEngine</code>, <code>AsyncLLMEngine</code>,
<code>Scheduler</code>, etc.)</li>
<li><code>[Hardware][Vendor]</code> for hardware-specific changes.
Vendor name should appear in the prefix (e.g.,
<code>[Hardware][AMD]</code>).</li>
<li><code>[Misc]</code> for PRs that do not fit the above categories.
Please use this sparingly.</li>
</ul>
<p><strong>Note:</strong> If the PR spans more than one category, please
include all relevant prefixes.</p>

<h3>Code Quality</h3>

<p>The PR need to meet the following code quality standards:</p>

<ul>
<li>We adhere to <a
href="https://google.github.io/styleguide/pyguide.html">Google Python
style guide</a> and <a
href="https://google.github.io/styleguide/cppguide.html">Google C++
style guide</a>.</li>
<li>Pass all linter checks. Please use <a
href="https://github.com/vllm-project/vllm/blob/main/format.sh"><code>format.sh</code></a>
to format your code.</li>
<li>The code need to be well-documented to ensure future contributors
can easily understand the code.</li>
<li>Include sufficient tests to ensure the project to stay correct and
robust. This includes both unit tests and integration tests.</li>
<li>Please add documentation to <code>docs/source/</code> if the PR
modifies the user-facing behaviors of vLLM. It helps vLLM user
understand and utilize the new features or changes.</li>
</ul>

<h3>Notes for Large Changes</h3>
<p>Please keep the changes as concise as possible. For major
architectural changes (>500 LOC excluding kernel/data/config/test), we
would expect a GitHub issue (RFC) discussing the technical design and
justification. Otherwise, we will tag it with <code>rfc-required</code>
and might not go through the PR.</p>

<h3>What to Expect for the Reviews</h3>

<p>The goal of the vLLM team is to be a <i>transparent reviewing
machine</i>. We would like to make the review process transparent and
efficient and make sure no contributor feel confused or frustrated.
However, the vLLM team is small, so we need to prioritize some PRs over
others. Here is what you can expect from the review process: </p>

<ul>
<li> After the PR is submitted, the PR will be assigned to a reviewer.
Every reviewer will pick up the PRs based on their expertise and
availability.</li>
<li> After the PR is assigned, the reviewer will provide status update
every 2-3 days. If the PR is not reviewed within 7 days, please feel
free to ping the reviewer or the vLLM team.</li>
<li> After the review, the reviewer will put an <code>
action-required</code> label on the PR if there are changes required.
The contributor should address the comments and ping the reviewer to
re-review the PR.</li>
<li> Please respond to all comments within a reasonable time frame. If a
comment isn't clear or you disagree with a suggestion, feel free to ask
for clarification or discuss the suggestion.
 </li>
</ul>

<h3>Thank You</h3>

<p> Finally, thank you for taking the time to read these guidelines and
for your interest in contributing to vLLM. Your contributions make vLLM
a great tool for everyone! </p>


</details>

---------

Signed-off-by: Prashant Gupta <prashantgupta@us.ibm.com>
Signed-off-by: Nick Hill <nickhill@us.ibm.com>
Co-authored-by: Daniel Clark <daniel.clark@ibm.com>
…/crash in distributed inference (vllm-project#4079)

Co-authored-by: Simon Mo <simon.mo@hey.com>
Co-authored-by: simon-mo <simon.mo@hey.com>
Co-authored-by: Zhong Wang <wangzhong@infini-ai.com>
Co-authored-by: Ubuntu <ubuntu@ip-172-31-13-147.ec2.internal>
Co-authored-by: Harry Mellor <hmellor@oxts.com>
…roject#4118)

Provide an initial support to FP8 computation. This PR is inspired by HuggingFace TGI: huggingface/text-generation-inference#1726

This feature can be enabled with --quantization fp8 or -q fp8 when launching an engine.

Algorithm:
We still load a model checkpoint in FP16/BF16. After the weights are loaded, Fp8LinearMethod calculates the per-tensor scaling factor of weights and quantizes the weights accordingly. The scaling factor will then be stored for future use. Meanwhile, the per-tensor scaling factor for activations is calculated in every forward pass.

Initial Results:
Currently tested Mistral-7B on 1xH100. With prompt length ~5 and decoding length 128:

BF16: 1.47s
FP8: 1.66s
I'll try to use larger models and try to find more performance bottleneck. Meanwhile, you're welcome to try this code.
Co-authored-by: Harry Mellor <hmellor@oxts.com>
…ct#3748)

Co-authored-by: Yun Ding <yunding@nvidia.com>
Co-authored-by: Roger Wang <ywang@roblox.com>
Co-authored-by: Harry Mellor <hmellor@oxts.com>
DefTruth and others added 19 commits May 6, 2024 11:35
Co-authored-by: LiuXiaoxuanPKU <llilyliupku@gmail.com>
… Dynamic/Static Activations) (vllm-project#4527)

Follow on to vllm-project#4332 to enable FP8 checkpoint loading for Mixtral and supersedes vllm-project#4436.

This PR enables the following checkpoint loading features for Mixtral:

Supports loading fp8 checkpoints for Mixtral, such as this "nm-testing/Mixtral-8x7B-Instruct-v0.1-FP8" test model
Supports static or dynamic activation quantization with static weight quantization (all per tensor)
Supports different scales for each expert weight
Supports Fp8 in QKV layer
Notes:

The Expert Gate/Router always runs at half / full precision for now.
If there are different weight scales between QKV layer (for separate QKV weights), they are re-quantized using layer.weight_scale.max() so we can have a single gemm for performance.
Signed-off-by: Joe Runde <Joseph.Runde@ibm.com>
@dtrifiro
Copy link
Author

dtrifiro commented May 7, 2024

@z103cb here's the current diff with IBM/main

diff --git a/Dockerfile.ubi b/Dockerfile.ubi
index 452b3fa0..48e87808 100644
--- a/Dockerfile.ubi
+++ b/Dockerfile.ubi
@@ -116,7 +116,7 @@ RUN ldconfig /usr/local/cuda-12.2/compat/
 ## Python cuda base #################################################################
 FROM cuda-devel as python-cuda-base
 
-COPY --from=python-install --link /opt/vllm /opt/vllm
+COPY --from=python-install /opt/vllm /opt/vllm
 ENV PATH=/opt/vllm/bin/:$PATH
 
 # install cuda and common dependencies
@@ -206,16 +206,16 @@ ENV PATH=/usr/local/cuda/bin:$PATH
 ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
 
 # Copy the entire directory before building wheel
-COPY --link vllm vllm
+COPY vllm vllm
 
 # Comment if building *.so files from scratch
 ##################################################
 # Copy the prebuilt *.so files
-COPY --from=prebuilt-wheel --link /workspace/vllm/*.so /workspace/vllm/
+COPY --from=prebuilt-wheel /workspace/vllm/*.so /workspace/vllm/
 ##################################################
 
 # Copy over the generated *.pb2 files
-COPY --from=gen-protos --link /workspace/vllm/entrypoints/grpc/pb vllm/entrypoints/grpc/pb
+COPY --from=gen-protos /workspace/vllm/entrypoints/grpc/pb vllm/entrypoints/grpc/pb
 
 ENV CCACHE_DIR=/root/.cache/ccache
 RUN --mount=type=cache,target=/root/.cache/ccache \
@@ -251,7 +251,7 @@ FROM cuda-runtime AS vllm-openai
 WORKDIR /workspace
 
 # Create release python environment
-COPY --from=python-cuda-base --link /opt/vllm /opt/vllm
+COPY --from=python-cuda-base /opt/vllm /opt/vllm
 ENV PATH=/opt/vllm/bin/:$PATH
 
 # install vllm wheel first, so that torch etc will be installed
diff --git a/vllm/entrypoints/grpc/grpc_server.py b/vllm/entrypoints/grpc/grpc_server.py
index 15885fca..ebec0bbc 100644
--- a/vllm/entrypoints/grpc/grpc_server.py
+++ b/vllm/entrypoints/grpc/grpc_server.py
@@ -92,7 +92,6 @@ class TextGenerationService(generation_pb2_grpc.GenerationServiceServicer):
         self.engine: AsyncLLMEngine = engine
 
         # These set in _post_init()
-        self.tokenizer_group: BaseTokenizerGroup = None
         self.tokenizer: Union[PreTrainedTokenizer,
                               PreTrainedTokenizerFast] = None
         self.config: ModelConfig = None
@@ -101,9 +100,13 @@ class TextGenerationService(generation_pb2_grpc.GenerationServiceServicer):
         self.skip_special_tokens = not args.output_special_tokens
         self.default_include_stop_seqs = args.default_include_stop_seqs
 
+    @property
+    def tokenizer_group(self) -> BaseTokenizerGroup:
+        return self.engine.engine.tokenizer
+
+
     async def _post_init(self):
         self.config = await self.engine.get_model_config()
-        self.tokenizer_group = await self.engine.get_tokenizer_group()
         self.tokenizer = await self.engine.get_tokenizer()
 
         # Swap in the special TGIS stats logger

@z103cb
Copy link

z103cb commented May 7, 2024

/lgtm
/approved

@z103cb
Copy link

z103cb commented May 7, 2024

/approve

@z103cb
Copy link

z103cb commented May 7, 2024

/approve

Copy link

openshift-ci bot commented May 7, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dtrifiro, z103cb

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@z103cb z103cb merged commit 26e6259 into opendatahub-io:ibm_main May 7, 2024
2 of 3 checks passed
@dtrifiro dtrifiro deleted the sync-with-upstream branch May 17, 2024 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.