Skip to content

Run SDXL txt2image with Lora ,but it returns AttributeError: 'LyraDiffUNet2DConditionModel' object has no attribute 'load_lora_by_name' #7

@lognat0704

Description

@lognat0704

Hi,

Tyring to load lora and run lyraDiff/examples/SDXL/txt2img_demo.py. Here is the error message:

The Lora weights: Eldritch Diorama for SDXL

Thanks for your help in advance!

root@d81f2d0d24eb:/workspace/lyraDiff/examples/SDXL# python txt2img_demo.py
[WARNING] gemm_config.in is not found; using default GEMM algo
[WARNING] gemm_config.in is not found; using default GEMM algo
/usr/local/lib/python3.10/dist-packages/lyradiff/lyradiff_model/lyradiff_vae_model.py:270: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
  state_dict = torch.load(checkpoint_file, map_location="cpu")
/usr/local/lib/python3.10/dist-packages/diffusers/loaders/lora_pipeline.py:2917: FutureWarning: `LoraLoaderMixin` is deprecated and will be removed in version 1.0.0. LoraLoaderMixin is deprecated and this will be removed in a future version. Please use `StableDiffusionLoraLoaderMixin`, instead.
  deprecate("LoraLoaderMixin", "1.0.0", deprecation_message)
Traceback (most recent call last):
  File "/workspace/lyraDiff/examples/SDXL/txt2img_demo.py", line 48, in <module>
    add_lora_to_opt_model(lora_state, unet, text_encoder, text_encoder_2, alpha=1.0)
  File "/usr/local/lib/python3.10/dist-packages/lyradiff/lyradiff_model/lora_util.py", line 337, in add_lora_to_opt_model
    unet.load_lora_by_name(layers, curr_layer_weight, alpha)
  File "/usr/local/lib/python3.10/dist-packages/lyradiff/lyradiff_model/lyradiff_unet_model.py", line 132, in __getattr__
    raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'LyraDiffUNet2DConditionModel' object has no attribute 'load_lora_by_name'

Metadata

Metadata

Assignees

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