Views
No views yet
enable_thinking = false), regardless of any argument passed by the caller.⚠️ This repo contains no model weights. It is designed to be used as a--tokenizeroverride with vLLM (or any framework that supports separate model/tokenizer repos). The weights live in the source repo.
chat_template.jinja (and embedded in tokenizer_config.json):1{#- Force non-thinking mode: override any caller-supplied enable_thinking to false -#}
2{%- set enable_thinking = false -%}<|think|> token is never injected into the system prompt, so the model always responds directly without a reasoning/thinking preamble.1vllm serve tuandunghcmut/gemma-4-E4B-it-text-only \
2 --served-model-name gemma-4-E4B-it-text-only-non-thinking \
3 --tokenizer tuandunghcmut/gemma-4-E4B-it-text-only-non-thinking \
4 --max-model-len 32768 \
5 --dtype bfloat161from openai import OpenAI
2
3client = OpenAI(base_url="http://localhost:8000/v1", api_key="dummy")
4
5response = client.chat.completions.create(
6 model="gemma-4-E4B-it-text-only-non-thinking",
7 messages=[
8 {"role": "user", "content": "What is the capital of France?"}
9 ],
10)
11print(response.choices[0].message.content)
12# ➜ Direct answer, no thinking preamble1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4# Load weights from source, tokenizer (with non-thinking template) from this repo
5model = AutoModelForCausalLM.from_pretrained(
6 "tuandunghcmut/gemma-4-E4B-it-text-only",
7 dtype=torch.bfloat16,
8 device_map="auto",
9)
10tok = AutoTokenizer.from_pretrained(
11 "tuandunghcmut/gemma-4-E4B-it-text-only-non-thinking"
12)
13
14messages = [{"role": "user", "content": "What is the capital of France?"}]
15
16# enable_thinking=True is silently ignored — template always uses non-thinking
17prompt = tok.apply_chat_template(
18 messages, tokenize=False, add_generation_prompt=True, enable_thinking=True
19)
20
21inputs = tok(prompt, return_tensors="pt").to(model.device)
22out = model.generate(**inputs, max_new_tokens=200)
23print(tok.decode(out[0], skip_special_tokens=True))| Scenario | Problem | Solution |
|---|---|---|
| vLLM / llama.cpp serving | No per-request enable_thinking toggle | Use --tokenizer pointing here |
| OpenAI API clients | Can't pass custom template vars | Template forces non-thinking always |
| Batched inference | Some callers accidentally pass enable_thinking=True | Template override makes it safe |
| Latency-sensitive apps | Don't want thinking overhead | No thinking tokens = faster TTFT |
| Caller code | gemma-4-E4B-it-text-only | this repo |
|---|---|---|
enable_thinking=True | ✅ thinking mode | ❌ forced non-thinking |
enable_thinking=False | ✅ non-thinking | ✅ non-thinking |
| no flag (default) | ✅ non-thinking | ✅ non-thinking |