mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
fix: update unit tests
This commit is contained in:
+27
-12
@@ -8,12 +8,16 @@ class TestUtils(unittest.TestCase):
|
|||||||
test_cases = [
|
test_cases = [
|
||||||
{
|
{
|
||||||
"input": ("some prompt, very cool, <lora:hey-lora:0.4>, cool <lora:you-lora:0.2>", [], 5),
|
"input": ("some prompt, very cool, <lora:hey-lora:0.4>, cool <lora:you-lora:0.2>", [], 5),
|
||||||
"output": [("hey-lora.safetensors", 0.4), ("you-lora.safetensors", 0.2)],
|
"output": (
|
||||||
|
[('hey-lora.safetensors', 0.4), ('you-lora.safetensors', 0.2)], 'some prompt, very cool, cool'),
|
||||||
},
|
},
|
||||||
# Test can not exceed limit
|
# Test can not exceed limit
|
||||||
{
|
{
|
||||||
"input": ("some prompt, very cool, <lora:hey-lora:0.4>, cool <lora:you-lora:0.2>", [], 1),
|
"input": ("some prompt, very cool, <lora:hey-lora:0.4>, cool <lora:you-lora:0.2>", [], 1),
|
||||||
"output": [("hey-lora.safetensors", 0.4)],
|
"output": (
|
||||||
|
[('hey-lora.safetensors', 0.4)],
|
||||||
|
'some prompt, very cool, cool'
|
||||||
|
),
|
||||||
},
|
},
|
||||||
# test Loras from UI take precedence over prompt
|
# test Loras from UI take precedence over prompt
|
||||||
{
|
{
|
||||||
@@ -22,22 +26,33 @@ class TestUtils(unittest.TestCase):
|
|||||||
[("hey-lora.safetensors", 0.4)],
|
[("hey-lora.safetensors", 0.4)],
|
||||||
5,
|
5,
|
||||||
),
|
),
|
||||||
"output": [
|
"output": (
|
||||||
("hey-lora.safetensors", 0.4),
|
[
|
||||||
("l1.safetensors", 0.4),
|
('hey-lora.safetensors', 0.4),
|
||||||
("l2.safetensors", -0.2),
|
('l1.safetensors', 0.4),
|
||||||
("l3.safetensors", 0.3),
|
('l2.safetensors', -0.2),
|
||||||
("l4.safetensors", 0.5),
|
('l3.safetensors', 0.3),
|
||||||
|
('l4.safetensors', 0.5)
|
||||||
],
|
],
|
||||||
|
'some prompt, very cool'
|
||||||
|
)
|
||||||
},
|
},
|
||||||
# Test lora specification not separated by comma are ignored, only latest specified is used
|
|
||||||
{
|
{
|
||||||
"input": ("some prompt, very cool, <lora:hey-lora:0.4><lora:you-lora:0.2>", [], 3),
|
"input": ("some prompt, very cool, <lora:hey-lora:0.4><lora:you-lora:0.2>", [], 3),
|
||||||
"output": [("you-lora.safetensors", 0.2)],
|
"output": (
|
||||||
|
[
|
||||||
|
('hey-lora.safetensors', 0.4),
|
||||||
|
('you-lora.safetensors', 0.2)
|
||||||
|
],
|
||||||
|
'some prompt, very cool, <lora:you-lora:0.2><lora:hey-lora:0.4>'
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"input": ("<lora:foo:1..2>, <lora:bar:.>, <lora:baz:+> and <lora:quux:>", [], 6),
|
"input": ("<lora:foo:1..2>, <lora:bar:.>, <test:1.0>, <lora:baz:+> and <lora:quux:>", [], 6),
|
||||||
"output": []
|
"output": (
|
||||||
|
[],
|
||||||
|
'<lora:foo:1..2>, <lora:bar:.>, <test:1.0>, <lora:baz:+> and <lora:quux:>'
|
||||||
|
)
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user