From b39f7f2717b79089488fed71cdc19e3664a8997b Mon Sep 17 00:00:00 2001 From: tazlin Date: Tue, 19 Dec 2023 08:00:14 -0500 Subject: [PATCH] fix: set `AIWORKER_LORA_CACHE_SIZE` This allows hordelib to set the lora cache to an appropriate size --- load_env_vars.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/load_env_vars.py b/load_env_vars.py index 21f35c25..47e82731 100644 --- a/load_env_vars.py +++ b/load_env_vars.py @@ -26,3 +26,18 @@ def load_env_vars() -> None: # FIXME: there is a dynamic way to do this "AIWORKER_CACHE_HOME environment variable already set. " "This will override the value for `cache_home` in the config file.", ) + + if "max_lora_cache_size" in config: + if os.getenv("AIWORKER_LORA_CACHE_SIZE") is None: + try: + int(config["max_lora_cache_size"]) + except ValueError as e: + raise ValueError( + "max_lora_cache_size must be an integer, but is not.", + ) from e + os.environ["AIWORKER_LORA_CACHE_SIZE"] = str(config["max_lora_cache_size"]) + else: + print( + "AIWORKER_LORA_CACHE_SIZE environment variable already set. " + "This will override the value for `max_lora_cache_size` in the config file.", + )