Skip to content

Commit

Permalink
fix: set AIWORKER_LORA_CACHE_SIZE
Browse files Browse the repository at this point in the history
This allows hordelib to set the lora cache to an appropriate size
  • Loading branch information
tazlin committed Dec 19, 2023
1 parent 2495687 commit a91fb14
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions load_env_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
)

0 comments on commit a91fb14

Please sign in to comment.