Skip to content

Commit

Permalink
Hotfix #708... (#710)
Browse files Browse the repository at this point in the history
  • Loading branch information
akx authored Jan 16, 2024
1 parent eea2ebb commit 7499182
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sd_dynamic_prompts/magic_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def _generate_magic_prompts(self, orig_prompts: list[str]) -> list[str]:
orig_prompts, chunks = zip(
*(remove_a1111_special_syntax_chunks(p) for p in orig_prompts),
)
magic_prompts = super()._generate_magic_prompts(orig_prompts)
# `transformers` is rather particular that the input is a list, not a tuple
magic_prompts = super()._generate_magic_prompts(list(orig_prompts))
# in case we somehow get less magic prompts than we started with,
# use zip_longest instead of zip.
return [
Expand Down
1 change: 1 addition & 0 deletions tests/prompts/test_magic_prompts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
def fake_generator(prompts, **_kwargs):
assert isinstance(prompts, list) # be as particular as transformers is
for prompt in prompts:
assert "<" not in prompt # should have been stripped
yield [{"generated_text": f"magical {prompt}"}]
Expand Down

0 comments on commit 7499182

Please sign in to comment.