mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
refactor InvokeAIAppConfig
This commit is contained in:
@ -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"])
|
||||
|
Reference in New Issue
Block a user