Cleanup config file loader (#208)

* fix config file loader

* prune nonetype values from config dict

fixes default values not initialising properly

* Utils: Shrink None removal function

It is more concise to use a list and dict collection if necessary
rather than iterating through and checking each value. Tested and
works with Tabby's cases.

Signed-off-by: kingbri <bdashore3@proton.me>

---------

Signed-off-by: kingbri <bdashore3@proton.me>
Co-authored-by: kingbri <bdashore3@proton.me>
This commit is contained in:
TerminalMan
2024-09-24 02:42:01 +01:00
committed by GitHub
parent fb903ecddf
commit f4791e7ed9
3 changed files with 17 additions and 7 deletions

View File

@@ -9,7 +9,7 @@ from loguru import logger
from pydantic import AliasChoices, BaseModel, Field
from typing import Dict, List, Optional, Union
from common.utils import unwrap, prune_dict
from common.utils import filter_none_values, unwrap
# Common class for sampler params
@@ -403,7 +403,7 @@ def overrides_from_dict(new_overrides: dict):
"""Wrapper function to update sampler overrides"""
if isinstance(new_overrides, dict):
overrides_container.overrides = prune_dict(new_overrides)
overrides_container.overrides = filter_none_values(new_overrides)
else:
raise TypeError("New sampler overrides must be a dict!")