aksty/promptgen: Prompt generation for Text-to-Image Models

visitor badge

This is a text generation model trained on data specifically designed to generate prompts for text-to-image models. It is based on the EleutherAI/gpt-neo-125M pre-trained model, which has been fine-tuned using the Gustavosta/Stable-Diffusion-Prompts dataset.

Notebook with promptgen + Stable Diffusion v2

image

image

Usage

To use this model, you will need to have PyTorch and the transformers library installed. You can then use the following code to generate text using the model:

import torch
from transformers import GPT2Tokenizer, GPTNeoForCausalLM

tokenizer = GPT2Tokenizer.from_pretrained("aksty/promptgen")
model = GPTNeoForCausalLM.from_pretrained("aksty/promptgen")

def generate_text(prompt):
  input_ids = tokenizer(prompt, return_tensors="pt").input_ids
  outputs = model.generate(input_ids, do_sample=True, max_length=100)
  return tokenizer.batch_decode(outputs, skip_special_tokens=True)

Output :

generate_text("A painting of an ancient city ")
['A painting of an ancient city  on the top of a cliff, a small sign charging through the sky, cinematic view, epic sky, detailed, concept art, low angle, high detail, warm lighting, volumetric, godrays, vivid, beautiful, trending on artstation, by jordan grimmer, huge scene, grass, art greg rutkowski']

Disclaimer

It is important to note that the results generated by promptgen are not guaranteed to be accurate, complete, or suitable for any particular purpose. The model is intended for research and educational purposes only and should not be relied upon for any other purposes. The generated text may contain errors, omissions, or inappropriate language. The user of the model is solely responsible for any actions or decisions made based on the generated text.

Downloads last month
17
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Space using aksty/promptgen 1