Flux Prompt Enhance

gokaygokay

Introduction

Flux-Prompt-Enhance is a text-to-text generation model designed to enhance prompts using the T5 architecture. It is built on the google-t5/t5-base model and optimized for English language processing.

Architecture

Flux-Prompt-Enhance utilizes the Transformer architecture, specifically the T5 model, to perform text-to-text generation tasks. The model is designed to improve prompt descriptions by expanding and enriching them with additional details.

Training

The model is trained using the gokaygokay/prompt-enhancer-dataset and leverages the transformers library. It is capable of understanding and generating English text, which is enhanced using a pipeline configured with a repetition penalty to avoid redundant outputs.

Guide: Running Locally

To run the Flux-Prompt-Enhance model locally, follow these steps:

  1. Install Dependencies: Ensure you have transformers and PyTorch installed in your environment.

  2. Load Model and Tokenizer:

    from transformers import pipeline, AutoTokenizer, AutoModelForSeq2SeqLM
    import torch
    
    device = "cuda" if torch.cuda.is_available() else "cpu"
    model_checkpoint = "gokaygokay/Flux-Prompt-Enhance"
    tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
    model = AutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)
    
  3. Setup the Pipeline:

    enhancer = pipeline('text2text-generation',
                        model=model,
                        tokenizer=tokenizer,
                        repetition_penalty=1.2,
                        device=device)
    
  4. Generate Enhanced Text:

    max_target_length = 256
    prefix = "enhance prompt: "
    short_prompt = "beautiful house with text 'hello'"
    answer = enhancer(prefix + short_prompt, max_length=max_target_length)
    final_answer = answer[0]['generated_text']
    print(final_answer)
    

For enhanced performance, consider using a cloud GPU service such as AWS EC2, Google Cloud, or Azure to run the model.

License

Flux-Prompt-Enhance is distributed under the Apache-2.0 license, allowing for both personal and commercial use with proper attribution.

More Related APIs in Text2text Generation