From d26260b332b4ca3c546fb5d7b528ec05213e5fb6 Mon Sep 17 00:00:00 2001 From: kingbri <8082010+kingbri1@users.noreply.github.com> Date: Mon, 21 Apr 2025 22:39:07 -0400 Subject: [PATCH] Model: Add fixes for kwargs and add note for migration One goal is to try migrating away from kwargs and use the ModelLoadRequest instead. However, Pydantic doesn't support async validators making parsing of the inline config impossible due to its use of aiofiles. Signed-off-by: kingbri <8082010+kingbri1@users.noreply.github.com> --- common/model.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/model.py b/common/model.py index a5a6272..19e8d3c 100644 --- a/common/model.py +++ b/common/model.py @@ -46,7 +46,6 @@ def load_progress(module, modules): yield module, modules -# TODO: Change this to be inline with config.yml async def apply_inline_overrides(model_dir: pathlib.Path, **kwargs): """Sets overrides from a model folder's config yaml.""" @@ -105,10 +104,12 @@ async def load_model_gen(model_path: pathlib.Path, **kwargs): container = None # Model_dir is already provided - # TODO: Isolate the root cause - kwargs.pop("model_dir") + if "model_dir" in kwargs: + kwargs.pop("model_dir") # Merge with config and inline defaults + # TODO: Figure out a way to do this with Pydantic validation + # and ModelLoadRequest. Pydantic doesn't have async validators kwargs = {**config.model_defaults, **kwargs} kwargs = await apply_inline_overrides(model_path, **kwargs)