beichenzbc / Long-CLIP

[ECCV 2024] official code for "Long-CLIP: Unlocking the Long-Text Capability of CLIP"
Apache License 2.0
625 stars 30 forks source link

error about python sdxl.py? #44

Open SnailForce opened 3 months ago

SnailForce commented 3 months ago
  1. "adjust_lora_scale_text_encoder" in encode_prompt.py is not defined()
  2. When I use "from diffusers.models.lora import adjust_lora_scale_text_encoder", a new error appears.

Traceback (most recent call last): File "/home/Code/Long-CLIP/SDXL/sdxl.py", line 41, in image = get_image( File "/home/miniconda3/envs/2024/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) File "/home/Long-CLIP/SDXL/SDXL_pipeline.py", line 152, in get_image ) = encode_prompt( File "/home/Long-CLIP/SDXL/encode_prompt.py", line 270, in encode_prompt unscale_lora_layers(pipe.text_encoder, lora_scale) File "/home/miniconda3/envs/2024/lib/python3.10/site-packages/diffusers/utils/peft_utils.py", line 131, in unscale_lora_layers for module in model.modules(): AttributeError: 'function' object has no attribute 'modules'

SnailForce commented 3 months ago

I saw you set "bigG_encoder = bigG_model.encode_text_full" "vitL_encoder = vitl_model.encode_text_full". I think the problem is here, how should I solve it

beichenzbc commented 2 months ago

Currently, our code only supports plug-and-play image generation in SDXL, you can run sdxl.py for generating images. You may comment these lines if you don't want lora fine-tuning.