Skip to content

Commit ae813c7

Browse files
committed
added --config flag
1 parent f170696 commit ae813c7

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

vec_inf/cli/_cli.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ def cli() -> None:
124124
type=str,
125125
help="Environment variables to be set. Seperate variables with commas. Can also include path to a file containing environment variables seperated by newlines. e.g. --env 'TRITON_CACHE_DIR=/scratch/.cache/triton,my_custom_vars_file.env'",
126126
)
127+
@click.option(
128+
"--config",
129+
type=str,
130+
help="Path to a model config yaml file to use in place of the default",
131+
)
127132
def launch(
128133
model_name: str,
129134
**cli_kwargs: Optional[Union[str, int, float, bool]],
@@ -166,6 +171,10 @@ def launch(
166171
Path to model weights directory
167172
- vllm_args : str, optional
168173
vLLM engine arguments
174+
- env : str, optional
175+
Environment variables
176+
- config : str, optional
177+
Path to custom model config yaml file
169178
- json_mode : bool, optional
170179
Output in JSON format
171180

vec_inf/client/_helper.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def __init__(self, model_name: str, kwargs: Optional[dict[str, Any]]):
6161
self.kwargs = kwargs or {}
6262
self.slurm_job_id = ""
6363
self.slurm_script_path = Path("")
64-
self.model_config = self._get_model_configuration()
64+
self.model_config = self._get_model_configuration(self.kwargs.get("config"))
6565
self.params = self._get_launch_params()
6666

6767
def _warn(self, message: str) -> None:
@@ -74,9 +74,14 @@ def _warn(self, message: str) -> None:
7474
"""
7575
warnings.warn(message, UserWarning, stacklevel=2)
7676

77-
def _get_model_configuration(self) -> ModelConfig:
77+
def _get_model_configuration(self, config_path: str | None = None) -> ModelConfig:
7878
"""Load and validate model configuration.
7979
80+
Parameters
81+
----------
82+
config_path : str | None, optional
83+
Path to a yaml file with custom model config to use in place of the default
84+
8085
Returns
8186
-------
8287
ModelConfig
@@ -89,7 +94,7 @@ def _get_model_configuration(self) -> ModelConfig:
8994
ModelConfigurationError
9095
If model configuration is not found and weights don't exist
9196
"""
92-
model_configs = utils.load_config()
97+
model_configs = utils.load_config(config_path=config_path)
9398
config = next(
9499
(m for m in model_configs if m.model_name == self.model_name), None
95100
)

vec_inf/client/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ class LaunchOptions:
218218
Additional arguments for vLLM
219219
env : str, optional
220220
Environment variables to be set
221+
config : str, optional
222+
Path to custom model config yaml
221223
"""
222224

223225
model_family: Optional[str] = None
@@ -238,6 +240,7 @@ class LaunchOptions:
238240
model_weights_parent_dir: Optional[str] = None
239241
vllm_args: Optional[str] = None
240242
env: Optional[str] = None
243+
config: Optional[str] = None
241244

242245

243246
@dataclass

0 commit comments

Comments
 (0)