Instructions to use OnlyTextLLMs/gemma-4-12B-it-OnlyText with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OnlyTextLLMs/gemma-4-12B-it-OnlyText with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="OnlyTextLLMs/gemma-4-12B-it-OnlyText") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("OnlyTextLLMs/gemma-4-12B-it-OnlyText") model = AutoModelForCausalLM.from_pretrained("OnlyTextLLMs/gemma-4-12B-it-OnlyText", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OnlyTextLLMs/gemma-4-12B-it-OnlyText with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OnlyTextLLMs/gemma-4-12B-it-OnlyText" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OnlyTextLLMs/gemma-4-12B-it-OnlyText", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/OnlyTextLLMs/gemma-4-12B-it-OnlyText
- SGLang
How to use OnlyTextLLMs/gemma-4-12B-it-OnlyText 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 "OnlyTextLLMs/gemma-4-12B-it-OnlyText" \ --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": "OnlyTextLLMs/gemma-4-12B-it-OnlyText", "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 "OnlyTextLLMs/gemma-4-12B-it-OnlyText" \ --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": "OnlyTextLLMs/gemma-4-12B-it-OnlyText", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use OnlyTextLLMs/gemma-4-12B-it-OnlyText with Docker Model Runner:
docker model run hf.co/OnlyTextLLMs/gemma-4-12B-it-OnlyText
Download tokenizer_config.json from OnlyTextLLMs/gemma-4-12B-it-OnlyText: direct link, hf CLI and curl.
- Browser
- Download file 2.9 kB
-
https://huggingface.co/OnlyTextLLMs/gemma-4-12B-it-OnlyText/resolve/main/tokenizer_config.json
- Command line
-
hf download hf://OnlyTextLLMs/gemma-4-12B-it-OnlyText/tokenizer_config.json
-
curl -L -o tokenizer_config.json https://huggingface.co/OnlyTextLLMs/gemma-4-12B-it-OnlyText/resolve/main/tokenizer_config.json
2.9 kB
| { | |
| "backend": "tokenizers", | |
| "bos_token": "<bos>", | |
| "eoc_token": "<channel|>", | |
| "eos_token": "<eos>", | |
| "eot_token": "<turn|>", | |
| "escape_token": "<|\"|>", | |
| "etc_token": "<tool_call|>", | |
| "etd_token": "<tool|>", | |
| "etr_token": "<tool_response|>", | |
| "mask_token": "<mask>", | |
| "model_max_length": 1000000000000000019884624838656, | |
| "pad_token": "<pad>", | |
| "padding_side": "left", | |
| "processor_class": "Gemma4UnifiedProcessor", | |
| "response_schema": { | |
| "properties": { | |
| "content": { | |
| "type": "string" | |
| }, | |
| "role": { | |
| "const": "assistant" | |
| }, | |
| "thinking": { | |
| "type": "string" | |
| }, | |
| "tool_calls": { | |
| "items": { | |
| "properties": { | |
| "function": { | |
| "properties": { | |
| "arguments": { | |
| "additionalProperties": {}, | |
| "type": "object", | |
| "x-parser": "gemma4-tool-call" | |
| }, | |
| "name": { | |
| "type": "string" | |
| } | |
| }, | |
| "type": "object", | |
| "x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})" | |
| }, | |
| "type": { | |
| "const": "function" | |
| } | |
| }, | |
| "type": "object" | |
| }, | |
| "type": "array", | |
| "x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>" | |
| } | |
| }, | |
| "type": "object", | |
| "x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?" | |
| }, | |
| "response_template": { | |
| "defaults": { | |
| "role": "assistant" | |
| }, | |
| "fields": { | |
| "content": { | |
| "close": [ | |
| "<turn|>", | |
| "<|tool_response>", | |
| "<eos>" | |
| ], | |
| "content": "text" | |
| }, | |
| "thinking": { | |
| "close": "<channel|>", | |
| "content": "text", | |
| "open": "<|channel>thought\n" | |
| }, | |
| "tool_calls": { | |
| "close": "<tool_call|>", | |
| "content": "json", | |
| "content_args": { | |
| "string_delims": [ | |
| [ | |
| "<|\"|>", | |
| "<|\"|>" | |
| ] | |
| ], | |
| "unquoted_keys": true | |
| }, | |
| "open_pattern": "<\\|tool_call>call:(?P<name>\\w+)", | |
| "repeats": true, | |
| "transform": { | |
| "function": { | |
| "arguments": "{content}", | |
| "name": "{name}" | |
| }, | |
| "type": "function" | |
| } | |
| } | |
| }, | |
| "start_anchor": [ | |
| "<|turn>model\n", | |
| "<tool_response|>" | |
| ] | |
| }, | |
| "soc_token": "<|channel>", | |
| "sot_token": "<|turn>", | |
| "stc_token": "<|tool_call>", | |
| "std_token": "<|tool>", | |
| "str_token": "<|tool_response>", | |
| "think_token": "<|think|>", | |
| "tokenizer_class": "GemmaTokenizer", | |
| "unk_token": "<unk>", | |
| "added_tokens_decoder": {} | |
| } |