Skip to content

Commit ba9030f

Browse files
committed
ruff check & format
1 parent 292200f commit ba9030f

4 files changed

Lines changed: 13 additions & 14 deletions

File tree

vec_inf/client/_helper.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"""
66

77
import json
8-
import os
98
import time
109
import warnings
1110
from pathlib import Path
@@ -356,7 +355,7 @@ def _get_launch_params(self) -> dict[str, Any]:
356355
# Override config defaults with CLI arguments
357356
self._apply_cli_overrides(params)
358357

359-
# Validate that weights path exists or HF model provided, and check HF cache configuration
358+
# Validate weights path exists or HF model provided, and check HF cache config
360359
utils.validate_weights_path(params, self.model_name)
361360

362361
# Check for required fields without default vals, will raise an error if missing

vec_inf/client/_slurm_script_generator.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ def __init__(self, params: dict[str, Any]):
3535
self.engine = params.get("engine", "vllm")
3636
self.is_multinode = int(self.params["num_nodes"]) > 1
3737
self.use_container = self.params["venv"] == CONTAINER_MODULE_NAME
38-
self.additional_binds = (
39-
self.params["bind"] if self.params.get("bind") else ""
40-
)
38+
self.additional_binds = self.params["bind"] if self.params.get("bind") else ""
4139
self.model_weights_path = str(
4240
Path(self.params["model_weights_parent_dir"], self.params["model_name"])
4341
)
@@ -187,7 +185,8 @@ def _generate_launch_cmd(self) -> str:
187185

188186
launch_cmd.append(
189187
"\n".join(SLURM_SCRIPT_TEMPLATE["launch_cmd"][self.engine]).format( # type: ignore[literal-required]
190-
model_weights_path=self.params.get("hf_model") or self.model_weights_path,
188+
model_weights_path=self.params.get("hf_model")
189+
or self.model_weights_path,
191190
model_name=self.params["model_name"],
192191
)
193192
)
@@ -352,7 +351,8 @@ def _generate_model_launch_script(self, model_name: str) -> Path:
352351
"\n".join(
353352
BATCH_MODEL_LAUNCH_SCRIPT_TEMPLATE["launch_cmd"][model_params["engine"]]
354353
).format(
355-
model_weights_path=model_params.get("hf_model") or model_params["model_weights_path"],
354+
model_weights_path=model_params.get("hf_model")
355+
or model_params["model_weights_path"],
356356
model_name=model_name,
357357
)
358358
)

vec_inf/client/_utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,7 @@ def check_hf_cache_and_bind(params: dict[str, Any], model_name: str) -> None:
523523
"""
524524
hf_cache_vars = ["HF_HOME", "HF_HUB_CACHE", "HUGGINGFACE_HUB_CACHE"]
525525
env_vars = params.get("env", {})
526-
set_cache_values = {
527-
env_vars[var] for var in hf_cache_vars if var in env_vars
528-
}
526+
set_cache_values = {env_vars[var] for var in hf_cache_vars if var in env_vars}
529527

530528
if not set_cache_values:
531529
warnings.warn(
@@ -540,9 +538,11 @@ def check_hf_cache_and_bind(params: dict[str, Any], model_name: str) -> None:
540538
return
541539

542540
bind_str = params.get("bind", "")
543-
existing_hosts = {
544-
b.split(":")[0] for b in bind_str.split(",") if b.strip()
545-
} if bind_str else set()
541+
existing_hosts = (
542+
{b.split(":")[0] for b in bind_str.split(",") if b.strip()}
543+
if bind_str
544+
else set()
545+
)
546546

547547
new_paths = set_cache_values - existing_hosts
548548
if new_paths:

vec_inf/client/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ class ModelConfig(BaseModel):
162162
description=(
163163
"Full HuggingFace model id/path to use for vLLM serve (e.g. "
164164
"'meta-llama/Meta-Llama-3.1-8B-Instruct')."
165-
)
165+
),
166166
)
167167
engine: Optional[str] = Field(
168168
default="vllm",

0 commit comments

Comments
 (0)