Instructions to use aksty/promptgen with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use aksty/promptgen with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="aksty/promptgen")# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("aksty/promptgen") model = AutoModelForMultimodalLM.from_pretrained("aksty/promptgen") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use aksty/promptgen with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "aksty/promptgen" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "aksty/promptgen", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/aksty/promptgen
- SGLang
How to use aksty/promptgen with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "aksty/promptgen" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "aksty/promptgen", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "aksty/promptgen" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "aksty/promptgen", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use aksty/promptgen with Docker Model Runner:
docker model run hf.co/aksty/promptgen
aksty/promptgen: Prompt generation for Text-to-Image Models
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
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
- 5
