huggingface / diffusers

🤗 Diffusers: State-of-the-art diffusion models for image and audio generation in PyTorch and FLAX.
https://huggingface.co/docs/diffusers
Apache License 2.0
23.99k stars 4.94k forks source link

PAG is now supported in core 🤗 #8704

Open sayakpaul opened 1 week ago

sayakpaul commented 1 week ago

Hello folks!

https://github.com/huggingface/diffusers/pull/7944/ introduced support for Perturbed Attention Guidance (PAG) which enhances image generation quality training-free.

Generated Image without PAG Generated Image with PAG
Image without PAG Image with PAG

Check out the PAG guide here: https://huggingface.co/docs/diffusers/main/en/using-diffusers/pag.

Please treat this issue as an announcement instead. Report issues separately.

s9anus98a commented 1 week ago

/usr/local/lib/python3.10/dist-packages/diffusers/pipelines/auto_pipeline.py in _get_task_class(mapping, pipeline_class_name, throw_error_if_not_exist) 183 184 if throw_error_if_not_exist: --> 185 raise ValueError(f"AutoPipeline can't find a pipeline linked to {pipeline_class_name} for {model_name}") 186 187

ValueError: AutoPipeline can't find a pipeline linked to StableDiffusionPAGPipeline for None

yiyixuxu commented 1 week ago

@s9anus98a can you open an issue and share the code you used?

s9anus98a commented 1 week ago

@s9anus98a can you open an issue and share the code you used?

i use AutoPipelineForText2Image like in the example link provided

!pip install diffusers


self.pipeline = AutoPipelineForText2Image.from_pretrained(
            model_key,
            torch_dtype=self.dtype,
            enable_pag=True,
            pag_applied_layers=["mid"],  # You can adjust this as needed
        ).to(self.device)
sayakpaul commented 1 week ago

Please create a new issue for this.