Overcoming the 77-token limitation using community pipelines
Implementing a pipeline supporting long prompt weighting from scratch can be challenging. Often, we simply wish to utilize Diffusers to generate images using detailed and nuanced prompts. Fortunately, the open source community has provided implementations for SD v1.5 and SDXL. The SDXL implementation was originally initialized by Andrew Zhu, the author of this book, and massively improved by the community.
I’ll now provide two examples of how to use the community pipeline for SD v1.5 and SDXL:
- This example uses the
lpw_stable_diffusion
pipeline for SD v1.5.Use the following code to start a long prompt weighted pipeline:
from diffusers import DiffusionPipeline
import torch
model_id_or_path = "stablediffusionapi/deliberate-v2"
pipe = DiffusionPipeline.from_pretrained(
    model_id_or_path,
    torch_dtype = torch.float16,
    custom_pipeline =...