Text Generation
Transformers
Safetensors
Chinese
English
qwen2_5_vl
image-text-to-text
text-to-image
prompt-enhancement
prompt-rewriting
chain-of-thought
conversational
text-generation-inference
Instructions to use PromptEnhancer/PromptEnhancer-32B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PromptEnhancer/PromptEnhancer-32B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="PromptEnhancer/PromptEnhancer-32B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("PromptEnhancer/PromptEnhancer-32B") model = AutoModelForImageTextToText.from_pretrained("PromptEnhancer/PromptEnhancer-32B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use PromptEnhancer/PromptEnhancer-32B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "PromptEnhancer/PromptEnhancer-32B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PromptEnhancer/PromptEnhancer-32B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/PromptEnhancer/PromptEnhancer-32B
- SGLang
How to use PromptEnhancer/PromptEnhancer-32B 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 "PromptEnhancer/PromptEnhancer-32B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PromptEnhancer/PromptEnhancer-32B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "PromptEnhancer/PromptEnhancer-32B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PromptEnhancer/PromptEnhancer-32B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use PromptEnhancer/PromptEnhancer-32B with Docker Model Runner:
docker model run hf.co/PromptEnhancer/PromptEnhancer-32B
Update README.md
Browse files
README.md
CHANGED
|
@@ -30,12 +30,6 @@ PromptEnhancerV2 is a specialized text-to-image prompt rewriting model that empl
|
|
| 30 |
- **License:** Apache-2.0
|
| 31 |
- **Finetuned from model:** Qwen/Qwen2.5-VL-32B-Instruct
|
| 32 |
|
| 33 |
-
### Model Sources
|
| 34 |
-
|
| 35 |
-
- **Repository:** https://github.com/ximinng/PromptEnhancer
|
| 36 |
-
- **Paper:** https://arxiv.org/abs/2509.04545
|
| 37 |
-
- **Homepage:** https://hunyuan-promptenhancer.github.io/
|
| 38 |
-
|
| 39 |
## How to Get Started with the Model
|
| 40 |
|
| 41 |
- **1. Clone the repository:**:
|
|
@@ -70,21 +64,3 @@ enhanced_prompt = enhancer.predict(
|
|
| 70 |
|
| 71 |
print("Enhanced:", enhanced_prompt)
|
| 72 |
```
|
| 73 |
-
|
| 74 |
-
## Evaluation
|
| 75 |
-
|
| 76 |
-
The model is evaluated on the [T2I-Keypoints-Eval dataset](https://huggingface.co/datasets/PromptEnhancer/T2I-Keypoints-Eval), which contains diverse text-to-image prompts across various categories and languages.
|
| 77 |
-
|
| 78 |
-
## Citation
|
| 79 |
-
|
| 80 |
-
If you find this model useful, please consider citing:
|
| 81 |
-
|
| 82 |
-
**BibTeX:**
|
| 83 |
-
```bibtex
|
| 84 |
-
@article{promptenhancer,
|
| 85 |
-
title={PromptEnhancer: A Simple Approach to Enhance Text-to-Image Models via Chain-of-Thought Prompt Rewriting},
|
| 86 |
-
author={Wang, Linqing and Xing, Ximing and Cheng, Yiji and Zhao, Zhiyuan and Tao, Jiale and Wang, QiXun and Li, Ruihuang and Chen, Comi and Li, Xin and Wu, Mingrui and Deng, Xinchi and Wang, Chunyu and Lu, Qinglin},
|
| 87 |
-
journal={arXiv preprint arXiv:2509.04545},
|
| 88 |
-
year={2025}
|
| 89 |
-
}
|
| 90 |
-
```
|
|
|
|
| 30 |
- **License:** Apache-2.0
|
| 31 |
- **Finetuned from model:** Qwen/Qwen2.5-VL-32B-Instruct
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
## How to Get Started with the Model
|
| 34 |
|
| 35 |
- **1. Clone the repository:**:
|
|
|
|
| 64 |
|
| 65 |
print("Enhanced:", enhanced_prompt)
|
| 66 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|