stable-diffusion icon indicating copy to clipboard operation
stable-diffusion copied to clipboard

How to properly format --from-file?

Open MojoJojo43 opened this issue 3 years ago • 3 comments

Been looking since yesterday and haven't found the answer lol.

How in the heck do we accomplish executing multiple prompts from a txt file? Is there an example somewhere that shows exactly what to do?

THanks!

UPDATE

So I started tinkering around and basically just brute-forced it with every way possible. I am able to get it to read the prompts from a text file but the samples are a bit bizarre to say the least. Here is what I have come up with. This is my initial command:

python scripts/txt2img.py --ckpt sd-v1-4.ckpt --from-file prompt-test.txt --n_samples 2 --seed 43 --n_iter 4

and these are the two prompts located in the prompt-test.txt:

--prompt "classic cars"

--prompt "amazing tree house"

What's weird is that the first image created for the prompt is fine, but the second image is always some sort of monstrosity. So the images will be sequentially, birdhouse, monstrosity, classic car, monstrosity, birdhouse, monstrosity classic car, monstrosity, birdhouse, monstrosity....... you get the picture.

What could be causing this strangness?

MojoJojo43 avatar Sep 12 '22 03:09 MojoJojo43

Do you think you need to add --prompt to the file?

Can you try to only have in your prompt-test.txt the proper lines?

classic cars
amazing tree house

Ouro17 avatar Sep 12 '22 09:09 Ouro17

Do you think you need to add --prompt to the file?

Like I said, no idea what I am doing here haha! I made the suggested changes and got rid of the --prompt but still, same thing happens.

MojoJojo43 avatar Sep 12 '22 15:09 MojoJojo43

I get the following error when I just put a prompt on each line (with and without parenthesis).

RuntimeError: einsum(): operands do not broadcast with remapped shapes [original->remapped]:

peteralieber avatar Oct 14 '22 20:10 peteralieber

rewrite chunk() as: def chunk(it, size): return [size * [prompt] for prompt in it] will resolve --from-file errors.

zcablii avatar May 03 '23 11:05 zcablii