autoinference-utils 0.2.1__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {autoinference_utils-0.2.1 → autoinference_utils-0.2.2}/.gitignore +2 -0
- {autoinference_utils-0.2.1 → autoinference_utils-0.2.2}/PKG-INFO +1 -1
- {autoinference_utils-0.2.1 → autoinference_utils-0.2.2}/autoinference_utils/endpoint.py +22 -9
- {autoinference_utils-0.2.1 → autoinference_utils-0.2.2}/pyproject.toml +1 -1
- {autoinference_utils-0.2.1 → autoinference_utils-0.2.2}/README.md +0 -0
- {autoinference_utils-0.2.1 → autoinference_utils-0.2.2}/autoinference_utils/__init__.py +0 -0
|
@@ -238,9 +238,17 @@ class VLLMEndpoint(Endpoint):
|
|
|
238
238
|
health_poll_interval: float = 5.0,
|
|
239
239
|
health_request_timeout: float = 5.0,
|
|
240
240
|
):
|
|
241
|
-
|
|
241
|
+
# In bench mode vLLM runs on worker_port + 10000 and a /bench proxy
|
|
242
|
+
# listens on the original worker_port; both fall through to the same
|
|
243
|
+
# port when bench mode is off.
|
|
244
|
+
self.bench_mode = os.environ.get(BENCH_MODE_ENV) == "1"
|
|
245
|
+
self.listen_port = worker_port
|
|
246
|
+
vllm_port = (
|
|
247
|
+
worker_port + BENCH_MODE_PORT_OFFSET if self.bench_mode else worker_port
|
|
248
|
+
)
|
|
249
|
+
super().__init__(base_url=f"http://localhost:{vllm_port}")
|
|
242
250
|
self.model = model
|
|
243
|
-
self.worker_port =
|
|
251
|
+
self.worker_port = vllm_port
|
|
244
252
|
self.extra_server_args = (
|
|
245
253
|
dict(extra_server_args) if extra_server_args else {}
|
|
246
254
|
)
|
|
@@ -248,6 +256,10 @@ class VLLMEndpoint(Endpoint):
|
|
|
248
256
|
self.health_poll_interval = health_poll_interval
|
|
249
257
|
self.health_request_timeout = health_request_timeout
|
|
250
258
|
self._proc: Optional[subprocess.Popen] = None
|
|
259
|
+
self._bench_server: Optional[http.server.ThreadingHTTPServer] = None
|
|
260
|
+
|
|
261
|
+
if os.environ.get(DUMMY_WEIGHTS_ENV) == "1":
|
|
262
|
+
self.extra_server_args.setdefault("--load-format", "dummy")
|
|
251
263
|
|
|
252
264
|
def _build_cmd(self) -> list[str]:
|
|
253
265
|
cmd = [
|
|
@@ -264,13 +276,6 @@ class VLLMEndpoint(Endpoint):
|
|
|
264
276
|
return cmd
|
|
265
277
|
|
|
266
278
|
def start(self):
|
|
267
|
-
if (
|
|
268
|
-
os.environ.get(BENCH_MODE_ENV) == "1"
|
|
269
|
-
or os.environ.get(DUMMY_WEIGHTS_ENV) == "1"
|
|
270
|
-
):
|
|
271
|
-
raise NotImplementedError(
|
|
272
|
-
"bench_mode and dummy weights are not supported for VLLMEndpoint"
|
|
273
|
-
)
|
|
274
279
|
cmd = self._build_cmd()
|
|
275
280
|
print(f"[vllm] starting: {shlex.join(cmd)}")
|
|
276
281
|
self._proc = subprocess.Popen(cmd)
|
|
@@ -281,8 +286,16 @@ class VLLMEndpoint(Endpoint):
|
|
|
281
286
|
poll_interval=self.health_poll_interval,
|
|
282
287
|
request_timeout=self.health_request_timeout,
|
|
283
288
|
)
|
|
289
|
+
if self.bench_mode:
|
|
290
|
+
self._bench_server = start_bench_proxy(
|
|
291
|
+
listen_port=self.listen_port,
|
|
292
|
+
upstream_port=self.worker_port,
|
|
293
|
+
)
|
|
284
294
|
|
|
285
295
|
def stop(self):
|
|
296
|
+
if self._bench_server is not None:
|
|
297
|
+
self._bench_server.shutdown()
|
|
298
|
+
self._bench_server = None
|
|
286
299
|
terminate_process(self._proc)
|
|
287
300
|
self._proc = None
|
|
288
301
|
|
|
File without changes
|
|
File without changes
|