Skip to content

I met a problem when I use torch=2.0.0, I can't use loftq config in loraConfig #1825

@LiManyuan663

Description

@LiManyuan663

when I use loftq config, I met the problem:

AttributeError Traceback (most recent call last)
Cell In[13], line 44
25 unet_loha_config = LoHaConfig(
26 r=args.rank,
27 alpha=args.rank,
(...)
32 # use_effective_conv2d=True,
33 )
35 unet_lokr_config = LoKrConfig(
36 r=args.rank,
37 alpha=args.rank,
(...)
42 # use_effective_conv2d=True,
43 )
---> 44 unet.add_adapter(unet_lora_config)
45 for p in unet.parameters():
46 print(p.shape,p.dtype)

File ~/miniconda3/envs/jit/lib/python3.9/site-packages/diffusers/loaders/peft.py:70, in PeftAdapterMixin.add_adapter(self, adapter_config, adapter_name)
67 # Unlike transformers, here we don't need to retrieve the name_or_path of the unet as the loading logic is
68 # handled by the load_lora_layers or LoraLoaderMixin. Therefore we set it to None here.
69 adapter_config.base_model_name_or_path = None
---> 70 inject_adapter_in_model(adapter_config, self, adapter_name)
71 self.set_adapter(adapter_name)
...
---> 88 values = values.sort().values
89 values /= values.max()
90 return values

AttributeError: 'tuple' object has no attribute 'values'

It seems that torch>=1.8 will meet this problem, writevalues,_ = values.sort().values can solve it, but I don't know how to fix my own code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions