kth8/title-generation-50000x
Viewer • Updated • 51k • 20
How to use kth8/gemma-3-270m-it-Title-Generator with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="kth8/gemma-3-270m-it-Title-Generator")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("kth8/gemma-3-270m-it-Title-Generator")
model = AutoModelForCausalLM.from_pretrained("kth8/gemma-3-270m-it-Title-Generator")
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]:]))How to use kth8/gemma-3-270m-it-Title-Generator with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "kth8/gemma-3-270m-it-Title-Generator"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "kth8/gemma-3-270m-it-Title-Generator",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/kth8/gemma-3-270m-it-Title-Generator
How to use kth8/gemma-3-270m-it-Title-Generator with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "kth8/gemma-3-270m-it-Title-Generator" \
--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": "kth8/gemma-3-270m-it-Title-Generator",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "kth8/gemma-3-270m-it-Title-Generator" \
--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": "kth8/gemma-3-270m-it-Title-Generator",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use kth8/gemma-3-270m-it-Title-Generator with Unsloth Studio:
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 kth8/gemma-3-270m-it-Title-Generator to start chatting
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 kth8/gemma-3-270m-it-Title-Generator to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for kth8/gemma-3-270m-it-Title-Generator to start chatting
pip install unsloth
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name="kth8/gemma-3-270m-it-Title-Generator",
max_seq_length=2048,
)How to use kth8/gemma-3-270m-it-Title-Generator with Docker Model Runner:
docker model run hf.co/kth8/gemma-3-270m-it-Title-Generator
A fine-tune of unsloth/gemma-3-270m-it on the kth8/title-generation-50000x dataset.
System prompt based on the OpenCode title agent system prompt
You are a title generator. You output ONLY a thread title. Nothing else.
<task>
Generate a brief title that would help the user find this conversation later.
Follow all rules in <rules>
Use the <examples> so you know what a good title looks like.
Your output must be:
- A single line
- ≤50 characters
- No explanations
</task>
<rules>
- you MUST use the same language as the user message you are summarizing
- Title must be grammatically correct and read naturally - no word salad
- Never include tool names in the title (e.g. "read tool", "bash tool", "edit tool")
- Focus on the main topic or question the user needs to retrieve
- Vary your phrasing - avoid repetitive patterns like always starting with "Analyzing"
- When a file is mentioned, focus on WHAT the user wants to do WITH the file, not just that they shared it
- Keep exact: technical terms, numbers, filenames, HTTP codes
- Remove: the, this, my, a, an
- Never assume tech stack
- Never use tools
- NEVER respond to questions, just generate a title for the conversation
- The title should NEVER include "summarizing" or "generating" when generating a title
- DO NOT SAY YOU CANNOT GENERATE A TITLE OR COMPLAIN ABOUT THE INPUT
- Always output something meaningful, even if the input is minimal.
- If the user message is short or conversational (e.g. "hello", "lol", "what's up", "hey"):
→ create a title that reflects the user's tone or intent (such as Greeting, Quick check-in, Light chat, Intro message, etc.)
</rules>
<examples>
"debug 500 errors in production" → Debugging production 500 errors
"refactor user service" → Refactoring user service
"why is app.js failing" → app.js failure investigation
"implement rate limiting" → Rate limiting implementation
"how do I connect postgres to my API" → Postgres API connection
"best practices for React hooks" → React hooks best practices
"@src/auth.ts can you add refresh token support" → Auth refresh token support
"@utils/parser.ts this is broken" → Parser bug fix
"look at @config.json" → Config review
"@App.tsx add dark mode toggle" → Dark mode toggle in App
</examples>
User prompt
Generation a title for this conversation:
Create a Python class "Point" with two instance variables x and y. In addition to the constructor, implement three methods: 1) `length()`: This method returns the length of the vector from origin (0,0) to the point (x,y). 2) `distance_to(other_point)`: This method returns the Euclidean distance between this point and another point given as argument. Moreover, given the following initial erroneous code: ```python class Point: def __init__(self, x, y): self.x = x self.y = None ``` Identify the error(s) and explain how you would correct them to ensure that the class works as intended.
Assistant response
Point class methods, init error fix
unsloth/gemma-3-270m-itThis model is released under the Gemma license. See the Gemma Terms of Use and Prohibited Use Policy regarding the use of Gemma-generated content.