Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AttributeError in OFT when trying to get MultiheadAttention weight #15260

Merged
merged 1 commit into from
Mar 16, 2024

Conversation

v0xie
Copy link
Contributor

@v0xie v0xie commented Mar 15, 2024

Description

We avoid an AttributeError by changing the condition from if self.rescale is not None: to if self.rescale is not None and not is_other_linear:.

Related: #15190

Screenshots/videos:

Traceback (most recent call last):
  File "F:\stablediffusion\stable-diffusion-webui\extensions-builtin\Lora\networks.py", line 280, in load_networks
    net = load_network(name, network_on_disk)
  File "F:\stablediffusion\stable-diffusion-webui\extensions-builtin\Lora\networks.py", line 219, in load_network
    net_module = nettype.create_module(net, weights)
  File "F:\stablediffusion\stable-diffusion-webui\extensions-builtin\Lora\network_oft.py", line 9, in create_module
    return NetworkModuleOFT(net, weights)
  File "F:\stablediffusion\stable-diffusion-webui\extensions-builtin\Lora\network_oft.py", line 44, in __init__
    self.rescale = self.rescale.reshape(-1, *[1]*(self.org_module[0].weight.dim() - 1))
  File "f:\stablediffusion\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: 'MultiheadAttention' object has no attribute 'weight'

Checklist:

@AUTOMATIC1111 AUTOMATIC1111 merged commit 3cb698a into AUTOMATIC1111:dev Mar 16, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants