@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 2382ad29d1
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 15, 22:15 UTC

[ci] fix linter (#13701)

Signed-off-by: youkaichao <youkaichao@gmail.com>

youkaichao committed Feb 22, 2025 at 20:28 UTC 2382ad29d1769f2b46d51fcc2cedbd6e00d4f180
5 files changed +11 -7
examples/offline_inference/data_parallel.py
+5 -4
@@ -48,15 +48,16 @@ def main(dp_size, dp_rank, dp_master_ip, dp_master_port, GPUs_per_dp_rank):
48 max_tokens=16 * (dp_rank + 1))
49
50 # Create an LLM.
51 - llm = LLM(model="facebook/opt-125m", tensor_parallel_size=2, enforce_eager=True)
51 + llm = LLM(model="facebook/opt-125m",
52 + tensor_parallel_size=2,
53 + enforce_eager=True)
54 outputs = llm.generate(prompts, sampling_params)
55 # Print the outputs.
56 for output in outputs:
57 prompt = output.prompt
58 generated_text = output.outputs[0].text
57 - print(
58 - f"DP rank {dp_rank}, Prompt: {prompt!r}, "
59 - f"Generated text: {generated_text!r}")
59 + print(f"DP rank {dp_rank}, Prompt: {prompt!r}, "
60 + f"Generated text: {generated_text!r}")
61
62
63 if __name__ == "__main__":
vllm/config.py
+1 -1
@@ -1372,7 +1372,7 @@ class ParallelConfig:
1372
1373 @staticmethod
1374 def has_unfinished_dp(dp_group: "ProcessGroup",
1375 - has_unfinished: bool) -> bool:
1375 + has_unfinished: bool) -> bool:
1376 tensor = torch.tensor([has_unfinished],
1377 dtype=torch.int32,
1378 device="cpu")
vllm/utils.py
+1
@@ -518,6 +518,7 @@ def get_open_port() -> int:
518 return port
519 return _get_open_port()
520
521 +
522 def _get_open_port() -> int:
523 port = envs.VLLM_PORT
524 if port is not None:
vllm/v1/engine/core_client.py
+2 -1
@@ -89,7 +89,7 @@ class EngineCoreClient(ABC):
89
90 def execute_dummy_batch(self) -> None:
91 raise NotImplementedError
92 -
92 +
93 async def execute_dummy_batch_async(self) -> None:
94 raise NotImplementedError
95
@@ -343,6 +343,7 @@ class SyncMPClient(MPClient):
343 def execute_dummy_batch(self) -> None:
344 self._call_utility("execute_dummy_batch")
345
346 +
347 class AsyncMPClient(MPClient):
348 """Asyncio-compatible client for multi-proc EngineCore."""
349
vllm/v1/worker/gpu_model_runner.py
+2 -1
@@ -1167,7 +1167,8 @@ class GPUModelRunner(LoRAModelRunnerMixin):
1167 for k, v in self.intermediate_tensors.items()
1168 })
1169
1170 - with set_forward_context(None, self.vllm_config, num_tokens=num_tokens):
1170 + with set_forward_context(None, self.vllm_config,
1171 + num_tokens=num_tokens):
1172 hidden_states = model(
1173 input_ids=input_ids,
1174 positions=positions,