ZHO-ZHO-ZHO / ComfyUI-PhotoMaker-ZHO

Unofficial implementation of PhotoMaker for ComfyUI
GNU General Public License v3.0
789 stars 41 forks source link

NEW_PhotoMaker_Generation: "Index out of range in self" error #34

Closed undavide closed 10 months ago

undavide commented 10 months ago

Running a pretty basic workflow:

image

I've learned that:

  1. I have to use img in the positive text prompt, otherwise it won't work
  2. it seems to work with XL checkpoints only

All seemed fine and dandy but while processing:

Error occurred when executing NEW_PhotoMaker_Generation:  index out of range in self 

  File "/Users/myUser/Documents/Development/STABLE DIFFUSION/ComfyUI/execution.py", line 155, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
  File "/Users/myUser/Documents/Development/STABLE DIFFUSION/ComfyUI/execution.py", line 85, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
  File "/Users/myUser/Documents/Development/STABLE DIFFUSION/ComfyUI/execution.py", line 78, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
  File "/Users/myUser/Documents/Development/STABLE DIFFUSION/ComfyUI/custom_nodes/ComfyUI-PhotoMaker/PhotoMakerNode.py", line 396, in generate_image
    output = pipe(
  File "/Users/myUser/.pyenv/versions/3.10.2/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/Users/myUser/Documents/Development/STABLE DIFFUSION/ComfyUI/custom_nodes/ComfyUI-PhotoMaker/pipeline.py", line 353, in __call__
    ) = self.encode_prompt(
  File "/Users/myUser/.pyenv/versions/3.10.2/lib/python3.10/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 415, in encode_prompt
    prompt_embeds = text_encoder(text_input_ids.to(device), output_hidden_states=True)
  File "/Users/myUser/.pyenv/versions/3.10.2/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/Users/myUser/.pyenv/versions/3.10.2/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
    return forward_call(*args, **kwargs)
  File "/Users/myUser/.pyenv/versions/3.10.2/lib/python3.10/site-packages/transformers/models/clip/modeling_clip.py", line 798, in forward
    return self.text_model(
  File "/Users/myUser/.pyenv/versions/3.10.2/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/Users/myUser/.pyenv/versions/3.10.2/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
    return forward_call(*args, **kwargs)
  File "/Users/myUser/.pyenv/versions/3.10.2/lib/python3.10/site-packages/transformers/models/clip/modeling_clip.py", line 691, in forward
    hidden_states = self.embeddings(input_ids=input_ids, position_ids=position_ids)
  File "/Users/myUser/.pyenv/versions/3.10.2/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/Users/myUser/.pyenv/versions/3.10.2/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
    return forward_call(*args, **kwargs)
  File "/Users/myUser/.pyenv/versions/3.10.2/lib/python3.10/site-packages/transformers/models/clip/modeling_clip.py", line 216, in forward
    inputs_embeds = self.token_embedding(input_ids)
  File "/Users/myUser/.pyenv/versions/3.10.2/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/Users/myUser/.pyenv/versions/3.10.2/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
    return forward_call(*args, **kwargs)
  File "/Users/myUser/.pyenv/versions/3.10.2/lib/python3.10/site-packages/torch/nn/modules/sparse.py", line 163, in forward
    return F.embedding(
  File "/Users/myUser/.pyenv/versions/3.10.2/lib/python3.10/site-packages/torch/nn/functional.py", line 2264, in embedding
    return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
IndexError: index out of range in self

Any idea what this is? M1 macOS, btw. Thanks!

undavide commented 10 months ago

The error has disappeared after the latest update (I get a different one now, though... 🙄)