ljleb / prompt-fusion-extension

auto1111 webui extension for all sorts of prompt interpolations!
MIT License
268 stars 16 forks source link

Hires fix - TypeError: 'NoneType' object is not iterable #70

Closed pmcculler closed 1 year ago

pmcculler commented 1 year ago

I don't know what's causing it other than my usual crazy prompts with nested interpolations and such. I haven't aimed at the hires fix phase by pointing to anything over 0.9 either I don't think.

Traceback (most recent call last):
  File "D:\Users\pmccu\stable-diffusion-webui\modules\call_queue.py", line 57, in f
    res = list(func(*args, **kwargs))
  File "D:\Users\pmccu\stable-diffusion-webui\modules\call_queue.py", line 36, in f
    res = func(*args, **kwargs)
  File "D:\Users\pmccu\stable-diffusion-webui\modules\txt2img.py", line 55, in txt2img
    processed = processing.process_images(p)
  File "D:\Users\pmccu\stable-diffusion-webui\modules\processing.py", line 732, in process_images
    res = process_images_inner(p)
  File "D:\Users\pmccu\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 42, in processing_process_images_hijack
    return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
  File "D:\Users\pmccu\stable-diffusion-webui\modules\processing.py", line 867, in process_images_inner
    samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts)
  File "D:\Users\pmccu\stable-diffusion-webui\modules\processing.py", line 1156, in sample
    return self.sample_hr_pass(samples, decoded_samples, seeds, subseeds, subseed_strength, prompts)
  File "D:\Users\pmccu\stable-diffusion-webui\modules\processing.py", line 1235, in sample_hr_pass
    self.calculate_hr_conds()
  File "D:\Users\pmccu\stable-diffusion-webui\modules\processing.py", line 1299, in calculate_hr_conds
    self.hr_uc = self.get_conds_with_caching(prompt_parser.get_learned_conditioning, hr_negative_prompts, self.firstpass_steps, [self.cached_hr_uc, self.cached_uc], self.hr_extra_network_data, total_steps)
  File "D:\Users\pmccu\stable-diffusion-webui\modules\processing.py", line 455, in get_conds_with_caching
    cache[1] = function(shared.sd_model, required_prompts, steps, hires_steps, shared.opts.use_old_scheduling)
  File "D:\Users\pmccu\stable-diffusion-webui\extensions\sd-prompt-fusion-extension\lib_prompt_fusion\hijacker.py", line 12, in wrapper
    return function(*args, **kwargs, original_function=self.__original_functions[attribute])
  File "D:\Users\pmccu\stable-diffusion-webui\extensions\sd-prompt-fusion-extension\scripts\promptlang.py", line 69, in _hijacked_get_learned_conditioning
    schedules = [_sample_tensor_schedules(cond_tensor, real_total_steps, is_hires=hires_steps is not None)
  File "D:\Users\pmccu\stable-diffusion-webui\extensions\sd-prompt-fusion-extension\scripts\promptlang.py", line 69, in <listcomp>
    schedules = [_sample_tensor_schedules(cond_tensor, real_total_steps, is_hires=hires_steps is not None)
  File "D:\Users\pmccu\stable-diffusion-webui\extensions\sd-prompt-fusion-extension\scripts\promptlang.py", line 124, in _sample_tensor_schedules
    origin_cond = global_state.get_origin_cond_at(step, is_hires)
  File "D:\Users\pmccu\stable-diffusion-webui\extensions\sd-prompt-fusion-extension\lib_prompt_fusion\global_state.py", line 15, in get_origin_cond_at
    for schedule in (negative_schedules_hires if is_hires else negative_schedules):
TypeError: 'NoneType' object is not iterable
ljleb commented 1 year ago

If you run the generation twice, it should not error out the second time I think. I did not implement the if correctly for the origin conds, will fix in a sec.