Text Generation
Transformers
Safetensors
gemma4_unified
image-text-to-text
fine-tuned
qlora
reasoning
compact-reasoning
gemma-4
conversational
Eval Results (legacy)
Instructions to use kai-os/Grug-12B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kai-os/Grug-12B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kai-os/Grug-12B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("kai-os/Grug-12B") model = AutoModelForMultimodalLM.from_pretrained("kai-os/Grug-12B", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use kai-os/Grug-12B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kai-os/Grug-12B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kai-os/Grug-12B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/kai-os/Grug-12B
- SGLang
How to use kai-os/Grug-12B 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 "kai-os/Grug-12B" \ --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": "kai-os/Grug-12B", "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 "kai-os/Grug-12B" \ --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": "kai-os/Grug-12B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use kai-os/Grug-12B with Docker Model Runner:
docker model run hf.co/kai-os/Grug-12B
| { | |
| "model_name": "Grug-12B", | |
| "base_model": "google/gemma-4-12B-it", | |
| "artifact_type": "merged_transformers_safetensors_model", | |
| "peft_adapter_merged": true, | |
| "teacher_model_for_compact_reasoning": "cyankiwi/Qwen3.6-35B-A3B-AWQ-4bit", | |
| "teacher_runtime": "vllm", | |
| "dataset_counts": { | |
| "normalized_recent_reasoning": 8680, | |
| "selected_verbose": 6144, | |
| "compact_raw": 6144, | |
| "compact_verified": 5740, | |
| "compact_rejected": 404, | |
| "packed_train": 5166, | |
| "packed_validation": 287, | |
| "packed_test": 287 | |
| }, | |
| "verified_source_counts": { | |
| "hotdogs/uka-glm-5.2": 1617, | |
| "Scale-or-Reason/general-reasoning-ift-pairs": 1305, | |
| "samcheng0/lumia-reasoning-sft-v1": 1103, | |
| "HSH-Intelligence/verified-math-reasoning-3k": 672, | |
| "kd13/CodeDebug-Instruct-v2-Reasoning": 600, | |
| "Madarabr/cortex-adaptive-thinking": 300, | |
| "CL-From-Nothing/code_rose_initial_1_7B_SFT_10K_rollouts_Qwen3-4B-Thinking-2507_k12_t0.7_maxtok12288": 143 | |
| }, | |
| "training": { | |
| "method": "QLoRA completion-only SFT", | |
| "quantization": "4-bit NF4, BF16 compute", | |
| "max_seq_length": 6144, | |
| "max_steps": 100, | |
| "batch_size": 1, | |
| "gradient_accumulation_steps": 16, | |
| "learning_rate": 0.00008, | |
| "lora_r": 16, | |
| "lora_alpha": 32, | |
| "lora_dropout": 0.05, | |
| "target_modules": ["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"], | |
| "final_eval_loss": 0.8895471096038818, | |
| "train_runtime_seconds": 2121 | |
| }, | |
| "local_eval": { | |
| "name": "EOS-only math proxy eval", | |
| "generation_mode": "eos_only", | |
| "max_new_tokens": null, | |
| "timeout_seconds": 900, | |
| "rows": 36, | |
| "base": { | |
| "total_generated_tokens": 8227, | |
| "avg_generated_tokens": 228.52777777777777, | |
| "proxy_accuracy": 0.9166666666666666, | |
| "contains_expected_rate": 0.9166666666666666, | |
| "numeric_last_match_rate": 0.8611111111111112 | |
| }, | |
| "adapter": { | |
| "total_generated_tokens": 2482, | |
| "avg_generated_tokens": 68.94444444444444, | |
| "proxy_accuracy": 1.0, | |
| "contains_expected_rate": 1.0, | |
| "numeric_last_match_rate": 1.0 | |
| } | |
| }, | |
| "acknowledgement": "Thanks to Lambda (https://lambda.com/), the inference provider, for compute credits." | |
| } | |