mirror of
https://github.com/mudler/LocalAI.git
synced 2026-07-30 09:57:57 -04:00
fix(vllm): generate protobuf 6 compatible stubs (#10944)
Pin vLLM protogen to grpcio-tools 1.78.0 so its generated code remains importable by protobuf 6.33.x, and remove stale generated artifacts before regeneration. Closes #10940 Assisted-by: Codex:gpt-5 [Codex] Co-authored-by: localai-org-maint-bot <306269227+localai-org-maint-bot@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
10211948b5
commit
71e98c13a3
@@ -407,12 +407,18 @@ function runProtogen() {
|
||||
# protobuf runtime lower (vLLM pins it to 6.33.6), crashing the backend with
|
||||
# "grpc service not ready" before it ever loads a model. Pinning
|
||||
# grpcio-tools to the installed grpcio version keeps the gencode in step with
|
||||
# the runtime. Falls back to unpinned when grpcio isn't installed yet.
|
||||
# the runtime. Backends whose protobuf runtime trails grpcio can set
|
||||
# GRPCIO_TOOLS_VERSION to the newest generator their runtime accepts. Falls
|
||||
# back to unpinned when grpcio isn't installed yet.
|
||||
# See mudler/LocalAI#10718.
|
||||
local grpcio_tools_spec="grpcio-tools"
|
||||
local grpcio_version
|
||||
grpcio_version="$(python -c 'import importlib.metadata as m; print(m.version("grpcio"))' 2>/dev/null || true)"
|
||||
if [ -n "${grpcio_version}" ]; then
|
||||
if [ -n "${GRPCIO_TOOLS_VERSION:-}" ]; then
|
||||
grpcio_tools_spec="grpcio-tools==${GRPCIO_TOOLS_VERSION}"
|
||||
else
|
||||
grpcio_version="$(python -c 'import importlib.metadata as m; print(m.version("grpcio"))' 2>/dev/null || true)"
|
||||
fi
|
||||
if [ "${grpcio_tools_spec}" = "grpcio-tools" ] && [ -n "${grpcio_version}" ]; then
|
||||
grpcio_tools_spec="grpcio-tools==${grpcio_version}"
|
||||
fi
|
||||
|
||||
@@ -422,6 +428,7 @@ function runProtogen() {
|
||||
uv pip install "${grpcio_tools_spec}"
|
||||
fi
|
||||
pushd "${EDIR}" >/dev/null
|
||||
rm -f backend_pb2.py backend_pb2.pyi backend_pb2_grpc.py
|
||||
# use the venv python (ensures correct interpreter & sys.path)
|
||||
python -m grpc_tools.protoc -I../../ -I./ --python_out=. --grpc_python_out=. backend.proto
|
||||
popd >/dev/null
|
||||
|
||||
@@ -3,6 +3,12 @@ set -e
|
||||
|
||||
EXTRA_PIP_INSTALL_FLAGS="--no-build-isolation"
|
||||
|
||||
# grpcio 1.82 bundles protoc 7.x, while vLLM's resolved protobuf runtime is
|
||||
# still 6.33.x. Generate the backend stubs with the newest grpcio-tools release
|
||||
# that emits protobuf 6.x gencode; the newer grpcio runtime can consume those
|
||||
# stubs, but protobuf 6.x cannot import 7.x gencode.
|
||||
export GRPCIO_TOOLS_VERSION="1.78.0"
|
||||
|
||||
# Avoid to overcommit the CPU during build
|
||||
# https://github.com/vllm-project/vllm/issues/20079
|
||||
# https://docs.vllm.ai/en/v0.8.3/serving/env_vars.html
|
||||
|
||||
Reference in New Issue
Block a user