Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: Support gemma-3 #3077

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/getting_started/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Currently, supported models include:
- ``QwQ-32B-Preview``, ``QwQ-32B``
- ``marco-o1``
- ``gemma-it``, ``gemma-2-it``
- ``gemma-3-it``, ``gemma-3-27b-it``, ``gemma-3-12b-it``, ``gemma-3-4b-it``, ``gemma-3-1b-it``
- ``orion-chat``, ``orion-chat-rag``
- ``c4ai-command-r-v01``
- ``minicpm3-4b``
Expand Down
316 changes: 316 additions & 0 deletions xinference/model/llm/llm_family.json
Original file line number Diff line number Diff line change
Expand Up @@ -5786,6 +5786,322 @@
"<start_of_turn>"
]
},
{
"version": 1,
"context_length": 131072,
"model_name": "gemma-3-it",
"model_lang": [
"en"
],
"model_ability": [
"chat"
],
"model_description": "Gemma is a family of lightweight, state-of-the-art open models from Google, built from the same research and technology used to create the Gemini models.",
"model_specs": [
{
"model_format": "pytorch",
"model_size_in_billions": 1,
"quantizations": [
"none",
"4-bit",
"8-bit"
],
"model_id": "google/gemma-3-1b-it"
},
{
"model_format": "pytorch",
"model_size_in_billions": 4,
"quantizations": [
"none",
"4-bit",
"8-bit"
],
"model_id": "google/gemma-3-4b-it"
},
{
"model_format": "pytorch",
"model_size_in_billions": 12,
"quantizations": [
"none",
"4-bit",
"8-bit"
],
"model_id": "google/gemma-3-12b-it"
},
{
"model_format": "pytorch",
"model_size_in_billions": 27,
"quantizations": [
"none",
"4-bit",
"8-bit"
],
"model_id": "google/gemma-3-27b-it"
},
{
"model_format": "ggufv2",
"model_size_in_billions": 2,
"quantizations": [
"IQ2_M",
"IQ3_M",
"IQ3_XS",
"IQ3_XXS",
"IQ4_NL",
"IQ4_XS",
"Q2_K",
"Q2_K_L",
"Q3_K_L",
"Q3_K_M",
"Q3_K_S",
"Q4_0",
"Q4_1",
"Q4_K_L",
"Q4_K_M",
"Q4_K_S",
"Q5_K_L",
"Q5_K_M",
"Q5_K_S",
"Q6_K",
"Q6_K_L",
"Q8_0",
"bf16"
],
"model_id": "bartowski/gemma-3-1b-it-GGUF",
"model_file_name_template": "gemma-3-1b-it-{quantization}.gguf"
},
{
"model_format": "ggufv2",
"model_size_in_billions": 4,
"quantizations": [
"IQ2_M",
"IQ3_M",
"IQ3_XS",
"IQ3_XXS",
"IQ4_NL",
"IQ4_XS",
"Q2_K",
"Q2_K_L",
"Q3_K_L",
"Q3_K_M",
"Q3_K_S",
"Q4_0",
"Q4_1",
"Q4_K_L",
"Q4_K_M",
"Q4_K_S",
"Q5_K_L",
"Q5_K_M",
"Q5_K_S",
"Q6_K",
"Q6_K_L",
"Q8_0",
"bf16"
],
"model_id": "bartowski/gemma-3-4b-it-GGUF",
"model_file_name_template": "gemma-3-4b-it-{quantization}.gguf"
},
{
"model_format": "ggufv2",
"model_size_in_billions": 12,
"quantizations": [
"IQ2_M",
"IQ3_M",
"IQ3_XS",
"IQ3_XXS",
"IQ4_NL",
"IQ4_XS",
"Q2_K",
"Q2_K_L",
"Q3_K_L",
"Q3_K_M",
"Q3_K_S",
"Q4_0",
"Q4_1",
"Q4_K_L",
"Q4_K_M",
"Q4_K_S",
"Q5_K_L",
"Q5_K_M",
"Q5_K_S",
"Q6_K",
"Q6_K_L",
"Q8_0",
"bf16"
],
"model_id": "bartowski/gemma-3-12b-it-GGUF",
"model_file_name_template": "gemma-3-12b-it-{quantization}.gguf"
},
{
"model_format": "ggufv2",
"model_size_in_billions": 27,
"quantizations": [
"IQ2_M",
"IQ3_M",
"IQ3_XS",
"IQ3_XXS",
"IQ4_NL",
"IQ4_XS",
"Q2_K",
"Q2_K_L",
"Q3_K_L",
"Q3_K_M",
"Q3_K_S",
"Q4_0",
"Q4_1",
"Q4_K_L",
"Q4_K_M",
"Q4_K_S",
"Q5_K_L",
"Q5_K_M",
"Q5_K_S",
"Q6_K",
"Q6_K_L",
"Q8_0",
"bf16"
],
"model_id": "bartowski/gemma-3-27b-it-GGUF",
"model_file_name_template": "gemma-3-27b-it-{quantization}.gguf"
},
{
"model_format": "mlx",
"model_size_in_billions": 1,
"quantizations": [
"4bit"
],
"model_id": "mlx-community/gemma-3-1b-it-4bit"
},
{
"model_format": "mlx",
"model_size_in_billions": 1,
"quantizations": [
"6bit"
],
"model_id": "mlx-community/gemma-3-1b-it-6bit"
},
{
"model_format": "mlx",
"model_size_in_billions": 1,
"quantizations": [
"8bit"
],
"model_id": "mlx-community/gemma-3-1b-it-8bit"
},
{
"model_format": "mlx",
"model_size_in_billions": 1,
"quantizations": [
"None"
],
"model_id": "mlx-community/gemma-3-1b-it-fp16"
},
{
"model_format": "mlx",
"model_size_in_billions": 4,
"quantizations": [
"4bit"
],
"model_id": "mlx-community/gemma-3-4b-it-4bit"
},
{
"model_format": "mlx",
"model_size_in_billions": 4,
"quantizations": [
"6bit"
],
"model_id": "mlx-community/gemma-3-4b-it-6bit"
},
{
"model_format": "mlx",
"model_size_in_billions": 4,
"quantizations": [
"8bit"
],
"model_id": "mlx-community/gemma-3-4b-it-8bit"
},
{
"model_format": "mlx",
"model_size_in_billions": 4,
"quantizations": [
"None"
],
"model_id": "mlx-community/gemma-3-4b-it-fp16"
},
{
"model_format": "mlx",
"model_size_in_billions": 12,
"quantizations": [
"4bit"
],
"model_id": "mlx-community/gemma-3-12b-it-4bit"
},
{
"model_format": "mlx",
"model_size_in_billions": 12,
"quantizations": [
"6bit"
],
"model_id": "mlx-community/gemma-3-12b-it-6bit"
},
{
"model_format": "mlx",
"model_size_in_billions": 12,
"quantizations": [
"8bit"
],
"model_id": "mlx-community/gemma-3-12b-it-8bit"
},
{
"model_format": "mlx",
"model_size_in_billions": 12,
"quantizations": [
"None"
],
"model_id": "mlx-community/gemma-3-12b-it-fp16"
},
{
"model_format": "mlx",
"model_size_in_billions": 27,
"quantizations": [
"4bit"
],
"model_id": "mlx-community/gemma-3-27b-it-4bit"
},
{
"model_format": "mlx",
"model_size_in_billions": 27,
"quantizations": [
"6bit"
],
"model_id": "mlx-community/gemma-3-27b-it-6bit"
},
{
"model_format": "mlx",
"model_size_in_billions": 27,
"quantizations": [
"8bit"
],
"model_id": "mlx-community/gemma-3-27b-it-8bit"
},
{
"model_format": "mlx",
"model_size_in_billions": 27,
"quantizations": [
"None"
],
"model_id": "mlx-community/gemma-3-27b-it-fp16"
}
],
"chat_template": "{{ bos_token }}\n{%- if messages[0]['role'] == 'system' -%}\n {%- if messages[0]['content'] is string -%}\n {%- set first_user_prefix = messages[0]['content'] + '\n\n' -%}\n {%- else -%}\n {%- set first_user_prefix = messages[0]['content'][0]['text'] + '\n\n' -%}\n {%- endif -%}\n {%- set loop_messages = messages[1:] -%}\n{%- else -%}\n {%- set first_user_prefix = \"\" -%}\n {%- set loop_messages = messages -%}\n{%- endif -%}\n{%- for message in loop_messages -%}\n {%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}\n {{ raise_exception(\"Conversation roles must alternate user/assistant/user/assistant/...\") }}\n {%- endif -%}\n {%- if (message['role'] == 'assistant') -%}\n {%- set role = \"model\" -%}\n {%- else -%}\n {%- set role = message['role'] -%}\n {%- endif -%}\n {{ '<start_of_turn>' + role + '\n' + (first_user_prefix if loop.first else \"\") }}\n {%- if message['content'] is string -%}\n {{ message['content'] | trim }}\n {%- elif message['content'] is iterable -%}\n {%- for item in message['content'] -%}\n {%- if item['type'] == 'image' -%}\n {{ '<start_of_image>' }}\n {%- elif item['type'] == 'text' -%}\n {{ item['text'] | trim }}\n {%- endif -%}\n {%- endfor -%}\n {%- else -%}\n {{ raise_exception(\"Invalid content type\") }}\n {%- endif -%}\n {{ '<end_of_turn>\n' }}\n{%- endfor -%}\n{%- if add_generation_prompt -%}\n {{'<start_of_turn>model\n'}}\n{%- endif -%}\n",
"stop_token_ids": [
1,
106
],
"stop": [
"<eos>",
"<end_of_turn>",
"<start_of_turn>"
]
},
{
"version": 1,
"context_length": 8192,
Expand Down
Loading
Loading