Skip to content

Conversation

joerunde
Copy link
Collaborator

@joerunde joerunde commented Sep 3, 2024

This PR updates the PYTHON_VERSION default arg in the cuda dockerfile to 3.12

We suspect this may improve performance, as IBM-built vlm images using python 3.11 instead of 3.10 are faster, and the Python 3.11 release was performance focused, see: https://docs.python.org/3/whatsnew/3.11.html

Python 3.12 is the latest stable release, and also included more performance fixes for asyncio:

The asyncio package has had a number of performance improvements, with some benchmarks showing a 75% speed up.

It looks like all of the images in this repo set their python versions independently, maybe we should update all of them to 3.12 as well, but I wanted to keep the blast radius small here.
I'm trying to build this image locally to test it out, but it may be faster to just enable CI and see what happens 😉

Might provide a very small mitigation for #8147, looks like a ~1% throughput improvement from quick tests


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!

@joerunde joerunde marked this pull request as ready for review September 3, 2024 21:00
Copy link

github-actions bot commented Sep 3, 2024

👋 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 starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping @simon-mo or @khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can do one of these:

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

🚀

@simon-mo simon-mo requested a review from khluu September 3, 2024 21:03
@khluu khluu added the ready ONLY add when PR is ready to merge/full CI is needed label Sep 3, 2024
Signed-off-by: Joe Runde <[email protected]>
# A newer setuptools is required for installing some test dependencies from source that do not publish python 3.12 wheels
# This installation must complete before the test dependencies are collected and installed.
RUN --mount=type=cache,target=/root/.cache/pip \
python3 -m pip install "setuptools>=74.1.1"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The build without this failed with

[2024-09-03T22:25:50Z] #37 2.608 Collecting transformers_stream_generator (from -r requirements-test.txt (line 24))
[2024-09-03T22:25:50Z] #37 2.618   Downloading transformers-stream-generator-0.0.5.tar.gz (13 kB)
[2024-09-03T22:25:50Z] #37 2.627   Preparing metadata (setup.py): started
[2024-09-03T22:25:50Z] #37 2.646   Preparing metadata (setup.py): finished with status 'error'
[2024-09-03T22:25:50Z] #37 2.648   error: subprocess-exited-with-error
[2024-09-03T22:25:50Z] #37 2.648   
[2024-09-03T22:25:50Z] #37 2.648   × python setup.py egg_info did not run successfully.
[2024-09-03T22:25:50Z] #37 2.648   │ exit code: 1
[2024-09-03T22:25:50Z] #37 2.648   ╰─> [1 lines of output]
[2024-09-03T22:25:50Z] #37 2.648       ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.
[2024-09-03T22:25:50Z] #37 2.648       [end of output]
[2024-09-03T22:25:50Z] #37 2.648   
[2024-09-03T22:25:50Z] #37 2.648   note: This error originates from a subprocess, and is likely not a problem with pip.
[2024-09-03T22:25:50Z] #37 2.657 error: metadata-generation-failed

I verified this was because the vllm-base target never updates setuptools, so it still has version 45.2.0 installed, which causes this error with a very misleading message.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder why setuptools is at 45.2.0 specifically and why being on an older version leads to this error message? The message doesn't mention anything about version being outdated/incompatible, only that setuptools is nto in the build env.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, it took some googling around to find that others ran into the same error when setuptools is just out of date- I don't know why that's the case but I'd guess it's just some api incompatibility that's not quite correctly handled.

You can reproduce by installing setuptools==45.2.0 and then trying to install transformers-stream-generator in a fresh python 3.12 venv

I wonder why setuptools is at 45.2.0 specifically

Yeah idk, from the build logs it looks like that's just what's installed when we do apt-get install -y python3.12 python3.12-dev python3.12-venv, I see this in the log:

[2024-09-05T21:34:56Z] #10 11.07 Get:191 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 python3-setuptools all 45.2.0-1ubuntu0.1 [330 kB]

@khluu khluu removed the ready ONLY add when PR is ready to merge/full CI is needed label Sep 3, 2024
@youkaichao
Copy link
Member

is 3.12 too agressive? some packages might not publish 3.12 wheels.

I think 3.11 should be safe to upgrade.

Signed-off-by: Joe Runde <[email protected]>
@joerunde
Copy link
Collaborator Author

