long prompt weighting pipeline

waifu-research-department

Introduction

The Long Prompt Weighting Pipeline is a tool for generating text-to-image and image-to-image outputs using Stable Diffusion. It is designed to handle long prompts without token length limitations and includes support for weighted parsing in prompts.

Architecture

The pipeline utilizes the diffusers library, specifically a custom pipeline for Stable Diffusion provided by the Waifu Research Department. It supports enhanced prompt customization through weighting, allowing for detailed control over the generated images.

Training

This pipeline does not include training details, as it primarily focuses on inference using pre-trained models. It leverages existing models like hakurei/waifu-diffusion to produce images based on the provided prompts.

Guide: Running Locally

  1. Install Requirements: Ensure you have diffusers version 0.10.0 or later installed.
  2. Load the Model: Use the DiffusionPipeline.from_pretrained method to load the model with the custom pipeline.
    from diffusers import DiffusionPipeline
    import torch
    
    pipe = DiffusionPipeline.from_pretrained(
        'hakurei/waifu-diffusion',
        custom_pipeline="waifu-research-department/long-prompt-weighting-pipeline",
        revision="fp16",
        torch_dtype=torch.float16
    )
    pipe = pipe.to("cuda")
    
  3. Prepare Prompts: Define the prompt and negative prompt to guide the image generation.
    prompt = "best_quality (1girl:1.3) bow bride brown_hair ..."
    neg_prompt = "lowres, bad_anatomy, ..."
    
  4. Generate Image: Use the pipe.text2img method to generate an image.
    pipe.text2img(prompt, width=512, height=768, negative_prompt=neg_prompt, max_embeddings_multiples=3).images[0]
    

Cloud GPUs: For optimal performance, it is recommended to use a cloud GPU service such as AWS, Google Cloud, or Azure.

License

The Long Prompt Weighting Pipeline is distributed under the Apache-2.0 license, which permits use, modification, and distribution with proper attribution.

More Related APIs in Text To Image