Instructions to use Sorawiz/Gemma-9B-Chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Sorawiz/Gemma-9B-Chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Sorawiz/Gemma-9B-Chat") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Sorawiz/Gemma-9B-Chat") model = AutoModelForCausalLM.from_pretrained("Sorawiz/Gemma-9B-Chat") 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
- vLLM
How to use Sorawiz/Gemma-9B-Chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Sorawiz/Gemma-9B-Chat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Sorawiz/Gemma-9B-Chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Sorawiz/Gemma-9B-Chat
- SGLang
How to use Sorawiz/Gemma-9B-Chat 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 "Sorawiz/Gemma-9B-Chat" \ --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": "Sorawiz/Gemma-9B-Chat", "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 "Sorawiz/Gemma-9B-Chat" \ --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": "Sorawiz/Gemma-9B-Chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Sorawiz/Gemma-9B-Chat with Docker Model Runner:
docker model run hf.co/Sorawiz/Gemma-9B-Chat
This model was originally named "Gemma-Creative-9B-Base", but it has been renamed to "Gemma-9B-Chat" to better reflect its strengths in conversational AI. I want to express my gratitude to the users who quantized and shared this model. Unfortunately, due to the renaming, some existing links to the original model page may no longer work as expected. I will list links to their quantized versions of this model under the GGUF section below.
Chat Template
Gemma Instruct
<start_of_turn>user
{prompt}<end_of_turn>
<start_of_turn>model
<end_of_turn>
<start_of_turn>model
{{- $system := "" }}
{{- range .Messages }}
{{- if eq .Role "system" }}
{{- if not $system }}{{ $system = .Content }}
{{- else }}{{ $system = printf "%s\n\n%s" $system .Content }}
{{- end }}
{{- continue }}
{{- else if eq .Role "user" }}<start_of_turn>user
{{- if $system }}
{{ $system }}
{{- $system = "" }}
{{- end }}
{{- else if eq .Role "assistant" }}<start_of_turn>model
{{- end }}
{{ .Content }}<end_of_turn>
{{ end }}<start_of_turn>model
GGUF
Thank you Otakadelic, zelk12 and mradermacher for creating the GGUF versions of this model.
Static quants - mradermacher/Gemma-Creative-9B-Base-GGUF
Q8_0 quant - Otakadelic/Gemma-Creative-9B-Base-Q8_0-GGUF
Q6_K quant - zelk12/Gemma-Creative-9B-Base-Q6_K-GGUF
Weighted/imatrix quants mradermacher/Gemma-Creative-9B-Base-i1-GGUF
Merge
This is a merge of pre-trained language models created using mergekit.
Merge Details
Merge Method
This model was merged using the TIES merge method using zelk12/MT-Gen6fix-gemma-2-9B as a base.
Models Merged
The following models were included in the merge:
- DreadPoor/Casuar-9B-Model_Stock
- Triangle104/Gemmadevi-Stock-10B
- TheDrummer/Gemmasutra-9B-v1.1
- allura-org/G2-9B-Aletheia-v1
- bunnycore/Gemma2-9B-TitanFusion
- lemon07r/Gemma-2-Ataraxy-v4d-9B
- TouchNight/gemma-2-Ifable-abliterated-9B-untied
Configuration
The following YAML configuration was used to produce this model:
models:
- model: DreadPoor/Casuar-9B-Model_Stock
parameters:
density: 1.00
weight: 1.00
- model: Triangle104/Gemmadevi-Stock-10B
parameters:
density: 1.00
weight: 1.00
- model: TheDrummer/Gemmasutra-9B-v1.1
parameters:
density: 1.00
weight: 1.00
- model: TouchNight/gemma-2-Ifable-abliterated-9B-untied
parameters:
density: 1.00
weight: 1.00
- model: bunnycore/Gemma2-9B-TitanFusion
parameters:
density: 1.00
weight: 1.00
- model: lemon07r/Gemma-2-Ataraxy-v4d-9B
parameters:
density: 1.00
weight: 1.00
- model: allura-org/G2-9B-Aletheia-v1
parameters:
density: 0.75
weight: 1.00
merge_method: ties
base_model: zelk12/MT-Gen6fix-gemma-2-9B
parameters:
density: 1
normalize: true
dtype: bfloat16
- Downloads last month
- 27