Hotfix #708... (#710)

pull/712/head
Aarni Koskela 2024-01-16 13:18:51 +02:00 committed by GitHub
parent eea2ebb68f
commit 7499182064
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -17,7 +17,8 @@ class SpecialSyntaxAwareMagicPromptGenerator(MagicPromptGenerator):
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 [

View File

@ -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}"}]