jquesnelle / txt2imghd

A port of GOBIG for Stable Diffusion
MIT License
693 stars 83 forks source link

Breaks on Windows when using a large prompt #12

Closed trafgals closed 2 years ago

trafgals commented 2 years ago

Hi guys, I'm using Windows and I'm not sure if that makes a difference here, but my prompt is: Swordsman holding a huge sword, ornate, elegant, amazing, intricate, extremely detailed, smooth, beautiful composition, sharp focus, illustration, concept art, digital painting, greg rutkowski, yoshitaka amano, frank frazetta, boris vallejo, sorceress, magic, fantasy, demonic, radiating magical power in the style of Castlevania

I then get

(ldm) PS C:\proj\waifu-diffusion> python scripts/txt2imghd.py
prompt: Swordsman with huge sword, long hair, ornate, elegant, amazing, intricate, extremely detailed, smooth, beautiful composition, sharp focus, illustration, concept art, digital painting, greg rutkowski, yoshitaka amano, frank frazetta, boris vallejo, sorceress, magic, fantasy, demonic, radiating magical power in the style of Castlevania
Global seed set to 42
Loading model from models/ldm/stable-diffusion-v1/model.ckpt
Global Step: 470000
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
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
Some weights of the model checkpoint at openai/clip-vit-large-patch14 were not used when initializing CLIPTextModel: ['vision_model.encoder.layers.15.self_attn.k_proj.weight', 'vision_model.encoder.layers.11.mlp.fc2.bias',
 ...
'vision_model.encoder.layers.19.self_attn.v_proj.weight', 'vision_model.encoder.layers.19.mlp.fc1.weight']
- This IS expected if you are initializing CLIPTextModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
- This IS NOT expected if you are initializing CLIPTextModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
Sampling:   0%|                                                                                  | 0/1 [00:00<?, ?it/s]Data shape for PLMS sampling is (1, 4, 64, 64)                                                    | 0/1 [00:00<?, ?it/s]
Running PLMS Sampling with 167 timesteps
PLMS Sampler: 100%|██████████████████████████████████████████████████████████████████| 167/167 [02:18<00:00,  1.20it/s]
data: 100%|█████████████████████████████████████████████████████████████████████████████| 1/1 [02:22<00:00, 142.19s/it]
Sampling: 100%|█████████████████████████████████████████████████████████████████████████| 1/1 [02:22<00:00, 142.19s/it]
Passes:   0%|                                                                                    | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "scripts/txt2imghd.py", line 525, in <module>
    main()
  File "scripts/txt2imghd.py", line 346, in main
    text2img2(opt)
  File "scripts/txt2imghd.py", line 452, in text2img2
    realesrgan2x(opt.realesrgan, os.path.join(sample_path, f"{base_filename}.png"), os.path.join(sample_path, f"{base_filename}u.png"))
  File "scripts/txt2imghd.py", line 349, in realesrgan2x
    process = subprocess.Popen([
  File "C:\Users\xxx\.conda\envs\ldm\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\xxx\.conda\envs\ldm\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,

I assume that the filename is too long? I tried a couple of workarounds but I broke stuff elsewhere in the script.

Thanks!!

jquesnelle commented 2 years ago

I think this may just be that you don't have https://github.com/xinntao/Real-ESRGAN/releases downloaded and unzipped in C:\proj\waifu-diffusion (Step 3 in the readme)

trafgals commented 2 years ago

You're correct, and I feel very stupid. Thanks!