lllyasviel / lllyasviel/stable-diffusion-webui-forge

[Bug]: Photomaker not working

Open
#613 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
13k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

### Checklist

- [ ] The issue exists after disabling all extensions
- [x] The issue exists on a clean installation of webui
- [ ] The issue is caused by an extension, but I believe it is caused by a bug in the webui
- [x] The issue exists in the current version of the webui
- [ ] The issue has not been reported before recently
- [ ] The issue has been reported before but has not been fixed yet

### What happened?

Photomaker not working

### Steps to reproduce the problem

Just upload photo, enable ControlNet Photomaker and hit Generated, but ERROR

### What should have happened?

.

### What browsers do you use to access the UI ?

Mozilla Firefox

### Sysinfo

{
"Platform": "Windows-10-10.0.19045-SP0",
"Python": "3.10.6",
"Version": "f0.0.17v1.8.0rc-latest-276-g29be1da7",
"Commit": "29be1da7cf2b5dccfc70fbdd33eb35c56a31ffb7",
"Script path": "E:\\Ai\\Photomaker\\webui",
"Data path": "E:\\Ai\\Photomaker\\webui",
"Extensions dir": "E:\\Ai\\Photomaker\\webui\\extensions",
"Checksum": "5fbbb9c2db3783215b2230a34d6ff67439c652dbcf4edce26d3e29dfaf7ea638",
"Commandline": [
"launch.py"
],
"Torch env info": {
"torch_version": "2.1.2+cu121",
"is_debug_build": "False",
"cuda_compiled_version": "12.1",
"gcc_version": null,
"clang_version": null,
"cmake_version": null,
"os": "Microsoft Windows 10 Pro",
"libc_version": "N/A",
"python_version": "3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] (64-bit runtime)",
"python_platform": "Windows-10-10.0.19045-SP0",
"is_cuda_available": "True",
"cuda_runtime_version": "11.8.89\r",
"cuda_module_loading": "LAZY",
"nvidia_driver_version": "551.86",
"nvidia_gpu_models": "GPU 0: NVIDIA GeForce RTX 4080",
"cudnn_version": "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.8\\bin\\cudnn_ops_train64_8.dll",
"pip_version": "pip3",
"pip_packages": [
"numpy==1.26.2",
"open-clip-torch==2.20.0",
"pytorch-lightning==1.9.4",
"torch==2.1.2+cu121",
"torchdiffeq==0.2.3",
"torchmetrics==1.3.0.post0",
"torchsde==0.2.6",
"torchvision==0.16.2+cu121"
],
"conda_packages": null,
"hip_compiled_version": "N/A",
"hip_runtime_version": "N/A",
"miopen_runtime_version": "N/A",
"caching_allocator_config": "",
"is_xnnpack_available": "True",
"cpu_info": [
"Architecture=9",
"CurrentClockSpeed=3701",
"DeviceID=CPU0",
"Family=107",
"L2CacheSize=3072",
"L2CacheSpeed=",
"Manufacturer=AuthenticAMD",
"MaxClockSpeed=3701",
"Name=AMD Ryzen 5 5600X 6-Core Processor ",
"ProcessorType=3",
"Revision=8448"
]
},
"Exceptions": [
{
"exception": "Given normalized_shape=[4096], expected input with shape [*, 4096], but got input of size[1, 2816]",
"traceback": [
[
"E:\\Ai\\Photomaker\\webui\\modules\\scripts.py, line 835, process_before_every_sampling",
"script.process_before_every_sampling(p, *script_args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\utils\\_contextlib.py, line 115, decorate_context",
"return func(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\webui\\extensions-builtin\\sd_forge_controlnet\\scripts\\controlnet.py, line 555, process_before_every_sampling",
"self.process_unit_before_every_sampling(p, unit, self.current_params[i], *args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\utils\\_contextlib.py, line 115, decorate_context",
"return func(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\webui\\extensions-builtin\\sd_forge_controlnet\\scripts\\controlnet.py, line 501, process_unit_before_every_sampling",
"params.model.process_before_every_sampling(p, cond, mask, *args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\webui\\extensions-builtin\\sd_forge_photomaker\\scripts\\forge_photomaker.py, line 51, process_before_every_sampling",
"cond_modified = opPhotoMakerEncode(photomaker=self.model, image=cond.movedim(1, -1), clip=clip, text=text)[0]"
],
[
"E:\\Ai\\Photomaker\\webui\\ldm_patched\\contrib\\external_photomaker.py, line 177, apply_photomaker",
"out = photomaker(id_pixel_values=pixel_values.unsqueeze(0), prompt_embeds=cond.to(photomaker.load_device),"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\nn\\modules\\module.py, line 1518, _wrapped_call_impl",
"return self._call_impl(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\nn\\modules\\module.py, line 1527, _call_impl",
"return forward_call(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\webui\\ldm_patched\\contrib\\external_photomaker.py, line 115, forward",
"updated_prompt_embeds = self.fuse_module(prompt_embeds, id_embeds, class_tokens_mask)"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\nn\\modules\\module.py, line 1518, _wrapped_call_impl",
"return self._call_impl(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\nn\\modules\\module.py, line 1527, _call_impl",
"return forward_call(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\webui\\ldm_patched\\contrib\\external_photomaker.py, line 87, forward",
"stacked_id_embeds = self.fuse_fn(image_token_embeds, valid_id_embeds)"
],
[
"E:\\Ai\\Photomaker\\webui\\ldm_patched\\contrib\\external_photomaker.py, line 54, fuse_fn",
"stacked_id_embeds = self.mlp1(stacked_id_embeds) + prompt_embeds"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\nn\\modules\\module.py, line 1518, _wrapped_call_impl",
"return self._call_impl(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\nn\\modules\\module.py, line 1527, _call_impl",
"return forward_call(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\webui\\ldm_patched\\contrib\\external_photomaker.py, line 36, forward",
"x = self.layernorm(x)"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\nn\\modules\\module.py, line 1518, _wrapped_call_impl",
"return self._call_impl(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\nn\\modules\\module.py, line 1527, _call_impl",
"return forward_call(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\webui\\ldm_patched\\modules\\ops.py, line 161, forward",
"return self.forward_ldm_patched_cast_weights(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\webui\\ldm_patched\\modules\\ops.py, line 157, forward_ldm_patched_cast_weights",
"return torch.nn.functional.layer_norm(input, self.normalized_shape, weight, bias, self.eps)"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\nn\\functional.py, line 2543, layer_norm",
"return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled)"
]
]
},
{
"exception": "Given normalized_shape=[4096], expected input with shape [*, 4096], but got input of size[1, 2816]",
"traceback": [
[
"E:\\Ai\\Photomaker\\webui\\modules\\scripts.py, line 835, process_before_every_sampling",
"script.process_before_every_sampling(p, *script_args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\utils\\_contextlib.py, line 115, decorate_context",
"return func(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\webui\\extensions-builtin\\sd_forge_controlnet\\scripts\\controlnet.py, line 555, process_before_every_sampling",
"self.process_unit_before_every_sampling(p, unit, self.current_params[i], *args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\utils\\_contextlib.py, line 115, decorate_context",
"return func(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\webui\\extensions-builtin\\sd_forge_controlnet\\scripts\\controlnet.py, line 501, process_unit_before_every_sampling",
"params.model.process_before_every_sampling(p, cond, mask, *args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\webui\\extensions-builtin\\sd_forge_photomaker\\scripts\\forge_photomaker.py, line 51, process_before_every_sampling",
"cond_modified = opPhotoMakerEncode(photomaker=self.model, image=cond.movedim(1, -1), clip=clip, text=text)[0]"
],
[
"E:\\Ai\\Photomaker\\webui\\ldm_patched\\contrib\\external_photomaker.py, line 177, apply_photomaker",
"out = photomaker(id_pixel_values=pixel_values.unsqueeze(0), prompt_embeds=cond.to(photomaker.load_device),"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\nn\\modules\\module.py, line 1518, _wrapped_call_impl",
"return self._call_impl(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\nn\\modules\\module.py, line 1527, _call_impl",
"return forward_call(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\webui\\ldm_patched\\contrib\\external_photomaker.py, line 115, forward",
"updated_prompt_embeds = self.fuse_module(prompt_embeds, id_embeds, class_tokens_mask)"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\nn\\modules\\module.py, line 1518, _wrapped_call_impl",
"return self._call_impl(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\nn\\modules\\module.py, line 1527, _call_impl",
"return forward_call(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\webui\\ldm_patched\\contrib\\external_photomaker.py, line 87, forward",
"stacked_id_embeds = self.fuse_fn(image_token_embeds, valid_id_embeds)"
],
[
"E:\\Ai\\Photomaker\\webui\\ldm_patched\\contrib\\external_photomaker.py, line 54, fuse_fn",
"stacked_id_embeds = self.mlp1(stacked_id_embeds) + prompt_embeds"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\nn\\modules\\module.py, line 1518, _wrapped_call_impl",
"return self._call_impl(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\nn\\modules\\module.py, line 1527, _call_impl",
"return forward_call(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\webui\\ldm_patched\\contrib\\external_photomaker.py, line 36, forward",
"x = self.layernorm(x)"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\nn\\modules\\module.py, line 1518, _wrapped_call_impl",
"return self._call_impl(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\nn\\modules\\module.py, line 1527, _call_impl",
"return forward_call(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\webui\\ldm_patched\\modules\\ops.py, line 161, forward",
"return self.forward_ldm_patched_cast_weights(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\webui\\ldm_patched\\modules\\ops.py, line 157, forward_ldm_patched_cast_weights",
"return torch.nn.functional.layer_norm(input, self.normalized_shape, weight, bias, self.eps)"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\nn\\functional.py, line 2543, layer_norm",
"return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled)"
]
]
},
{
"exception": "0",
"traceback": [
[
"E:\\Ai\\Photomaker\\webui\\modules\\scripts.py, line 859, postprocess_batch_list",
"script.postprocess_batch_list(p, pp, *script_args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\utils\\_contextlib.py, line 115, decorate_context",
"return func(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\webui\\extensions-builtin\\sd_forge_controlnet\\scripts\\controlnet.py, line 561, postprocess_batch_list",
"self.process_unit_after_every_sampling(p, unit, self.current_params[i], pp, *args, **kwargs)"
]
]
},
{
"exception": "0",
"traceback": [
[
"E:\\Ai\\Photomaker\\webui\\modules\\scripts.py, line 835, process_before_every_sampling",
"script.process_before_every_sampling(p, *script_args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\utils\\_contextlib.py, line 115, decorate_context",
"return func(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\webui\\extensions-builtin\\sd_forge_controlnet\\scripts\\controlnet.py, line 555, process_before_every_sampling",
"self.process_unit_before_every_sampling(p, unit, self.current_params[i], *args, **kwargs)"
]
]
},
{
"exception": "'StableDiffusionProcessingTxt2Img' object has no attribute 'resize_mode'",
"traceback": [
[
"E:\\Ai\\Photomaker\\webui\\modules\\scripts.py, line 803, process",
"script.process(p, *script_args)"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\utils\\_contextlib.py, line 115, decorate_context",
"return func(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\webui\\extensions-builtin\\sd_forge_controlnet\\scripts\\controlnet.py, line 548, process",
"self.process_unit_after_click_generate(p, unit, params, *args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\system\\python\\lib\\site-packages\\torch\\utils\\_contextlib.py, line 115, decorate_context",
"return func(*args, **kwargs)"
],
[
"E:\\Ai\\Photomaker\\webui\\extensions-builtin\\sd_forge_controlnet\\scripts\\controlnet.py, line 298, process_unit_after_click_generate",
"input_list, resize_mode = self.get_input_data(p, unit, preprocessor, h, w)"
],
[
"E:\\Ai\\Photomaker\\webui\\extensions-builtin\\sd_forge_controlnet\\scripts\\controlnet.py, line 203, get_input_data",
"resize_mode = external_code.resize_mode_from_value(p.resize_mode)"
]
]
}
],
"CPU": {
"model": "AMD64 Family 25 Model 33 Stepping 0, AuthenticAMD",
"count logical": 12,
"count physical": 6
},
"RAM": {
"total": "32GB",
"used": "19GB",
"free": "13GB"
},
"Extensions": [],
"Inactive extensions": [],
"Environment": {
"GRADIO_ANALYTICS_ENABLED": "False"
},
"Config": {
"ldsr_steps": 100,
"ldsr_cached": false,
"SCUNET_tile": 256,
"SCUNET_tile_overlap": 8,
"SWIN_tile": 192,
"SWIN_tile_overlap": 8,
"SWIN_torch_compile": false,
"control_net_detectedmap_dir": "detected_maps",
"control_net_models_path": "",
"control_net_modules_path": "",
"control_net_unit_count": 3,
"control_net_model_cache_size": 5,
"control_net_no_detectmap": false,
"control_net_detectmap_autosaving": false,
"control_net_allow_script_control": false,
"control_net_sync_field_args": true,
"controlnet_show_batch_images_in_ui": false,
"controlnet_increment_seed_during_batch": false,
"controlnet_disable_openpose_edit": false,
"controlnet_disable_photopea_edit": false,
"controlnet_photopea_warning": true,
"controlnet_input_thumbnail": true,
"sd_checkpoint_hash": "15012c538f503ce2ebfc2c8547b268c75ccdaff7a281db55399940ff1d70e21d"
},
"Startup": {
"total": 167.6620388031006,
"records": {
"initial startup": 0.049044132232666016,
"prepare environment/checks": 0.010009527206420898,
"prepare environment/git version info": 0.40917515754699707,
"prepare environment/torch GPU test": 5.468695878982544,
"prepare environment/clone repositores": 140.86107087135315,
"prepare environment/run extensions installers": 0.002002239227294922,
"prepare environment/run extensions_builtin installers/canvas-zoom-and-pan": 0.0,
"prepare environment/run extensions_builtin installers/extra-options-section": 0.0,
"prepare environment/run extensions_builtin installers/forge_legacy_preprocessors": 0.41198039054870605,
"prepare environment/run extensions_builtin installers/forge_preprocessor_inpaint": 0.0010008811950683594,
"prepare environment/run extensions_builtin installers/forge_preprocessor_marigold": 0.0,
"prepare environment/run extensions_builtin installers/forge_preprocessor_normalbae": 0.0,
"prepare environment/run extensions_builtin installers/forge_preprocessor_recolor": 0.0,
"prepare environment/run extensions_builtin installers/forge_preprocessor_reference": 0.0,
"prepare environment/run extensions_builtin installers/forge_preprocessor_revision": 0.0,
"prepare environment/run extensions_builtin installers/forge_preprocessor_tile": 0.0,
"prepare environment/run extensions_builtin installers/LDSR": 0.0,
"prepare environment/run extensions_builtin installers/Lora": 0.0,
"prepare environment/run extensions_builtin installers/mobile": 0.0,
"prepare environment/run extensions_builtin installers/prompt-bracket-checker": 0.0,
"prepare environment/run extensions_builtin installers/ScuNET": 0.0,
"prepare environment/run extensions_builtin installers/sd_forge_controlllite": 0.0,
"prepare environment/run extensions_builtin installers/sd_forge_controlnet": 0.34522533416748047,
"prepare environment/run extensions_builtin installers/sd_forge_controlnet_example": 0.0010006427764892578,
"prepare environment/run extensions_builtin installers/sd_forge_dynamic_thresholding": 0.0,
"prepare environment/run extensions_builtin installers/sd_forge_fooocus_inpaint": 0.0,
"prepare environment/run extensions_builtin installers/sd_forge_freeu": 0.0,
"prepare environment/run extensions_builtin installers/sd_forge_hypertile": 0.0,
"prepare environment/run extensions_builtin installers/sd_forge_ipadapter": 0.0,
"prepare environment/run extensions_builtin installers/sd_forge_kohya_hrfix": 0.0,
"prepare environment/run extensions_builtin installers/sd_forge_latent_modifier": 0.0,
"prepare environment/run extensions_builtin installers/sd_forge_multidiffusion": 0.0,
"prepare environment/run extensions_builtin installers/sd_forge_neveroom": 0.0,
"prepare environment/run extensions_builtin installers/sd_forge_photomaker": 0.0,
"prepare environment/run extensions_builtin installers/sd_forge_sag": 0.0009996891021728516,
"prepare environment/run extensions_builtin installers/sd_forge_stylealign": 0.0,
"prepare environment/run extensions_builtin installers/sd_forge_svd": 0.0,
"prepare environment/run extensions_builtin installers/sd_forge_z123": 0.0,
"prepare environment/run extensions_builtin installers/soft-inpainting": 0.0,
"prepare environment/run extensions_builtin installers/SwinIR": 0.0,
"prepare environment/run extensions_builtin installers": 0.760206937789917,
"prepare environment": 147.55419921875,
"launcher": 0.017015457153320312,
"import torch": 7.134855508804321,
"import gradio": 2.782921552658081,
"setup paths": 2.7951138019561768,
"import ldm": 0.042037248611450195,
"import sgm": 0.0,
"initialize shared": 0.3513195514678955,
"other imports": 2.5352742671966553,
"opts onchange": 0.0,
"setup SD model": 0.0,
"setup codeformer": 0.007006645202636719,
"setup gfpgan": 0.04303884506225586,
"set samplers": 0.0,
"list extensions": 0.006006002426147461,
"restore config state file": 0.0,
"list SD models": 0.003002166748046875,
"list localizations": 0.0010008811950683594,
"load scripts/custom_code.py": 0.014012813568115234,
"load scripts/img2imgalt.py": 0.0050051212310791016,
"load scripts/loopback.py": 0.0030024051666259766,
"load scripts/outpainting_mk_2.py": 0.0050046443939208984,
"load scripts/poor_mans_outpainting.py": 0.0030019283294677734,
"load scripts/postprocessing_caption.py": 0.002002239227294922,
"load scripts/postprocessing_codeformer.py": 0.0020020008087158203,
"load scripts/postprocessing_create_flipped_copies.py": 0.0030028820037841797,
"load scripts/postprocessing_focal_crop.py": 0.013011455535888672,
"load scripts/postprocessing_gfpgan.py": 0.0020017623901367188,
"load scripts/postprocessing_split_oversized.py": 0.0020029544830322266,
"load scripts/postprocessing_upscale.py": 0.004004001617431641,
"load scripts/processing_autosized_crop.py": 0.002000570297241211,
"load scripts/prompt_matrix.py": 0.003002643585205078,
"load scripts/prompts_from_file.py": 0.004004001617431641,
"load scripts/sd_upscale.py": 0.0020020008087158203,
"load scripts/xyz_grid.py": 0.015012502670288086,
"load scripts/ldsr_model.py": 1.010016679763794,
"load scripts/lora_script.py": 0.3303098678588867,
"load scripts/scunet_model.py": 0.0591893196105957,
"load scripts/swinir_model.py": 0.057051897048950195,
"load scripts/hotkey_config.py": 0.003003358840942383,
"load scripts/extra_options_section.py": 0.0030024051666259766,
"load scripts/legacy_preprocessors.py": 0.0370335578918457,
"load scripts/preprocessor_inpaint.py": 0.06105494499206543,
"load scripts/preprocessor_marigold.py": 0.2487049102783203,
"load scripts/preprocessor_normalbae.py": 0.024021625518798828,
"load scripts/preprocessor_recolor.py": 0.002002239227294922,
"load scripts/forge_reference.py": 0.004004716873168945,
"load scripts/preprocessor_revision.py": 0.0030019283294677734,
"load scripts/preprocessor_tile.py": 0.002002239227294922,
"load scripts/forge_controllllite.py": 0.03302931785583496,
"load scripts/controlnet.py": 0.8098330497741699,
"load scripts/xyz_grid_support.py": 0.005005598068237305,
"load scripts/sd_forge_controlnet_example.py": 0.003002166748046875,
"load scripts/forge_dynamic_thresholding.py": 0.012010574340820312,
"load scripts/forge_fooocus_inpaint.py": 0.003002643585205078,
"load scripts/forge_freeu.py": 0.011709451675415039,
"load scripts/forge_hypertile.py": 0.01201009750366211,
"load scripts/forge_ipadapter.py": 0.02602410316467285,
"load scripts/kohya_hrfix.py": 0.007005214691162109,
"load scripts/forge_latent_modifier.py": 0.017015933990478516,
"load scripts/forge_multidiffusion.py": 0.04404115676879883,
"load scripts/forge_never_oom.py": 0.002001523971557617,
"load scripts/forge_photomaker.py": 0.009008407592773438,
"load scripts/forge_sag.py": 0.008006811141967773,
"load scripts/forge_stylealign.py": 0.0020008087158203125,
"load scripts/forge_svd.py": 0.07251787185668945,
"load scripts/forge_z123.py": 0.06806159019470215,
"load scripts/soft_inpainting.py": 0.006005287170410156,
"load scripts/comments.py": 0.061055898666381836,
"load scripts/refiner.py": 0.003002643585205078,
"load scripts/seed.py": 0.0030031204223632812,
"load scripts": 3.1468288898468018,
"load upscalers": 0.01100921630859375,
"refresh VAE": 0.0010008811950683594,
"refresh textual inversion templates": 0.0,
"scripts list_optimizers": 0.05405020713806152,
"scripts list_unets": 0.0,
"reload hypernetworks": 0.0,
"initialize extra networks": 0.014013051986694336,
"scripts before_ui_callback": 0.0010004043579101562,
"create ui": 0.7331414222717285,
"gradio launch": 0.4121890068054199,
"add APIs": 0.010009765625,
"app_started_callback/lora_script.py": 0.0,
"app_started_callback/controlnet.py": 0.0010004043579101562,
"app_started_callback": 0.0010004043579101562
}
},
"Packages": [
"absl-py==2.1.0",
"accelerate==0.21.0",
"addict==2.4.0",
"aenum==3.1.15",
"aiofiles==23.2.1",
"aiohttp==3.9.3",
"aiosignal==1.3.1",
"albumentations==1.3.1",
"altair==5.2.0",
"antlr4-python3-runtime==4.9.3",
"anyio==3.7.1",
"async-timeout==4.0.3",
"attrs==23.2.0",
"basicsr==1.4.2",
"blendmodes==2022",
"build==1.0.3",
"certifi==2024.2.2",
"cffi==1.16.0",
"chardet==5.2.0",
"charset-normalizer==3.3.2",
"clean-fid==0.1.35",
"click==8.1.7",
"clip==1.0",
"colorama==0.4.6",
"coloredlogs==15.0.1",
"colorlog==6.8.2",
"contourpy==1.2.0",
"cssselect2==0.7.0",
"cycler==0.12.1",
"cython==3.0.8",
"deprecation==2.1.0",
"depth-anything==2024.1.22.0",
"diffusers==0.25.0",
"easydict==1.11",
"einops==0.4.1",
"embreex==2.17.7.post4",
"exceptiongroup==1.2.0",
"facexlib==0.3.0",
"fastapi==0.94.0",
"fastcluster==1.2.6",
"ffmpy==0.3.1",
"filelock==3.13.1",
"filterpy==1.4.5",
"flatbuffers==24.3.25",
"fonttools==4.47.2",
"frozenlist==1.4.1",
"fsspec==2024.2.0",
"ftfy==6.1.3",
"future==0.18.3",
"fvcore==0.1.5.post20221221",
"gitdb==4.0.11",
"gitpython==3.1.32",
"gradio-client==0.5.0",
"gradio==3.41.2",
"grpcio==1.60.1",
"h11==0.12.0",
"handrefinerportable==2024.2.12.0",
"httpcore==0.15.0",
"httpx==0.24.1",
"huggingface-hub==0.20.3",
"humanfriendly==10.0",
"idna==3.6",
"imageio==2.33.1",
"importlib-metadata==7.0.1",
"importlib-resources==6.4.0",
"inflection==0.5.1",
"insightface==0.7.3",
"iopath==0.1.9",
"jax==0.4.25",
"jinja2==3.1.3",
"joblib==1.3.2",
"jsonmerge==1.8.0",
"jsonschema-specifications==2023.12.1",
"jsonschema==4.21.1",
"keras-preprocessing==1.1.2",
"kiwisolver==1.4.5",
"kornia==0.6.7",
"lark==1.1.2",
"lazy-loader==0.3",
"lightning-utilities==0.10.1",
"llvmlite==0.42.0",
"lmdb==1.4.1",
"lxml==5.1.0",
"mapbox-earcut==1.0.1",
"markdown==3.5.2",
"markupsafe==2.1.5",
"matplotlib==3.8.2",
"mediapipe==0.10.11",
"ml-dtypes==0.3.2",
"mpmath==1.3.0",
"multidict==6.0.5",
"networkx==3.2.1",
"numba==0.59.0",
"numpy==1.26.2",
"nvidia-ml-py==12.535.108",
"omegaconf==2.2.3",
"onnx==1.15.0",
"onnxruntime==1.17.0",
"open-clip-torch==2.20.0",
"opencv-contrib-python==4.9.0.80",
"opencv-python-headless==4.9.0.80",
"opencv-python==4.9.0.80",
"opt-einsum==3.3.0",
"orjson==3.9.13",
"packaging==23.2",
"pandas==2.2.0",
"photomaker==1.0.1",
"piexif==1.1.3",
"pillow==9.5.0",
"pip==24.0",
"platformdirs==4.2.0",
"portalocker==2.8.2",
"prettytable==3.9.0",
"protobuf==3.20.0",
"psutil==5.9.5",
"pycollada==0.8",
"pycparser==2.21",
"pydantic==1.10.14",
"pydub==0.25.1",
"pyparsing==3.1.1",
"pyproject-hooks==1.0.0",
"pyreadline3==3.4.1",
"python-dateutil==2.8.2",
"python-multipart==0.0.7",
"pytorch-lightning==1.9.4",
"pytz==2024.1",
"pywavelets==1.5.0",
"pywin32==306",
"pyyaml==6.0.1",
"qudida==0.0.4",
"referencing==0.33.0",
"regex==2023.12.25",
"reportlab==4.1.0",
"requests==2.31.0",
"resize-right==0.0.2",
"rpds-py==0.17.1",
"rtree==1.2.0",
"safetensors==0.4.2",
"scikit-image==0.21.0",
"scikit-learn==1.4.0",
"scipy==1.12.0",
"semantic-version==2.10.0",
"sentencepiece==0.2.0",
"setuptools==69.0.3",
"shapely==2.0.2",
"six==1.16.0",
"smmap==5.0.1",
"sniffio==1.3.0",
"sounddevice==0.4.6",
"spandrel==0.1.6",
"starlette==0.26.1",
"svg.path==6.3",
"svglib==1.5.1",
"sympy==1.12",
"tabulate==0.9.0",
"tb-nightly==2.16.0a20240204",
"tensorboard-data-server==0.7.2",
"tensorboard-plugin-wit==1.8.1",
"termcolor==2.4.0",
"tf-keras-nightly==2.16.0.dev2024020410",
"threadpoolctl==3.2.0",
"tifffile==2024.1.30",
"timm==0.9.16",
"tinycss2==1.2.1",
"tokenizers==0.13.3",
"tomesd==0.1.3",
"tomli==2.0.1",
"toolz==0.12.1",
"torch==2.1.2+cu121",
"torchdiffeq==0.2.3",
"torchmetrics==1.3.0.post0",
"torchsde==0.2.6",
"torchvision==0.16.2+cu121",
"tqdm==4.66.2",
"trampoline==0.1.2",
"transformers==4.30.2",
"trimesh==4.1.3",
"typing-extensions==4.9.0",
"tzdata==2023.4",
"urllib3==2.2.0",
"uvicorn==0.27.0.post1",
"vhacdx==0.0.5",
"wcwidth==0.2.13",
"webencodings==0.5.1",
"websockets==11.0.3",
"werkzeug==3.0.1",
"wheel==0.42.0",
"xxhash==3.4.1",
"yacs==0.1.8",
"yapf==0.40.2",
"yarl==1.9.4",
"zipp==3.17.0"
]
}