joerunde commented Sep 4, 2024

@youkaichao solid maybe

I'm looking through all the failures right now to see if anything is really bad, but in general I'd expect that since 3.12 has been stable for a year and we're less than a month away from the 3.13 release, packages should be out for 3.12 by now for anything that's worth depending on. If we have dependencies that are not 3.12 compatible, it'd be better to question why we're including them if they're not regularly maintained.

edit: so far it looks like it's just the six package that's problematic, but only because we're not installing the latest version in the image. But that could be hiding other errors, 🤞

@joerunde
Copy link
Collaborator Author

joerunde commented Sep 4, 2024

Alright, fastcheck tests are passing and a quick check with a llama 7b model on an A100 at least shows that it's not slower:

python qps median ttft median tpot tput (tok/s)
3.12 4 46.96 13.76 622.67
3.12 16 62.54 27.79 1436.32
3.10 4 47.07 14.11 622.29
3.10 16 67.26 29.24 1404.17

At 4 qps the results are the same but it looks a little better at 16 qps. I think this tracks, higher loads should run into contention with the cpu more.

I could beg for some more gpus to run some tp tests with larger models if anybody wants more data before merging.

@simon-mo @khluu think we can at least run the full CI suite here?

@khluu khluu added the ready ONLY add when PR is ready to merge/full CI is needed label Sep 4, 2024
@khluu
Copy link
Collaborator

khluu commented Sep 4, 2024

Marked ready so we can run full suite

"logging.config.dictConfig") as dict_config_mock:
_configure_vllm_root_logger()
assert dict_config_mock.called_with(valid_logging_config)
dict_config_mock.assert_called_with(valid_logging_config)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is failing and I'm not sure what the expected behavior of this test was before, looking into it a bit to try to understand

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So I think that the mock on logging.config.dictConfig was incorrect, because vllm.logger imports that eagerly, so we instead have to mock the local vllm.logger.dictConfig.

The test was passing before because dict_config_mock.called_with was returning a mock, which was then passing the assert since it's not falsey.

@joerunde
Copy link
Collaborator Author

joerunde commented Sep 6, 2024

I got my hands on 2 A100s and ran a quick comparison with llama2-70b, tp=2

python qps median ttft median tpot tput (tok/s)
3.12 4 273.99 98.26 959.07
3.12 16 3157.57 164.87 1267.78
3.10 4 308.58 102.64 953.74
3.10 16 3211.16 168.52 1249.13

Looks faster 🚀🚀🚀

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.

Looks good to me - maybe we should update the minimum version of setuptools in the common requirements

@joerunde
Copy link
Collaborator Author

joerunde commented Sep 6, 2024

@mgoin we could, I just wasn't sure if we wanted to include setuptools as a dependency. It's in requirements-build.txt atm, so it does get updated for the dockerfile targets that build vllm, but not in the ones that consume it. It only seems to be a problem for installing a dependency that's currently listed as only a test dependency.

What I want to say here is that, presumably the 3.12 wheels are already working and I don't want to change them. But, since I did have to explicitly add six to the common requirements, maybe nobody is looking very closely at the 3.12 wheels 🤔

I don't really feel strongly either way- mostly I'd rather not have to wait for another build lol. Let me know if you want that change in and I'll add it.

@khluu khluu merged commit cfe712b into vllm-project:main Sep 7, 2024
69 checks passed
@Patrick10203
Copy link

