refactor InvokeAIAppConfig

This commit is contained in:
Lincoln Stein
2023-08-17 13:47:26 -04:00
parent 503e3bca54
commit ed38eaa10c
10 changed files with 498 additions and 393 deletions

View File

@ -31,6 +31,21 @@ InvokeAI:
"""
)
init3 = OmegaConf.create(
"""
InvokeAI:
Generation:
sequential_guidance: true
attention_type: xformers
attention_slice_size: 7
forced_tiled_decode: True
Device:
device: cpu
Cache:
ram: 1.25
"""
)
def test_use_init():
# note that we explicitly set omegaconf dict and argv here
@ -51,6 +66,16 @@ def test_use_init():
assert not hasattr(conf2, "invalid_attribute")
def test_legacy():
conf = InvokeAIAppConfig.get_config()
assert conf
conf.parse_args(conf=init3, argv=[])
assert conf.xformers_enabled
assert conf.device == "cpu"
assert conf.use_cpu
assert conf.ram_cache_size == 1.25
def test_argv_override():
conf = InvokeAIAppConfig.get_config()
conf.parse_args(conf=init1, argv=["--always_use_cpu", "--max_cache=10"])