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

Can't load a fine-tuned model due to using an old version of diffusers #66

Open
efsansokmen opened this issue Aug 15, 2023 · 0 comments

Comments

@efsansokmen
Copy link

efsansokmen commented Aug 15, 2023

Hi,
I am launching your notebook prompt-to-prompt_stable.ipynb.
I would like to be able to load the weights of a fine-tuned diffusion model into the pipeline. A reproducible section of the code I try to execute is the following:

 device = "cuda:0"
# load model
model_path = "/local/path/to/checkpoint-100/"
pipe = StableDiffusionPipeline.from_pretrained(
    "runwayml/stable-diffusion-v1-5",
    torch_dtype=torch.float16,
    safety_checker=None,
    feature_extractor=None,
    requires_safety_checker=False
)

# load weights from fine-tuned model
pipe.unet.load_attn_procs(pretrained_model_name_or_path_or_dict=model_path, subfolder="checkpoint-100", weight_name="pytorch_model.bin")
pipe.to(device)

Here is the error:
AttributeError: 'UNet2DConditionModel' object has no attribute 'load_attn_procs'
which is triggered by the line:
pipe.unet.load_attn_procs(pretrained_model_name_or_path_or_dict=model_path, subfolder="checkpoint-100", weight_name="pytorch_model.bin")
FYI, the code works perfectly for diffusers version 0.19.0, however, fails for the version 0.8.0 which is used by your code.

Could you update your code so that it works for later versions, or guide me for a fix?
Thanks in advance~

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

No branches or pull requests

1 participant