Instructions to use shb777/PromptTuner-v0.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use shb777/PromptTuner-v0.1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="shb777/PromptTuner-v0.1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("shb777/PromptTuner-v0.1") model = AutoModelForCausalLM.from_pretrained("shb777/PromptTuner-v0.1") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use shb777/PromptTuner-v0.1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "shb777/PromptTuner-v0.1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shb777/PromptTuner-v0.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/shb777/PromptTuner-v0.1
- SGLang
How to use shb777/PromptTuner-v0.1 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 "shb777/PromptTuner-v0.1" \ --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": "shb777/PromptTuner-v0.1", "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 "shb777/PromptTuner-v0.1" \ --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": "shb777/PromptTuner-v0.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use shb777/PromptTuner-v0.1 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for shb777/PromptTuner-v0.1 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for shb777/PromptTuner-v0.1 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for shb777/PromptTuner-v0.1 to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="shb777/PromptTuner-v0.1", max_seq_length=2048, ) - Docker Model Runner
How to use shb777/PromptTuner-v0.1 with Docker Model Runner:
docker model run hf.co/shb777/PromptTuner-v0.1
PromptTuner v0.1
PromptTuner-v0.1 is a fine-tuned gemma-3-270M-it model specifically designed to enhance text prompts for text-to-image models.
This model takes a basic image concept and expands into rich, detailed descriptions including:
- Visual composition and perspective
- Artistic style and medium
- Color palette and lighting
- Atmosphere and mood
- Textures and materials
- Environmental context
The model tries preserves the core intent of your original prompt while adding professional-quality visual descriptors.
Dataset
The model was trained on a curated collection of prompt/magic-prompt pairs.
The dataset underwent extensive cleaning to ensure quality:
- Removed duplicates
- Removed prompts consisting only of numbers and spaces
- Filtered out magic prompts containing error messages or refusal responses
- Removed magic prompts below quality thresholds
- Cleaned up quotation marks at prompt boundaries
- Removed rows with excessively short prompts (length <= 2)
- Filtered out web links and URLs
- Removed gibberish inputs
- Filtered pairs where prompt and magic prompt were too similar
The training dataset was balanced using K-means clustering on prompt embeddings to ensure diverse representation of creative concepts.
Training
- Training Method: LoRA
- Rank: 16
- Alpha: 32
- Target modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
- Epochs: 3
- Batch Size: 16
- Learning Rate: 2e-4
- Optimizer: adamw_8bit
- LR Scheduler: Cosine
- Warmup Ratio: 0.1
- Train/Test Split: 90/10
Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("shb777/PromptTuner-v0.1")
tokenizer = AutoTokenizer.from_pretrained("shb777/PromptTuner-v0.1")
SYSTEM_PROMPT = """You are an expert creative director specializing in visual descriptions for image generation.
Your task: Transform the user's concept into a rich, detailed image description while PRESERVING their core idea.
IMPORTANT RULES:
1. Keep ALL key elements (intents, entities) from the original concept
2. Enhance with artistic details, NOT change the fundamental idea
3. Maintain the user's intended subject, action, and setting
You should elaborate on:
- Visual composition and perspective
- Artistic style (photorealistic, impressionist, etc.)
- Color palette and color temperature
- Lighting (golden hour, dramatic shadows, etc.)
- Atmosphere and mood
- Textures and materials
- Technical details (medium, brushwork, rendering style)
- Environmental context (time of day, weather, season, era)
- Level of detail and focus points
Output format: A single, flowing paragraph that reads naturally as an image prompt."""
user_input = "fox, red tail, blue moon, clouds"
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": user_input}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=1.0,
top_p=0.95,
top_k=64
)
enhanced_prompt = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(enhanced_prompt)
Recommended Generation Parameters
You must use the exact system prompt shown above, as the model was trained on it.
max_new_tokens: 512temperature: 1.0top_p: 0.95top_k: 64
You can try the model directly at TinkerSpace HF Space.
Limitations
This is only the first version of PromptTuner. As an initial release, the model may:
- Occasionally lose details and relationships from multi-entity prompts
- Sometimes introduce stylistic elements and text not present in the original concept
Feedback and suggestions for improvement are welcome.
License
This model is built upon Google's Gemma 3. Please refer to the Gemma license for usage terms.
Citation
If you use this model in your work, please cite:
@model{prompt_tuner_v0.1,
title={PromptTuner-v0.1: A Fine-tuned Gemma3-270M for Prompt Enhancement},
author={shb777},
year={2025},
url={https://huggingface.co/shb777/PromptTuner-v0.1}
}
Acknowledgments
- Base model: google/gemma-3-270M-it
- Training framework: Unsloth
- Downloads last month
- 4