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

[Core] Support tensor parallelism for GGUF quantization #7520

Merged
merged 9 commits into from
Aug 19, 2024

Conversation

Isotr0py
Copy link
Collaborator

@Isotr0py Isotr0py commented Aug 14, 2024

FILL IN THE PR DESCRIPTION HERE

FIX #7662

BEFORE SUBMITTING, PLEASE READ THE CHECKLIST BELOW AND FILL IN THE DESCRIPTION ABOVE


PR Checklist (Click to Expand)

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.

PR Title and Classification

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:

  • [Bugfix] for bug fixes.
  • [CI/Build] for build or continuous integration improvements.
  • [Doc] for documentation fixes and improvements.
  • [Model] for adding a new model or improving an existing model. Model name should appear in the title.
  • [Frontend] For changes on the vLLM frontend (e.g., OpenAI API server, LLM class, etc.)
  • [Kernel] for changes affecting CUDA kernels or other compute kernels.
  • [Core] for changes in the core vLLM logic (e.g., LLMEngine, AsyncLLMEngine, Scheduler, etc.)
  • [Hardware][Vendor] for hardware-specific changes. Vendor name should appear in the prefix (e.g., [Hardware][AMD]).
  • [Misc] for PRs that do not fit the above categories. Please use this sparingly.

Note: If the PR spans more than one category, please include all relevant prefixes.

Code Quality

The PR need to meet the following code quality standards:

  • We adhere to Google Python style guide and Google C++ style guide.
  • Pass all linter checks. Please use format.sh to format your code.
  • The code need to be well-documented to ensure future contributors can easily understand the code.
  • Include sufficient tests to ensure the project to stay correct and robust. This includes both unit tests and integration tests.
  • Please add documentation to docs/source/ if the PR modifies the user-facing behaviors of vLLM. It helps vLLM user understand and utilize the new features or changes.

Notes for Large Changes

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 rfc-required and might not go through the PR.

What to Expect for the Reviews

The goal of the vLLM team is to be a transparent reviewing machine. 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:

  • 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.
  • 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.
  • After the review, the reviewer will put an action-required label on the PR if there are changes required. The contributor should address the comments and ping the reviewer to re-review the PR.
  • 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.

Thank You

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!

Copy link

👋 Hi! Thank you for contributing to the vLLM project.
Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which consists a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of default ones by unblocking the steps in your fast-check build on Buildkite UI.

Once the PR is approved and ready to go, please make sure to run full CI as it is required to merge (or just use auto-merge).

To run full CI, you can do one of these:

  • Comment /ready on the PR
  • Add ready label to the PR
  • Enable auto-merge.

🚀

Copy link
Member

@mgoin mgoin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks reasonable and would be a nice to have. Have you tested it/is it ready?

@Isotr0py
Copy link
Collaborator Author

Isotr0py commented Aug 16, 2024

This is not ready yet, because I encountered result divergence on one of test prompts when running the test with tp_size=2. I need some time to investigate this issue. (Both original and gguf outputs are different from the ones with tp_size=1)

AssertionError when tp_size=2:

>                   assert output_id_0 in logprobs_elem_1, fail_msg
E                   AssertionError: Test0:
E                   Matched tokens:     [13]
E                   original:   '\n3. OpenAI GPT-3: OpenAI GPT-3 is a language model pre-trained on a vast corpus of text data' {29941: Logprob(logprob=-1.9912292957305908, rank=1, decoded_token='3'), 29906: Logprob(logprob=-2.006854295730591, rank=2, decoded_token='2'), 29946: Logprob(logprob=-2.795916795730591, rank=3, decoded_token='4'), 1576: Logprob(logprob=-2.858416795730591, rank=4, decoded_token='The'), 29896: Logprob(logprob=-3.108416795730591, rank=5, decoded_token='1')}
E                   gguf:       '\nThe LASER system is designed to be highly scalable and can handle large data sets with millions of examples per second without any significant performance degradation'    {1576: Logprob(logprob=-1.9153773784637451, rank=1, decoded_token='The'), 3563: Logprob(logprob=-2.806002378463745, rank=2, decoded_token='Over'), 797: Logprob(logprob=-2.970064878463745, rank=3, decoded_token='In'), 2208: Logprob(logprob=-3.845064878463745, rank=4, decoded_token='LL'), 1762: Logprob(logprob=-3.852877378463745, rank=5, decoded_token='To')}

tests/models/utils.py:111: AssertionError

@mgoin
Copy link
Member

mgoin commented Aug 16, 2024

Okay no worries, just wanted to make sure you weren't forgotten. Ping me when ready

@Isotr0py
Copy link
Collaborator Author

I evaluated the Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf model with tp_size=2 on gsm8k dataset, and the result looks good.

VLLM server cmd

vllm serve Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf --tensor-parallel-size 2 --dtype half --api-key token-abc123 --max-model-len 8192

LM-eval cmd

export OPENAI_API_KEY=token-abc123
lm_eval --model local-completions --tasks gsm8k --batch_size 8 -L 400 \
    --output_path Meta-Llama-3.1-8B-Instruct-Q4_K_M-Result \
    --model_args model=Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf,base_url=http://localhost:8000/v1/,tokenizer=TroyDoesAI/Llama-3.1-8B-Instruct,tokenizer_backend=huggingface

Result

2024-08-18:04:28:45,392 INFO     [_client.py:1026] HTTP Request: POST http://localhost:8000/v1/completions "HTTP/1.1 200 OK"
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 50/50 [40:47<00:00, 48.95s/it]
local-completions (model=Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf,base_url=http://localhost:8000/v1/,tokenizer=TroyDoesAI/Llama-3.1-8B-Instruct,tokenizer_backend=huggingface), gen_kwargs: (None), limit: 400.0, num_fewshot: None, batch_size: 8
|Tasks|Version|     Filter     |n-shot|  Metric   |   |Value |   |Stderr|
|-----|------:|----------------|-----:|-----------|---|-----:|---|-----:|
|gsm8k|      3|flexible-extract|     5|exact_match|↑  |0.7575|±  |0.0215|
|     |       |strict-match    |     5|exact_match|↑  |0.7425|±  |0.0219|

The result divergence may be unrelated to the tensor parallelism implementation but the test itself.

@Isotr0py
Copy link
Collaborator Author

/ready

@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Aug 18, 2024
Copy link
Member

@mgoin mgoin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!!

@mgoin mgoin merged commit 7601cb0 into vllm-project:main Aug 19, 2024
49 checks passed
@Isotr0py Isotr0py deleted the gguf-tp branch August 20, 2024 05:30
zifeitong pushed a commit to zifeitong/vllm that referenced this pull request Aug 20, 2024
fialhocoelho pushed a commit to opendatahub-io/vllm that referenced this pull request Aug 22, 2024
omrishiv pushed a commit to omrishiv/vllm that referenced this pull request Aug 26, 2024
Alvant pushed a commit to compressa-ai/vllm that referenced this pull request Oct 26, 2024
KuntaiDu pushed a commit to KuntaiDu/vllm that referenced this pull request Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready ONLY add when PR is ready to merge/full CI is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: GGUF quantization with tensor parallelism
2 participants