Text Generation
Transformers
Safetensors
granite
vllm
compressed-tensors
nvfp4
fp8
mixed-precision
quantized
reasoning
tool-calling
blackwell
conversational
8-bit precision
Instructions to use primitive-ai/granite-4.2-30b-mixed-NVFP4-FP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use primitive-ai/granite-4.2-30b-mixed-NVFP4-FP8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="primitive-ai/granite-4.2-30b-mixed-NVFP4-FP8") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("primitive-ai/granite-4.2-30b-mixed-NVFP4-FP8") model = AutoModelForCausalLM.from_pretrained("primitive-ai/granite-4.2-30b-mixed-NVFP4-FP8", device_map="auto") 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 primitive-ai/granite-4.2-30b-mixed-NVFP4-FP8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "primitive-ai/granite-4.2-30b-mixed-NVFP4-FP8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "primitive-ai/granite-4.2-30b-mixed-NVFP4-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/primitive-ai/granite-4.2-30b-mixed-NVFP4-FP8
- SGLang
How to use primitive-ai/granite-4.2-30b-mixed-NVFP4-FP8 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 "primitive-ai/granite-4.2-30b-mixed-NVFP4-FP8" \ --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": "primitive-ai/granite-4.2-30b-mixed-NVFP4-FP8", "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 "primitive-ai/granite-4.2-30b-mixed-NVFP4-FP8" \ --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": "primitive-ai/granite-4.2-30b-mixed-NVFP4-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use primitive-ai/granite-4.2-30b-mixed-NVFP4-FP8 with Docker Model Runner:
docker model run hf.co/primitive-ai/granite-4.2-30b-mixed-NVFP4-FP8
Granite-4.2-30B mixed NVFP4/FP8: MLP+qkv NVFP4 g16, o_proj FP8
Browse files- chat_template.jinja +184 -0
- config.json +120 -0
- generation_config.json +10 -0
- granite_thinking_parser.py +24 -0
- merges.txt +0 -0
- model-00001-of-00004.safetensors +3 -0
- model-00002-of-00004.safetensors +3 -0
- model-00003-of-00004.safetensors +3 -0
- model-00004-of-00004.safetensors +3 -0
- model.safetensors.index.json +0 -0
- special_tokens_map.json +30 -0
- tokenizer.json +0 -0
- tokenizer_config.json +15 -0
- vocab.json +0 -0
chat_template.jinja
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- macro tool_to_json(tool) -%}
|
| 2 |
+
{%- set ns_tool = namespace(first=true) -%}
|
| 3 |
+
{{- '{' -}}
|
| 4 |
+
{%- for k, v in tool.items() -%}
|
| 5 |
+
{%- if k != 'defer_loading' and k != 'strict' -%}
|
| 6 |
+
{%- if not ns_tool.first -%}{{- ', ' -}}{%- endif -%}
|
| 7 |
+
{%- set ns_tool.first = false -%}
|
| 8 |
+
{{- '"' ~ k ~ '": ' ~ (v | tojson(ensure_ascii=False)) -}}
|
| 9 |
+
{%- endif -%}
|
| 10 |
+
{%- endfor -%}
|
| 11 |
+
{{- '}' -}}
|
| 12 |
+
{%- endmacro -%}
|
| 13 |
+
{%- set enable_thinking = enable_thinking if enable_thinking is defined else True %}
|
| 14 |
+
{%- set low_effort = low_effort if low_effort is defined else False %}
|
| 15 |
+
{%- if reasoning_effort is defined and reasoning_effort is not none %}
|
| 16 |
+
{%- set low_effort = reasoning_effort == "low" %}
|
| 17 |
+
{%- endif %}
|
| 18 |
+
{%- set truncate_history_thinking = truncate_history_thinking if truncate_history_thinking is defined else True %}
|
| 19 |
+
|
| 20 |
+
{%- set ns = namespace(last_user_idx = -1) %}
|
| 21 |
+
{%- set loop_messages = messages %}
|
| 22 |
+
{%- for m in loop_messages %}
|
| 23 |
+
{%- if m["role"] == "user" %}
|
| 24 |
+
{%- set ns.last_user_idx = loop.index0 %}
|
| 25 |
+
{%- endif %}
|
| 26 |
+
{%- endfor %}
|
| 27 |
+
|
| 28 |
+
{%- if messages[0]["role"] == "system" %}
|
| 29 |
+
{%- set system_message = messages[0]["content"] %}
|
| 30 |
+
{%- set loop_messages = messages[1:] %}
|
| 31 |
+
{%- else %}
|
| 32 |
+
{%- set system_message = "" %}
|
| 33 |
+
{%- set loop_messages = messages %}
|
| 34 |
+
{%- endif %}
|
| 35 |
+
{%- if not tools is defined %}
|
| 36 |
+
{%- set tools = [] %}
|
| 37 |
+
{%- endif %}
|
| 38 |
+
{# Recompute last_user_idx relative to loop_messages after handling system #}
|
| 39 |
+
{%- set ns = namespace(last_user_idx = -1) %}
|
| 40 |
+
{%- for m in loop_messages %}
|
| 41 |
+
{%- if m["role"] == "user" %}
|
| 42 |
+
{%- set ns.last_user_idx = loop.index0 %}
|
| 43 |
+
{%- endif %}
|
| 44 |
+
{%- endfor %}
|
| 45 |
+
{%- if system_message is defined %}
|
| 46 |
+
{{- "<|im_start|>system\n" + system_message }}
|
| 47 |
+
{%- else %}
|
| 48 |
+
{%- if tools is iterable and tools | length > 0 %}
|
| 49 |
+
{{- "<|im_start|>system\n" }}
|
| 50 |
+
{%- endif %}
|
| 51 |
+
{%- endif %}
|
| 52 |
+
{%- if tools is iterable and tools | length > 0 %}
|
| 53 |
+
{%- if system_message is defined and system_message | length > 0 %}
|
| 54 |
+
{{- "\n\n" }}
|
| 55 |
+
{%- endif %}
|
| 56 |
+
{{- "# Tools\n\nYou have access to the following functions:\n\n" }}
|
| 57 |
+
{{- "<tools>" }}
|
| 58 |
+
{%- for tool in tools %}
|
| 59 |
+
{%- if tool.function is defined %}
|
| 60 |
+
{%- set tool = tool.function %}
|
| 61 |
+
{%- endif %}
|
| 62 |
+
{%- if tool.defer_loading is not defined or not tool.defer_loading %}
|
| 63 |
+
{{- '\n' ~ tool_to_json(tool) }}
|
| 64 |
+
{%- endif %}
|
| 65 |
+
{%- endfor %}
|
| 66 |
+
{{- "\n</tools>" }}
|
| 67 |
+
|
| 68 |
+
{{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
|
| 69 |
+
{%- endif %}
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
{%- if system_message is defined %}
|
| 73 |
+
{{- '<|im_end|>\n' }}
|
| 74 |
+
{%- else %}
|
| 75 |
+
{%- if tools is iterable and tools | length > 0 %}
|
| 76 |
+
{{- '<|im_end|>\n' }}
|
| 77 |
+
{%- endif %}
|
| 78 |
+
{%- endif %}
|
| 79 |
+
|
| 80 |
+
{%- for message in loop_messages %}
|
| 81 |
+
{%- if message.role == "assistant" %}
|
| 82 |
+
{# Add reasoning content in to content field for unified processing below. #}
|
| 83 |
+
{%- if message.reasoning_content is defined and message.reasoning_content is string and message.reasoning_content | trim | length > 0 %}
|
| 84 |
+
{%- set content = "<think>\n" ~ message.reasoning_content ~ "\n</think>\n" ~ (message.content | default('', true)) %}
|
| 85 |
+
{%- else %}
|
| 86 |
+
{%- set content = message.content | default('', true) %}
|
| 87 |
+
{%- if content is string -%}
|
| 88 |
+
{# Allow downstream logic to to take care of broken thought, only handle coherent reasoning here. #}
|
| 89 |
+
{%- if '<think>' not in content and '</think>' not in content -%}
|
| 90 |
+
{%- set content = "<think></think>" ~ content -%}
|
| 91 |
+
{%- endif -%}
|
| 92 |
+
{%- else -%}
|
| 93 |
+
{%- set content = content -%}
|
| 94 |
+
{%- endif -%}
|
| 95 |
+
{%- endif %}
|
| 96 |
+
{%- if message.tool_calls is defined and message.tool_calls is iterable and message.tool_calls | length > 0 %}
|
| 97 |
+
{# Assistant message has tool calls. #}
|
| 98 |
+
{{- '<|im_start|>assistant\n' }}
|
| 99 |
+
{%- set include_content = not (truncate_history_thinking and loop.index0 < ns.last_user_idx) %}
|
| 100 |
+
{%- if content is string and content | trim | length > 0 %}
|
| 101 |
+
{%- if include_content %}
|
| 102 |
+
{{- (content | trim) ~ '\n' -}}
|
| 103 |
+
{%- else %}
|
| 104 |
+
{%- set c = (content | string) %}
|
| 105 |
+
{%- if '</think>' in c %}
|
| 106 |
+
{# Keep only content after the last closing think. Also generation prompt causes this. #}
|
| 107 |
+
{%- set c = c.split('</think>')[-1] %}
|
| 108 |
+
{%- elif '<think>' in c %}
|
| 109 |
+
{# If <think> was opened but never closed, drop the trailing think segment #}
|
| 110 |
+
{%- set c = c.split('<think>')[0] %}
|
| 111 |
+
{%- endif %}
|
| 112 |
+
{%- set c = "<think></think>" ~ c | trim %}
|
| 113 |
+
{%- if c | length > 0 %}
|
| 114 |
+
{{- c ~ '\n' -}}
|
| 115 |
+
{%- endif %}
|
| 116 |
+
{%- endif %}
|
| 117 |
+
{%- else %}
|
| 118 |
+
{{- "<think></think>" -}}
|
| 119 |
+
{%- endif %}
|
| 120 |
+
{%- for tool_call in message.tool_calls %}
|
| 121 |
+
{%- if tool_call.function is defined %}
|
| 122 |
+
{%- set tool_call = tool_call.function %}
|
| 123 |
+
{%- endif %}
|
| 124 |
+
{{- '<tool_call>\n<function=' ~ tool_call.name ~ '>\n' -}}
|
| 125 |
+
{%- if tool_call.arguments is defined %}
|
| 126 |
+
{%- for args_name, args_value in tool_call.arguments|items %}
|
| 127 |
+
{{- '<parameter=' ~ args_name ~ '>\n' -}}
|
| 128 |
+
{%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
|
| 129 |
+
{{- args_value ~ '\n</parameter>\n' -}}
|
| 130 |
+
{%- endfor %}
|
| 131 |
+
{%- endif %}
|
| 132 |
+
{{- '</function>\n</tool_call>\n' -}}
|
| 133 |
+
{%- endfor %}
|
| 134 |
+
{{- '<|im_end|>\n' }}
|
| 135 |
+
{%- else %}
|
| 136 |
+
{# Assistant message doesn't have tool calls. #}
|
| 137 |
+
{%- if not (truncate_history_thinking and loop.index0 < ns.last_user_idx) %}
|
| 138 |
+
{{- '<|im_start|>assistant\n' ~ (content | default('', true) | string | trim) ~ '<|im_end|>\n' }}
|
| 139 |
+
{%- else %}
|
| 140 |
+
{%- set c = (content | default('', true) | string) %}
|
| 141 |
+
{%- if '<think>' in c and '</think>' in c %}
|
| 142 |
+
{%- set c = "<think></think>" ~ c.split('</think>')[-1] %}
|
| 143 |
+
{%- endif %}
|
| 144 |
+
{%- set c = c | trim %}
|
| 145 |
+
{%- if c | length > 0 %}
|
| 146 |
+
{{- '<|im_start|>assistant\n' ~ c ~ '<|im_end|>\n' }}
|
| 147 |
+
{%- else %}
|
| 148 |
+
{{- '<|im_start|>assistant\n<|im_end|>\n' }}
|
| 149 |
+
{%- endif %}
|
| 150 |
+
{%- endif %}
|
| 151 |
+
{%- endif %}
|
| 152 |
+
{%- elif message.role == "user" or message.role == "system" %}
|
| 153 |
+
{{- '<|im_start|>' + message.role + '\n' }}
|
| 154 |
+
{%- set content = message.content | string %}
|
| 155 |
+
{%- if message.role == "user" and loop.index0 == ns.last_user_idx and low_effort %}
|
| 156 |
+
{{- content + '\n\n{reasoning effort: low}' }}
|
| 157 |
+
{%- else %}
|
| 158 |
+
{{- content }}
|
| 159 |
+
{%- endif %}
|
| 160 |
+
{{- '<|im_end|>\n' }}
|
| 161 |
+
{%- elif message.role == "tool" %}
|
| 162 |
+
{%- if loop.previtem and loop.previtem.role != "tool" %}
|
| 163 |
+
{{- '<|im_start|>user\n' }}
|
| 164 |
+
{%- endif %}
|
| 165 |
+
{{- '<tool_response>\n' }}
|
| 166 |
+
{{- message.content }}
|
| 167 |
+
{{- '\n</tool_response>\n' }}
|
| 168 |
+
{%- if not loop.last and loop.nextitem.role != "tool" %}
|
| 169 |
+
{{- '<|im_end|>\n' }}
|
| 170 |
+
{%- elif loop.last %}
|
| 171 |
+
{{- '<|im_end|>\n' }}
|
| 172 |
+
{%- endif %}
|
| 173 |
+
{%- else %}
|
| 174 |
+
{{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>\n' }}
|
| 175 |
+
{%- endif %}
|
| 176 |
+
{%- endfor %}
|
| 177 |
+
|
| 178 |
+
{%- if add_generation_prompt %}
|
| 179 |
+
{%- if enable_thinking %}
|
| 180 |
+
{{- '<|im_start|>assistant\n<think>\n' }}
|
| 181 |
+
{%- else %}
|
| 182 |
+
{{- '<|im_start|>assistant\n<think></think>' }}
|
| 183 |
+
{%- endif %}
|
| 184 |
+
{%- endif %}
|
config.json
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"GraniteForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"attention_multiplier": 0.0078125,
|
| 8 |
+
"bos_token_id": 100283,
|
| 9 |
+
"dtype": "bfloat16",
|
| 10 |
+
"embedding_multiplier": 1.0,
|
| 11 |
+
"eos_token_id": 100257,
|
| 12 |
+
"hidden_act": "silu",
|
| 13 |
+
"hidden_size": 4096,
|
| 14 |
+
"initializer_range": 0.1,
|
| 15 |
+
"intermediate_size": 32768,
|
| 16 |
+
"logits_scaling": 1.0,
|
| 17 |
+
"max_position_embeddings": 131072,
|
| 18 |
+
"mlp_bias": false,
|
| 19 |
+
"model_type": "granite",
|
| 20 |
+
"num_attention_heads": 32,
|
| 21 |
+
"num_hidden_layers": 64,
|
| 22 |
+
"num_key_value_heads": 8,
|
| 23 |
+
"pad_token_id": 100257,
|
| 24 |
+
"quantization_config": {
|
| 25 |
+
"config_groups": {
|
| 26 |
+
"group_0": {
|
| 27 |
+
"format": "nvfp4-pack-quantized",
|
| 28 |
+
"input_activations": {
|
| 29 |
+
"actorder": null,
|
| 30 |
+
"block_structure": null,
|
| 31 |
+
"dynamic": "local",
|
| 32 |
+
"group_size": 16,
|
| 33 |
+
"num_bits": 4,
|
| 34 |
+
"observer": "static_minmax",
|
| 35 |
+
"observer_kwargs": {},
|
| 36 |
+
"scale_dtype": "torch.float8_e4m3fn",
|
| 37 |
+
"strategy": "tensor_group",
|
| 38 |
+
"symmetric": true,
|
| 39 |
+
"type": "float",
|
| 40 |
+
"zp_dtype": null
|
| 41 |
+
},
|
| 42 |
+
"output_activations": null,
|
| 43 |
+
"targets": [
|
| 44 |
+
"re:.*\\.mlp\\.(gate_proj|up_proj|down_proj)$",
|
| 45 |
+
"re:.*\\.self_attn\\.(q_proj|k_proj|v_proj)$"
|
| 46 |
+
],
|
| 47 |
+
"weights": {
|
| 48 |
+
"actorder": "static",
|
| 49 |
+
"block_structure": null,
|
| 50 |
+
"dynamic": false,
|
| 51 |
+
"group_size": 16,
|
| 52 |
+
"num_bits": 4,
|
| 53 |
+
"observer": "memoryless_minmax",
|
| 54 |
+
"observer_kwargs": {},
|
| 55 |
+
"scale_dtype": "torch.float8_e4m3fn",
|
| 56 |
+
"strategy": "tensor_group",
|
| 57 |
+
"symmetric": true,
|
| 58 |
+
"type": "float",
|
| 59 |
+
"zp_dtype": null
|
| 60 |
+
}
|
| 61 |
+
},
|
| 62 |
+
"group_1": {
|
| 63 |
+
"format": "float-quantized",
|
| 64 |
+
"input_activations": {
|
| 65 |
+
"actorder": null,
|
| 66 |
+
"block_structure": null,
|
| 67 |
+
"dynamic": true,
|
| 68 |
+
"group_size": null,
|
| 69 |
+
"num_bits": 8,
|
| 70 |
+
"observer": null,
|
| 71 |
+
"observer_kwargs": {},
|
| 72 |
+
"scale_dtype": null,
|
| 73 |
+
"strategy": "token",
|
| 74 |
+
"symmetric": true,
|
| 75 |
+
"type": "float",
|
| 76 |
+
"zp_dtype": null
|
| 77 |
+
},
|
| 78 |
+
"output_activations": null,
|
| 79 |
+
"targets": [
|
| 80 |
+
"re:.*\\.self_attn\\.o_proj$"
|
| 81 |
+
],
|
| 82 |
+
"weights": {
|
| 83 |
+
"actorder": "static",
|
| 84 |
+
"block_structure": null,
|
| 85 |
+
"dynamic": false,
|
| 86 |
+
"group_size": null,
|
| 87 |
+
"num_bits": 8,
|
| 88 |
+
"observer": "memoryless_minmax",
|
| 89 |
+
"observer_kwargs": {},
|
| 90 |
+
"scale_dtype": null,
|
| 91 |
+
"strategy": "channel",
|
| 92 |
+
"symmetric": true,
|
| 93 |
+
"type": "float",
|
| 94 |
+
"zp_dtype": null
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
},
|
| 98 |
+
"format": "mixed-precision",
|
| 99 |
+
"global_compression_ratio": null,
|
| 100 |
+
"ignore": [
|
| 101 |
+
"lm_head"
|
| 102 |
+
],
|
| 103 |
+
"kv_cache_scheme": null,
|
| 104 |
+
"quant_method": "compressed-tensors",
|
| 105 |
+
"quantization_status": "compressed",
|
| 106 |
+
"sparsity_config": {},
|
| 107 |
+
"transform_config": {},
|
| 108 |
+
"version": "0.18.1.a20260806"
|
| 109 |
+
},
|
| 110 |
+
"residual_multiplier": 1.0,
|
| 111 |
+
"rms_norm_eps": 1e-05,
|
| 112 |
+
"rope_parameters": {
|
| 113 |
+
"rope_theta": 50000000,
|
| 114 |
+
"rope_type": "default"
|
| 115 |
+
},
|
| 116 |
+
"tie_word_embeddings": false,
|
| 117 |
+
"transformers_version": "5.15.0",
|
| 118 |
+
"use_cache": true,
|
| 119 |
+
"vocab_size": 100352
|
| 120 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 100283,
|
| 4 |
+
"do_sample": true,
|
| 5 |
+
"eos_token_id": 100257,
|
| 6 |
+
"pad_token_id": 100257,
|
| 7 |
+
"temperature": 1.0,
|
| 8 |
+
"top_p": 0.95,
|
| 9 |
+
"transformers_version": "5.15.0"
|
| 10 |
+
}
|
granite_thinking_parser.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from vllm.reasoning.abs_reasoning_parsers import ReasoningParserManager
|
| 2 |
+
from vllm.reasoning.deepseek_r1_reasoning_parser import DeepSeekR1ReasoningParser
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
@ReasoningParserManager.register_module("granite_thinking_parser")
|
| 6 |
+
class GraniteThinkingReasoningParser(DeepSeekR1ReasoningParser):
|
| 7 |
+
|
| 8 |
+
def extract_reasoning(self, model_output, request):
|
| 9 |
+
reasoning_content, final_content = super().extract_reasoning(
|
| 10 |
+
model_output, request
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
if final_content is not None:
|
| 14 |
+
final_content = final_content.lstrip("\n")
|
| 15 |
+
|
| 16 |
+
if (
|
| 17 |
+
hasattr(request, "chat_template_kwargs")
|
| 18 |
+
and request.chat_template_kwargs
|
| 19 |
+
and request.chat_template_kwargs.get("enable_thinking") is False
|
| 20 |
+
and final_content is None
|
| 21 |
+
):
|
| 22 |
+
reasoning_content, final_content = None, reasoning_content
|
| 23 |
+
|
| 24 |
+
return reasoning_content, final_content
|
merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
model-00001-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ccbe5207071776c957e8dae460a6b41ccffe29ec4ee52cad370c71514ba4e03e
|
| 3 |
+
size 4991067856
|
model-00002-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:885bb73ab20b7177bc2bf9338165fd1e181b02aed22262d8972d6af9f1fd2366
|
| 3 |
+
size 4967108912
|
model-00003-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b008a1e5bb0e50464142a2dac8edfdd8648d2da91e1d9bae5d7edb2f95c34337
|
| 3 |
+
size 4967108872
|
model-00004-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4a3039755dac2bab7d7962cd133524746ec4fbff3bd94e88ca5c060d28267bbe
|
| 3 |
+
size 3195895696
|
model.safetensors.index.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "<|im_end|>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": {
|
| 17 |
+
"content": "<|im_end|>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"unk_token": {
|
| 24 |
+
"content": "<unk>",
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
}
|
| 30 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<s>",
|
| 5 |
+
"clean_up_tokenization_spaces": false,
|
| 6 |
+
"eos_token": "<|im_end|>",
|
| 7 |
+
"errors": "replace",
|
| 8 |
+
"is_local": true,
|
| 9 |
+
"local_files_only": false,
|
| 10 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 11 |
+
"pad_token": "<|im_end|>",
|
| 12 |
+
"padding_side": "left",
|
| 13 |
+
"tokenizer_class": "TokenizersBackend",
|
| 14 |
+
"unk_token": "<unk>"
|
| 15 |
+
}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|