Downloads · 30 days
28
12% of all-time downloads
dangvansam/gemma-2-2b-it-fix-system-role
gemma-2-2b-it-fix-system-role is a text generation model from dangvansam. Use it when you need the model to write or continue text. The card lists the license as gemma.
Modified version of gemma-2-2b-it and update chattemplate for support system role to handle cases: - Conversation roles must alternate user/assistant/user/assistant/... - System role not supported
Downloads · 30 days
28
12% of all-time downloads
All-time downloads
230
Public
Parameters
2.6B
5.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors5.2 GB · 100%
From the Hugging Face model README
Modified version of gemma-2-2b-it and update chat_template for support system role to handle cases:
Conversation roles must alternate user/assistant/user/assistant/...System role not supportedThis model can be deployed efficiently using the vLLM backend, as shown in the example below.
With CLI:
vllm serve --model dangvansam/gemma-2-2b-it-fix-system-role
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "dangvansam/gemma-2-2b-it-fix-system-role",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Who are you?"}
]
}'
With Python:
from vllm import LLM, SamplingParams
from transformers import AutoTokenizer
model_id = "dangvansam/gemma-2-2b-it-fix-system-role"
sampling_params = SamplingParams(temperature=0.6, top_p=0.9, max_tokens=256)
tokenizer = AutoTokenizer.from_pretrained(model_id)
messages = [
{"role": "system", "content": "You are helpfull assistant."},
{"role": "user", "content": "Who are you?"}
]
prompts = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
llm = LLM(model=model_id)
outputs = llm.generate(prompts, sampling_params)
generated_text = outputs[0].outputs[0].text
print(generated_text)
vLLM also supports OpenAI-compatible serving. See the documentation for more details.