Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix for #708. #710

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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