### Console logs

```Shell
2024-03-28 15:26:07,817 - ControlNet - INFO - Current ControlNet PhotomakerPatcher: E:\Ai\Photomaker\webui\models\ControlNet\photomaker-v1.bin
*** Error running process_before_every_sampling: E:\Ai\Photomaker\webui\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py
Traceback (most recent call last):
File "E:\Ai\Photomaker\webui\modules\scripts.py", line 835, in process_before_every_sampling
script.process_before_every_sampling(p, *script_args, **kwargs)
File "E:\Ai\Photomaker\system\python\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "E:\Ai\Photomaker\webui\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py", line 555, in process_before_every_sampling
self.process_unit_before_every_sampling(p, unit, self.current_params[i], *args, **kwargs)
File "E:\Ai\Photomaker\system\python\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "E:\Ai\Photomaker\webui\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py", line 501, in process_unit_before_every_sampling
params.model.process_before_every_sampling(p, cond, mask, *args, **kwargs)
File "E:\Ai\Photomaker\webui\extensions-builtin\sd_forge_photomaker\scripts\forge_photomaker.py", line 51, in process_before_every_sampling
cond_modified = opPhotoMakerEncode(photomaker=self.model, image=cond.movedim(1, -1), clip=clip, text=text)[0]
File "E:\Ai\Photomaker\webui\ldm_patched\contrib\external_photomaker.py", line 177, in apply_photomaker
out = photomaker(id_pixel_values=pixel_values.unsqueeze(0), prompt_embeds=cond.to(photomaker.load_device),
File "E:\Ai\Photomaker\system\python\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "E:\Ai\Photomaker\system\python\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "E:\Ai\Photomaker\webui\ldm_patched\contrib\external_photomaker.py", line 115, in forward
updated_prompt_embeds = self.fuse_module(prompt_embeds, id_embeds, class_tokens_mask)
File "E:\Ai\Photomaker\system\python\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "E:\Ai\Photomaker\system\python\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "E:\Ai\Photomaker\webui\ldm_patched\contrib\external_photomaker.py", line 87, in forward
stacked_id_embeds = self.fuse_fn(image_token_embeds, valid_id_embeds)
File "E:\Ai\Photomaker\webui\ldm_patched\contrib\external_photomaker.py", line 54, in fuse_fn
stacked_id_embeds = self.mlp1(stacked_id_embeds) + prompt_embeds
File "E:\Ai\Photomaker\system\python\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "E:\Ai\Photomaker\system\python\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "E:\Ai\Photomaker\webui\ldm_patched\contrib\external_photomaker.py", line 36, in forward
x = self.layernorm(x)
File "E:\Ai\Photomaker\system\python\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "E:\Ai\Photomaker\system\python\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "E:\Ai\Photomaker\webui\ldm_patched\modules\ops.py", line 161, in forward
return self.forward_ldm_patched_cast_weights(*args, **kwargs)
File "E:\Ai\Photomaker\webui\ldm_patched\modules\ops.py", line 157, in forward_ldm_patched_cast_weights
return torch.nn.functional.layer_norm(input, self.normalized_shape, weight, bias, self.eps)
File "E:\Ai\Photomaker\system\python\lib\site-packages\torch\nn\functional.py", line 2543, in layer_norm
return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled)
RuntimeError: Given normalized_shape=[4096], expected input with shape [*, 4096], but got input of size[1, 2816]

---
```

### Additional information

_No response_

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the traceback in ldm_patched/contrib/external_photomaker.py, especially lines 36, 54, 87, 115, and 177, then inspect the Photomaker path from extensions-builtin/sd_forge_photomaker/scripts/forge_photomaker.py. Reproduce the failure by uploading a photo, enabling ControlNet Photomaker, and generating with the reported environment. Done means generation completes without the normalized_shape=[4096] versus input size [1, 2816] error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.