RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 2 but got size 1 for tensor number 1 in the list.
Can anyone help with this error? I used the default setting, didn't change anything.
The issue might be as mentioned here: https://github.com/TencentARC/PhotoMaker/issues/182#issuecomment-2357733365
You could add the following line in the load_photomaker_adapter() in photomaker/pipeline.py:
self.num_tokens =2 if pm_version =='v2'else 1 ## this seems ignore the compatibility with v1
The issue might be as mentioned here: #182 (comment) You could add the following line in the
load_photomaker_adapter()in photomaker/pipeline.py:self.num_tokens =2 if pm_version =='v2'else 1 ## this seems ignore the compatibility with v1
Thanks but unfortunately I get the same error.
The issue might be as mentioned here: #182 (comment) You could add the following line in the
load_photomaker_adapter()in photomaker/pipeline.py:self.num_tokens =2 if pm_version =='v2'else 1 ## this seems ignore the compatibility with v1Thanks but unfortunately I get the same error.
You have to set the args to use v1:
pipe.load_photomaker_adapter(
os.path.dirname(photomaker_path),
subfolder="",
weight_name=os.path.basename(photomaker_path),
trigger_word="img", # define the trigger word
pm_version='v1',
)
The issue might be as mentioned here: #182 (comment) You could add the following line in the
load_photomaker_adapter()in photomaker/pipeline.py:self.num_tokens =2 if pm_version =='v2'else 1 ## this seems ignore the compatibility with v1Thanks but unfortunately I get the same error.
You have to set the args to use v1:
pipe.load_photomaker_adapter( os.path.dirname(photomaker_path), subfolder="", weight_name=os.path.basename(photomaker_path), trigger_word="img", # define the trigger word pm_version='v1', )
Thanks but keep getting the same error. I changed the args as you suggested.
Solution:
- Open files: "photomaker/pipeline.py", "photomaker/pipeline_controlnet.py", "photomaker/pipeline_t2i_adapter.py"
- Find and replace:
self.num_tokens = 2to:self.num_tokens = 2 if pm_version == 'v2' else 1
This worked for me.