
Prompt Extend
Prompt Extend is an innovative approach that aims to enhance the capabilities of language models and improve their response generation. It involves extending the initial prompt or query by providing additional context or specifications to guide the model's understanding and generate more accurate and relevant responses.
Prompt Extend
Summary
Introduction
Prompt Extend is an innovative approach that aims to enhance the capabilities of language models and improve their response generation. It involves extending the initial prompt or query by providing additional context or specifications to guide the model's understanding and generate more accurate and relevant responses.
Model Description
The text generation model is designed to generate appropriate style cues based on the main idea provided in a prompt. This model utilizes GPT-2, a powerful language model, which has been trained on a dataset of stable diffusion prompts.
Parameters
Inputs
input
- (text): The input of the model is a main idea provided in the prompt. This main idea can be a sentence or a short paragraph, representing the core concept, topic, or general content that the model will generate text about.
Output
output
- (text): The output of the model is the generated text based on the main idea of the prompt. This text contains suitable style cues in line with stable diffusion prompts. These style cues may include language usage, sentence structure, vocabulary, expression, or any other stylistic elements commonly found in stable diffusion prompts.
Examples
input | output |
---|---|
giant dragon flying in the sky | giant dragon flying in the sky, flying in the sky, shooting fire by makoto shinkai and ferdinand knab magic the gathering illustration city 4k Trending on artstation HQ, deviantart, kimi no na wa, simoni, 8k hd |
peaceful village landscape | peaceful village landscape, by makoto shinkai and thomas kinkade, trending on artstation, cgsociety cinematic lighting, sunny weather, colorful, very wide river, pastel colors, realistic trees, visually stunning visuals, top down view, bright sun rays, realistic sunset |
a coconut laying on the beach | a coconut laying on the beach, hyper realism, cinematic, volumetric lighting, intricate complexity, extremely detailed, photorealistic, film still cinematic lighting, post-processing, unreal engine, concept art, smooth, sharp focus, a mix of styles |
Usage for developers
Please find below the details to track the information and access the code for processing the model on our platform.
Requirements
torch
transformers
Code based on AIOZ structure
from transformers import pipeline
import torch, os
...
def do_ai_task(
input: Union[str, Path],
model_storage_directory: Union[str, Path],
device: Literal["cpu", "cuda", "gpu"] = "cpu",
*args, **kwargs) -> Any:
"""Define AI task: load model, pre-process, post-process, etc ..."""
# Define AI task workflow. Below is an example
device = "cuda" if torch.cuda.is_available() else "cpu"
model = os.path.abspath(model_storage_directory + "/...")
pipe = pipeline('text-generation', model=model, device=device)
with torch.no_grad():
result = pipe(input+',', num_return_sequences=1)[0]["generated_text"]
return str(result)
Reference
This repository is based on and inspired by Partho Das's work. We sincerely appreciate their generosity in sharing the code.
License
We respect and comply with the terms of the author's license cited in the Reference section.