When building the docker file from the main branch and starting the finished build i get this error:
Traceback (most recent call last): File "<frozen runpy>", line 189, in _run_module_as_main File "<frozen runpy>", line 112, in _get_module_details File "/usr/local/lib/python3.12/dist-packages/vllm/__init__.py", line 3, in <module> from vllm.engine.arg_utils import AsyncEngineArgs, EngineArgs File "/usr/local/lib/python3.12/dist-packages/vllm/engine/arg_utils.py", line 11, in <module> from vllm.config import (CacheConfig, ConfigFormat, DecodingConfig, File "/usr/local/lib/python3.12/dist-packages/vllm/config.py", line 12, in <module> from vllm.model_executor.layers.quantization import QUANTIZATION_METHODS File "/usr/local/lib/python3.12/dist-packages/vllm/model_executor/__init__.py", line 3, in <module> from vllm.model_executor.sampling_metadata import (SamplingMetadata, File "/usr/local/lib/python3.12/dist-packages/vllm/model_executor/sampling_metadata.py", line 11, in <module> from vllm.triton_utils.sample import get_num_triton_sampler_splits File "/usr/local/lib/python3.12/dist-packages/vllm/triton_utils/__init__.py", line 7, in <module> from vllm.triton_utils.custom_cache_manager import ( File "/usr/local/lib/python3.12/dist-packages/vllm/triton_utils/custom_cache_manager.py", line 3, in <module> from triton.runtime.cache import (FileCacheManager, default_cache_dir, File "/usr/local/lib/python3.12/dist-packages/triton/__init__.py", line 8, in <module> from .runtime import ( File "/usr/local/lib/python3.12/dist-packages/triton/runtime/__init__.py", line 1, in <module> from .autotuner import (Autotuner, Config, Heuristics, autotune, heuristics) File "/usr/local/lib/python3.12/dist-packages/triton/runtime/autotuner.py", line 9, in <module> from ..testing import do_bench, do_bench_cudagraph File "/usr/local/lib/python3.12/dist-packages/triton/testing.py", line 7, in <module> from . import language as tl File "/usr/local/lib/python3.12/dist-packages/triton/language/__init__.py", line 4, in <module> from . import math File "/usr/local/lib/python3.12/dist-packages/triton/language/math.py", line 1, in <module> from . import core File "/usr/local/lib/python3.12/dist-packages/triton/language/core.py", line 10, in <module> from ..runtime.jit import jit File "/usr/local/lib/python3.12/dist-packages/triton/runtime/jit.py", line 12, in <module> from ..runtime.driver import driver File "/usr/local/lib/python3.12/dist-packages/triton/runtime/driver.py", line 1, in <module> from ..backends import backends File "/usr/local/lib/python3.12/dist-packages/triton/backends/__init__.py", line 50, in <module> backends = _discover_backends() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/triton/backends/__init__.py", line 44, in _discover_backends driver = _load_module(name, os.path.join(root, name, 'driver.py')) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/triton/backends/__init__.py", line 12, in _load_module spec.loader.exec_module(module) File "/usr/local/lib/python3.12/dist-packages/triton/backends/nvidia/driver.py", line 7, in <module> from triton.runtime.build import _build File "/usr/local/lib/python3.12/dist-packages/triton/runtime/build.py", line 8, in <module> import setuptools File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 5, in <module> import distutils.core ModuleNotFoundError: No module named 'distutils'

Is this because the package is removed in python 3.12? See here: https://docs.python.org/3.10/library/distutils.html
I see that the setuptools is now installed which should solve this issue but somehow it doesnt for me...

@youkaichao
Copy link
Member

cc @joerunde

@Patrick10203
Copy link

Patrick10203 commented Sep 11, 2024

I have some more infos for this problem. When i launched the docker image with bash and execute pip list i can see that setuptools has version 45.2.0. When i execute "pip install setuptools==74.1.2" and then start vllm server, it works. When i only do pip install setuptools it doesnt work. I dont understand how it didnt install the newer version of setuptools when building the docker file.

I also double checked my Dockerfile i have git pulled and it contains this line:
RUN --mount=type=cache,target=/root/.cache/pip
python3 -m pip install "setuptools>=74.1.1"

dtrifiro pushed a commit to opendatahub-io/vllm that referenced this pull request Sep 12, 2024
@thies1006
Copy link

Apparently I have exactly the same issue.

@joerunde
Copy link
Collaborator Author

Ah shoot, sorry all. @mgoin was right, I should've just added that to the common requirements :(

I also double checked my Dockerfile i have git pulled and it contains this line:
RUN --mount=type=cache,target=/root/.cache/pip
python3 -m pip install "setuptools>=74.1.1"

That's only in the test stage, so it doesn't make it to the final image. I added it there because not having it caused an error installing test dependencies.

Is this a regression for the latest released images? Or only for images manually built directly off main?
I'll start on a fix

Alvant pushed a commit to compressa-ai/vllm that referenced this pull request Oct 26, 2024
garg-amit pushed a commit to garg-amit/vllm that referenced this pull request Oct 28, 2024
LeiWang1999 pushed a commit to LeiWang1999/vllm-bitblas that referenced this pull request Mar 26, 2025
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.

6 participants