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.
@@ -242,5 +242,7 @@ Temporary Items
242
242
  benchmark_results/
243
243
  docs/*
244
244
  !docs/data-model.md
245
+ !docs/dogfood-feedback.md
246
+ !docs/main-architecture-explainer.md
245
247
  !docs/recipe-seeding.md
246
248
  !docs/sweep-learnings.md
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: autoinference-utils
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Shared endpoint abstractions for autoinference deployments
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -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
- super().__init__(base_url=f"http://localhost:{worker_port}")
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 = 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
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "autoinference-utils"
3
- version = "0.2.1"
3
+ version = "0.2.2"
4
4
  description = "Shared endpoint abstractions for autoinference deployments"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"