graemeniedermayer / stable-diffusion-webui-normalmap-script

Normal Maps for Stable Diffusion WebUI
72 stars 1 forks source link

'Block' object has no attribute 'drop_path' #13

Closed madtisa closed 2 weeks ago

madtisa commented 2 weeks ago

Error:

venv "D:\Projects\mods\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: v1.10.1
Commit hash: 82a973c04367123ae98bd9abdf80d9eda9b910e2
Launching Web UI with arguments: --medvram-sdxl
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
CHv1.8.11: Get Custom Model Folder
ControlNet preprocessor location: D:\Projects\mods\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\downloads
2024-11-01 20:14:00,124 - ControlNet - INFO - ControlNet v1.1.455
WARNING:dinov2:xFormers not available
WARNING:dinov2:xFormers not available
Loading weights [e714ee20aa] from D:\Projects\mods\stable-diffusion-webui\models\Stable-diffusion\abyssorangemix2_Hard.safetensors
CHv1.8.11: Set Proxy:
2024-11-01 20:14:03,436 - ControlNet - INFO - ControlNet UI callback registered.
Creating model from config: D:\Projects\mods\stable-diffusion-webui\configs\v1-inference.yaml
WARNING:py.warnings:D:\Projects\mods\stable-diffusion-webui\venv\lib\site-packages\huggingface_hub\file_download.py:1150: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.
  warnings.warn(

Running on local URL:  http://127.0.0.1:7860
WARNING:py.warnings:D:\Projects\mods\stable-diffusion-webui\venv\lib\site-packages\huggingface_hub\file_download.py:1150: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.
  warnings.warn(

To create a public link, set `share=True` in `launch()`.
Startup time: 20.6s (prepare environment: 4.7s, import torch: 4.6s, import gradio: 1.3s, setup paths: 1.5s, initialize shared: 0.3s, other imports: 0.8s, load scripts: 5.3s, create ui: 1.3s, gradio launch: 0.7s).
Applying attention optimization: Doggettx... done.
Model loaded in 11.5s (load weights from disk: 1.4s, create model: 0.6s, apply weights to model: 9.2s, calculate empty prompt: 0.2s).
100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:08<00:00,  2.35it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 20/20 [00:07<00:00,  2.36it/s]
NormalMap v0.1.4
device: cuda
Loading depth model weights from  ./models/midas/dpt_beit_large_512.pt
Computing normalmap(s) ..
*** Error completing request
*** Arguments: ('task(z5wbgv48582zwq7)', <gradio.routes.Request object at 0x00000250D0FBE0E0>, '', '', [], 1, 1, 7, 512, 512, False, 0.7, 2, 'Latent', 0, 0, 0, 'Use same checkpoint', 'Use same sampler', 'Use same scheduler', '', '', [], 6, 20, 'DPM++ 2M', 'Automatic', False, '', 0.8, -1, False, -1, 0, 0, 0, ControlNetUnit(is_ui=True, input_mode=<InputMode.SIMPLE: 'simple'>, batch_images='', output_dir='', loopback=False, enabled=False, module='none', model='None', weight=1.0, image=None, resize_mode=<ResizeMode.INNER_FIT: 'Crop and Resize'>, low_vram=False, processor_res=-1, threshold_a=-1.0, threshold_b=-1.0, guidance_start=0.0, guidance_end=1.0, pixel_perfect=False, control_mode=<ControlMode.BALANCED: 'Balanced'>, inpaint_crop_input_image=False, hr_option=<HiResFixOption.BOTH: 'Both'>, save_detected_map=True, advanced_weighting=None, effective_region_mask=None, pulid_mode=<PuLIDMode.FIDELITY: 'Fidelity'>, union_control_type=<ControlNetUnionControlType.UNKNOWN: 'Unknown'>, ipadapter_input=None, mask=None, batch_mask_dir=None, animatediff_batch=False, batch_modifiers=[], batch_image_files=[], batch_keyframe_idx=None), ControlNetUnit(is_ui=True, input_mode=<InputMode.SIMPLE: 'simple'>, batch_images='', output_dir='', loopback=False, enabled=False, module='none', model='None', weight=1.0, image=None, resize_mode=<ResizeMode.INNER_FIT: 'Crop and Resize'>, low_vram=False, processor_res=-1, threshold_a=-1.0, threshold_b=-1.0, guidance_start=0.0, guidance_end=1.0, pixel_perfect=False, control_mode=<ControlMode.BALANCED: 'Balanced'>, inpaint_crop_input_image=False, hr_option=<HiResFixOption.BOTH: 'Both'>, save_detected_map=True, advanced_weighting=None, effective_region_mask=None, pulid_mode=<PuLIDMode.FIDELITY: 'Fidelity'>, union_control_type=<ControlNetUnionControlType.UNKNOWN: 'Unknown'>, ipadapter_input=None, mask=None, batch_mask_dir=None, animatediff_batch=False, batch_modifiers=[], batch_image_files=[], batch_keyframe_idx=None), ControlNetUnit(is_ui=True, input_mode=<InputMode.SIMPLE: 'simple'>, batch_images='', output_dir='', loopback=False, enabled=False, module='none', model='None', weight=1.0, image=None, resize_mode=<ResizeMode.INNER_FIT: 'Crop and Resize'>, low_vram=False, processor_res=-1, threshold_a=-1.0, threshold_b=-1.0, guidance_start=0.0, guidance_end=1.0, pixel_perfect=False, control_mode=<ControlMode.BALANCED: 'Balanced'>, inpaint_crop_input_image=False, hr_option=<HiResFixOption.BOTH: 'Both'>, save_detected_map=True, advanced_weighting=None, effective_region_mask=None, pulid_mode=<PuLIDMode.FIDELITY: 'Fidelity'>, union_control_type=<ControlNetUnionControlType.UNKNOWN: 'Unknown'>, ipadapter_input=None, mask=None, batch_mask_dir=None, animatediff_batch=False, batch_modifiers=[], batch_image_files=[], batch_keyframe_idx=None), False, 'None', 20, False, False, 'positive', 'comma', 0, False, False, 'start', '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, False, False, False, 0, False, None, None, False, None, None, False, None, None, False, 50, False, False, 0, 'Range', 1, 'GPU', True, False, False, False, False, 13, 448, False, 448, False, False, 3, False, 3, True, 3, False, 'Horizontal', False, False, 'u2net', False, True, True, False, 0, 2.5, 'polylines_sharp', ['left-right', 'red-cyan-anaglyph'], 1, 0, False, '∯boost∯clipdepth∯clipdepth_far∯clipdepth_mode∯clipdepth_near∯compute_device∯do_output_depth∯gen_normalmap∯gen_rembg∯gen_simple_mesh∯gen_stereo∯model_type∯net_height∯net_size_match∯net_width∯normalmap_invert∯normalmap_post_blur∯normalmap_post_blur_kernel∯normalmap_pre_blur∯normalmap_pre_blur_kernel∯normalmap_sobel∯normalmap_sobel_kernel∯output_depth_combine∯output_depth_combine_axis∯output_depth_invert∯pre_depth_background_removal∯rembg_model∯save_background_removal_masks∯save_outputs∯simple_mesh_occlude∯simple_mesh_spherical∯stereo_balance∯stereo_divergence∯stereo_fill_algo∯stereo_modes∯stereo_offset_exponent∯stereo_separation∯tiling_mode', 0, 1, 512, 512, True, False, False, True, True, False, 1, True, 3, False, 3, False, 3, 1) {}
    Traceback (most recent call last):
      File "D:\Projects\mods\stable-diffusion-webui\modules\call_queue.py", line 74, in f
        res = list(func(*args, **kwargs))
      File "D:\Projects\mods\stable-diffusion-webui\modules\call_queue.py", line 53, in f
        res = func(*args, **kwargs)
      File "D:\Projects\mods\stable-diffusion-webui\modules\call_queue.py", line 37, in f
        res = func(*args, **kwargs)
      File "D:\Projects\mods\stable-diffusion-webui\modules\txt2img.py", line 106, in txt2img
        processed = modules.scripts.scripts_txt2img.run(p, *p.script_args)
      File "D:\Projects\mods\stable-diffusion-webui\modules\scripts.py", line 780, in run
        processed = script.run(p, *script_args)
      File "D:\Projects\mods\stable-diffusion-webui\extensions\stable-diffusion-webui-normalmap-script\scripts\normalmap.py", line 278, in run
        prediction = estimatemidas(img, model, net_width, net_height, resize_mode, normalization)
      File "D:\Projects\mods\stable-diffusion-webui\extensions\stable-diffusion-webui-normalmap-script\scripts\normalmap.py", line 446, in estimatemidas
        prediction = model.forward(sample)
      File "D:\Projects\mods\stable-diffusion-webui\extensions/stable-diffusion-webui-normalmap-script/scripts\midas\dpt_depth.py", line 166, in forward
        return super().forward(x).squeeze(dim=1)
      File "D:\Projects\mods\stable-diffusion-webui\extensions/stable-diffusion-webui-normalmap-script/scripts\midas\dpt_depth.py", line 114, in forward
        layers = self.forward_transformer(self.pretrained, x)
      File "D:\Projects\mods\stable-diffusion-webui\extensions/stable-diffusion-webui-normalmap-script/scripts\midas\backbones\beit.py", line 15, in forward_beit
        return forward_adapted_unflatten(pretrained, x, "forward_features")
      File "D:\Projects\mods\stable-diffusion-webui\extensions/stable-diffusion-webui-normalmap-script/scripts\midas\backbones\utils.py", line 86, in forward_adapted_unflatten
        exec(f"glob = pretrained.model.{function_name}(x)")
      File "<string>", line 1, in <module>
      File "D:\Projects\mods\stable-diffusion-webui\extensions/stable-diffusion-webui-normalmap-script/scripts\midas\backbones\beit.py", line 125, in beit_forward_features
        x = blk(x, resolution, shared_rel_pos_bias=rel_pos_bias)
      File "D:\Projects\mods\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
      File "D:\Projects\mods\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
        return forward_call(*args, **kwargs)
      File "D:\Projects\mods\stable-diffusion-webui\extensions/stable-diffusion-webui-normalmap-script/scripts\midas\backbones\beit.py", line 102, in block_forward
        x = x + self.drop_path(self.gamma_1 * self.attn(self.norm1(x), resolution,
      File "D:\Projects\mods\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1695, in __getattr__
        raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
    AttributeError: 'Block' object has no attribute 'drop_path'

---

https://github.com/graemeniedermayer/stable-diffusion-webui-normalmap-script/blob/ee60fc2066b8c950cad8073aad1db1ce28806db1/scripts/midas/backbones/beit.py#L102

madtisa commented 2 weeks ago

Apparently, source repository https://github.com/thygate/stable-diffusion-webui-depthmap-script can create normal maps and it works as it described in readme