Skip to content

The model weights were updated 17 hours ago and now loading them causes the error #14

Open

Description

@KyriaAnnwyn

Error message when loading new weights from lambdalabs/sd-image-variations-diffusers:

AttributeError: module transformers has no attribute CLIPImageProcessor

Activity

  1. KyriaAnnwyn commented on Nov 29, 2022

    @KyriaAnnwyn
    Author

    updated transformers to 4.25.0.dev0

    With this version I get the following error:
    TypeError: getattr(): attribute name must be string when loading

  2. generalsvr commented on Nov 30, 2022

    @generalsvr

    Same error:

    AttributeError: module transformers has no attribute CLIPImageProcessor

    Any solution?

  3. KyriaAnnwyn commented on Nov 30, 2022

    @KyriaAnnwyn
    Author

    @artyemk this one with CLIPImageProcessor is solved by installing 4.25.0.dev0 transformers version from transformers repo. In the nets configs they mention that they work with this version, but the next error with getattr() i haven't solved yet

  4. KyriaAnnwyn commented on Nov 30, 2022

    @KyriaAnnwyn
    Author

    Other solution is to checkout previous version of nets configs and weights

  5. generalsvr commented on Nov 30, 2022

    @generalsvr

    @KyriaAnnwyn I tried to solve this issue by running

    pip install --upgrade git+https://github.com/huggingface/transformers.git

    But now I get another error:

    AttributeError: 'CLIPVisionModelWithProjection' object has no attribute 'get_image_features'

  6. KyriaAnnwyn commented on Nov 30, 2022

    @KyriaAnnwyn
    Author

    @artyemk seems like the version of transformers you got is 4.24. Check this please

  7. mkabatek commented on Dec 1, 2022

    @mkabatek

    I'm getting the same error. Trying to install 4.25.0.dev0 but i'm not sure how. Any advice?

    (lambda-diffusers) PS C:\Users\Landon\stable_diffusion\lambda-diffusers> pip install -Iv transformers==4.25.0.dev0
    Using pip 22.3.1 from C:\Users\Landon\anaconda3\envs\lambda-diffusers\lib\site-packages\pip (python 3.7)
    ERROR: Could not find a version that satisfies the requirement transformers==4.25.0.dev0 (from versions: 0.1, 2.0.0, 2.1.0, 2.1.1, 2.2.0, 2.2.1, 2.2.2, 2.3.0, 2.4.0, 2.4.1, 2.5.0, 2.5.1, 2.6.0, 2.7.0, 2.8.0, 2.9.0, 2.9.1, 2.10.0, 2.11.0, 3.0.0, 3.0.1, 3.0.2, 3.1.0, 3.2.0, 3.3.0, 3.3.1, 3.4.0, 3.5.0, 3.5.1, 4.0.0rc1, 4.0.0, 4.0.1, 4.1.0, 4.1.1, 4.2.0, 4.2.1, 4.2.2, 4.3.0rc1, 4.3.0, 4.3.1, 4.3.2, 4.3.3, 4.4.0, 4.4.1, 4.4.2, 4.5.0, 4.5.1, 4.6.0, 4.6.1, 4.7.0, 4.8.0, 4.8.1, 4.8.2, 4.9.0, 4.9.1, 4.9.2, 4.10.0, 4.10.1, 4.10.2, 4.10.3, 4.11.0, 4.11.1, 4.11.2, 4.11.3, 4.12.0, 4.12.1, 4.12.2, 4.12.3, 4.12.4, 4.12.5, 4.13.0, 4.14.0, 4.14.1, 4.15.0, 4.16.0, 4.16.1, 4.16.2, 4.17.0, 4.18.0, 4.19.0, 4.19.1, 4.19.2, 4.19.3, 4.19.4, 4.20.0, 4.20.1, 4.21.0, 4.21.1, 4.21.2, 4.21.3, 4.22.0, 4.22.1, 4.22.2, 4.23.0, 4.23.1, 4.24.0)
    ERROR: No matching distribution found for transformers==4.25.0.dev0
    
  8. mkabatek commented on Dec 1, 2022

    @mkabatek

    @artyemk this one with CLIPImageProcessor is solved by installing 4.25.0.dev0 transformers version from transformers repo. In the nets configs they mention that they work with this version, but the next error with getattr() i haven't solved yet

    I was able to solve installing transformers with this command

    pip install --upgrade "git+https://github.com/huggingface/transformers.git@v4.25-release"
    

    However now I am also getting the error.

    Traceback (most recent call last):
      File ".\im2im.py", line 11, in <module>
        pipe = StableDiffusionImageEmbedPipeline.from_pretrained("lambdalabs/sd-image-variations-diffusers")
      File "C:\Users\Landon\anaconda3\envs\lambda-diffusers\lib\site-packages\diffusers\pipeline_utils.py", line 373, in from_pretrained
        load_method = getattr(class_obj, load_method_name)
    TypeError: getattr(): attribute name must be string
    
  9. hniksoleimani commented on Dec 3, 2022

    @hniksoleimani

    install the following version of transformers:

    pip install transformers==4.19.2
    

    run the following script:

    from pathlib import Path
    from lambda_diffusers import StableDiffusionImageEmbedPipeline
    from PIL import Image
    import torch
    device = "cuda" if torch.cuda.is_available() else "cpu"
    pipe = StableDiffusionImageEmbedPipeline.from_pretrained(
        "lambdalabs/sd-image-variations-diffusers",
        revision="273115e88df42350019ef4d628265b8c29ef4af5",
        )
    pipe = pipe.to(device)
    im = Image.open("your/input/image/here.jpg")
    num_samples = 4
    image = pipe(num_samples*[im], guidance_scale=3.0)
    image = image["sample"]
    base_path = Path("outputs/im2im")
    base_path.mkdir(exist_ok=True, parents=True)
    for idx, im in enumerate(image):
        im.save(base_path/f"{idx:06}.jpg")
    
  10. generalsvr commented on Dec 5, 2022

    @generalsvr

    I solved this issue by initializing pipe like this:

    pipe = StableDiffusionImageEmbedPipeline.from_pretrained(
     "lambdalabs/sd-image-variations-diffusers",
     revision="273115e88df42350019ef4d628265b8c29ef4af5",
     )
    
    
  11. KyriaAnnwyn commented on Dec 5, 2022

    @KyriaAnnwyn
    Author

    @artyemk @hniksoleimani this makes you use old version of weights, but more interesting to test the new ones!

  12. mkabatek commented on Dec 5, 2022

    @mkabatek

    @hniksoleimani @artyemk

    I solved this issue by initializing pipe like this:

    pipe = StableDiffusionImageEmbedPipeline.from_pretrained(
     "lambdalabs/sd-image-variations-diffusers",
     revision="273115e88df42350019ef4d628265b8c29ef4af5",
     )
    

    Thank you this works, however now i'm curious is there a way to run this with a lower memory GPU? for example I see people use .half(), or fp16 how would I do that using this script?

    Thanks again for your feedback. I am running on Nvidia 3070 with 8GB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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