lucidrains / big-sleep

A simple command line tool for text to image generation, using OpenAI's CLIP and a BigGAN. Technique was originally created by https://twitter.com/advadnoun
MIT License
2.57k stars 304 forks source link

Possible to add random seed value to output file name? #69

Closed pmonck closed 3 years ago

pmonck commented 3 years ago

Would it be possible to add the random seed value generated by --random to the output file name to make it easier to re-use?

LtqxWYEG commented 3 years ago

Sure, just change these lines in the file: /usr/local/lib/python3.7/dist-packages/big_sleep/big_sleep.py or wherever you find the big_sleep.py file on your computer if you don't use a colab notebook.

Line number 317: self.set_text(seed, text, text_min)
...
332: def set_text(self, seed, text, text_min=""):
...
343: self.filename = Path(f'./{textpath}_{seed}.png')

Then it will save the seed value in the filename of the images.

"--random" just creates a number from 0 to 1000000 and saves it in the seed variable: cli.py

if random:
seed = rnd.randint(0, 1e6)
lucidrains commented 3 years ago

@pmonck done with --append-seed flag! https://github.com/lucidrains/big-sleep/commit/9ba158bbe45c42d259b489de52c05a131483dd82

pmonck commented 3 years ago

Great, thanks!

pmonck commented 3 years ago

I'm now getting filenames containing "\" which were previously removed automatically. Seems to be independent of --append_seed flag. Will raise as new issue.