basujindal / stable-diffusion

Optimized Stable Diffusion modified to run on lower GPU VRAM
Other
3.14k stars 469 forks source link

reading prompts from none #120

Open indrakhatiwada opened 2 years ago

indrakhatiwada commented 2 years ago

D:\Man and the machine\stable-diffusion>python optimizedSD/optimized_txt2img.py --prompt "Cyberpunk style image of a Telsa car reflection in rain" --H 512 --W 512 --seed 27 --n_iter 2 --n_samples 10 --ddim_steps 50 Global seed set to 27 Loading model from models/ldm/stable-diffusion-v1/model.ckpt Global Step: 470000 UNet: Running in eps-prediction mode CondStage: Running in eps-prediction mode FirstStage: Running in eps-prediction mode making attention of type 'vanilla' with 512 in_channels Working with z of shape (1, 4, 32, 32) = 4096 dimensions. making attention of type 'vanilla' with 512 in_channels reading prompts from None Traceback (most recent call last): File "optimizedSD/optimized_txt2img.py", line 349, in get_image( File "optimizedSD/optimized_txt2img.py", line 54, in get_image with open(opt.from_file, "r") as f: TypeError: expected str, bytes or os.PathLike object, not NoneType

indrakhatiwada commented 2 years ago

i have been following a medium article to install this. i just want to try this once but this error occurs

ttarabbia commented 2 years ago

@basujindal @indrakhatiwada the optimized_txt2img.py needs to be updated line 47 checks for prompt which is not initialized until you're inside the context on line 48. either "prompt = opt.prompt" should be moved above line 47. or 47 should be "...and opt.prompt is not None:"

basujindal commented 2 years ago

@basujindal @indrakhatiwada the optimized_txt2img.py needs to be updated line 47 checks for prompt which is not initialized until you're inside the context on line 48. either "prompt = opt.prompt" should be moved above line 47. or 47 should be "...and opt.prompt is not None:"

Hi, thank you for reporting the error and the solution, I have fixed it and will push the changes. Thanks!