Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion sdks/python/apache_beam/ml/inference/vllm_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from openai import OpenAI

try:
os.environ['VLLM_CONFIGURE_LOGGING'] = "0"
import vllm # pylint: disable=unused-import
logging.info('vllm module successfully imported.')
except ModuleNotFoundError:
Expand Down Expand Up @@ -67,9 +68,12 @@ class OpenAIChatMessage():
def start_process(cmd) -> tuple[subprocess.Popen, int]:
port, = subprocess_server.pick_port(None)
cmd = [arg.replace('{{PORT}}', str(port)) for arg in cmd] # pylint: disable=not-an-iterable
vllm_env = os.environ.copy()
# Use default logging to avoid vllm breaking Beam's logging
vllm_env["VLLM_CONFIGURE_LOGGING"] = "0"
logging.info("Starting service with %s", str(cmd).replace("',", "'"))
process = subprocess.Popen(
cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=vllm_env)

# Emit the output of this command as info level logging.
def log_stdout():
Expand Down
Loading