Gemma 3 12B

Gemma

Google · 12B · كثيف

نموذج Gemma متعدّد الوسائط بسياق ١٢٨ ألف رمز. تعرّف على ما إذا كان كرت شاشتك أو جهاز الماك قادرًا على تشغيل Gemma 3 12B محليًا — 6.7 جيجابايت كحد أدنى، و11.2 جيجابايت موصى بها.

كيف تستخدم Gemma 3 12B في Transformers

حمّل Gemma 3 12B في بايثون عبر مكتبة Transformers من HuggingFace. هذه الأوزان الكاملة غير المكمَّمة، فتحتاج ذاكرة أكبر من ملفات GGUF.

عبر pipeline — الطريقة الأسهل

pip install -U transformers
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("image-text-to-text", model="google/gemma-3-12b-it")
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)

تحميل النموذج مباشرة

pip install -U transformers
# Load model directly
from transformers import AutoProcessor, AutoModelForMultimodalLM

processor = AutoProcessor.from_pretrained("google/gemma-3-12b-it")
model = AutoModelForMultimodalLM.from_pretrained("google/gemma-3-12b-it", 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]:]))

التوثيق الرسمي: Transformers

كيف تستخدم Gemma 3 12B في llama.cpp

يحمّل llama.cpp ملف Gemma 3 12B من HuggingFace مباشرة ويشغّله، إمّا خادمًا متوافقًا مع OpenAI بواجهة ويب أو في الطرفية. اختر مستوى الـ Quantization من القائمة، وتتحدّث الأوامر معه.

ملف GGUF من unsloth/gemma-3-12b-it-GGUF

التثبيت على macOS وLinux

curl -LsSf https://llama.app/install.sh | sh
# Start a local OpenAI-compatible server with a web UI:
llama serve -hf unsloth/gemma-3-12b-it-GGUF:Q4_K_M
# Run inference directly in the terminal:
llama cli -hf unsloth/gemma-3-12b-it-GGUF:Q4_K_M

التثبيت عبر WinGet على Windows

winget install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama serve -hf unsloth/gemma-3-12b-it-GGUF:Q4_K_M
# Run inference directly in the terminal:
llama cli -hf unsloth/gemma-3-12b-it-GGUF:Q4_K_M

نسخة جاهزة من صفحة الإصدارات

# Download pre-built binary from:
# https://github.com/ggerganov/llama.cpp/releases
# Start a local OpenAI-compatible server with a web UI:
./llama-server -hf unsloth/gemma-3-12b-it-GGUF:Q4_K_M
# Run inference directly in the terminal:
./llama-cli -hf unsloth/gemma-3-12b-it-GGUF:Q4_K_M

البناء من الكود المصدري

git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
cmake -B build
cmake --build build -j --target llama-server llama-cli
# Start a local OpenAI-compatible server with a web UI:
./build/bin/llama-server -hf unsloth/gemma-3-12b-it-GGUF:Q4_K_M
# Run inference directly in the terminal:
./build/bin/llama-cli -hf unsloth/gemma-3-12b-it-GGUF:Q4_K_M

عبر Docker

docker model run hf.co/unsloth/gemma-3-12b-it-GGUF:Q4_K_M

التوثيق الرسمي: llama.cpp

كيف تستخدم Gemma 3 12B في Ollama

ينزّل Ollama النموذج ويفتح محادثة محلية بأمر واحد. اختر مستوى الـ Quantization من القائمة، وتتحدّث الأوامر معه.

ملف GGUF من unsloth/gemma-3-12b-it-GGUF

من مكتبة Ollama الرسمية

ollama run gemma3:12b

من ملف GGUF على HuggingFace

ollama run hf.co/unsloth/gemma-3-12b-it-GGUF:Q4_K_M

التوثيق الرسمي: Ollama

كيف تستخدم Gemma 3 12B في node-llama-cpp

شغّل Gemma 3 12B من Node.js بلا تثبيت مسبق. اختر مستوى الـ Quantization من القائمة، وتتحدّث الأوامر معه.

ملف GGUF من unsloth/gemma-3-12b-it-GGUF

محادثة مع النموذج

npx -y node-llama-cpp chat hf:unsloth/gemma-3-12b-it-GGUF:Q4_K_M

قدّر توافق النموذج مع جهازك

npx -y node-llama-cpp inspect estimate hf:unsloth/gemma-3-12b-it-GGUF:Q4_K_M

التوثيق الرسمي: node-llama-cpp

كيف تستخدم Gemma 3 12B في Docker Model Runner

يشغّل Docker Desktop النموذج محليًا ويتيحه عبر واجهة متوافقة مع OpenAI. اختر مستوى الـ Quantization من القائمة، وتتحدّث الأوامر معه.

ملف GGUF من unsloth/gemma-3-12b-it-GGUF

شغّل النموذج

docker model run hf.co/unsloth/gemma-3-12b-it-GGUF:Q4_K_M

التوثيق الرسمي: Docker Model Runner

كيف تستخدم Gemma 3 12B في LocalAI

LocalAI خادم محلي متوافق مع OpenAI. استبدل {{GGUF_FILE}} باسم ملف GGUF الذي تريده من المستودع unsloth/gemma-3-12b-it-GGUF.

التثبيت من ملف تنفيذي

curl https://localai.io/install.sh | sh
# Load and run the model:
local-ai run huggingface://unsloth/gemma-3-12b-it-GGUF/{{GGUF_FILE}}

عبر صور Docker

# Pull the image:
docker pull localai/localai:latest-cpu
# Load and run the model:
docker run -p 8080:8080 --name localai -v $PWD/models:/build/models localai/localai:latest-cpu huggingface://unsloth/gemma-3-12b-it-GGUF/{{GGUF_FILE}}

التوثيق الرسمي: LocalAI

كيف تستخدم Gemma 3 12B في Lemonade

Lemonade خادم محلي من AMD يعمل على المعالجات وكروت الشاشة. اختر مستوى الـ Quantization من القائمة، وتتحدّث الأوامر معه.

ملف GGUF من unsloth/gemma-3-12b-it-GGUF

نزّل النموذج

# Download Lemonade from https://lemonade-server.ai/
lemonade pull unsloth/gemma-3-12b-it-GGUF:Q4_K_M

شغّل النموذج وحاوره

lemonade run user.gemma-3-12b-it-GGUF-Q4_K_M

اعرض كل النماذج المتاحة

lemonade list

التوثيق الرسمي: Lemonade

أوامر التشغيلHuggingFaceOllamaLM Studio
2025-03سياق 128K

مستويات الـ Quantization

Quantizationالبتاتالذاكرةالجودةالحالة
Q2_K24.3GBمنخفضة—
Q3_K_M35.9GBمتوسطة—
Q4_K_M46.6GBجيدة—
Q5_K_M58.2GBجيدة—
Q6_K69.7GBممتازة—
Q8_0812.8GBممتازة—
F161625.1GBبلا فقد—

الأرقام تشمل الأوزان وذاكرة KV عند طول سياق 2K توكن. غيّر طول السياق من لوحة جهازك لترى أثره على الذاكرة والسرعة.

التطبيقات

شغّل Gemma 3 12B داخل أدوات البرمجة التي تعمل بالذكاء الاصطناعي — يشغّل الأمر خادم Ollama على جهازك، يحمّل النموذج، ثم يفتح الأداة موصولة به.

  • Claude Code

    وكيل البرمجة من Anthropic، يعمل في الطرفية وداخل المحرّر

    ollama launch claude --model gemma3:12b
  • OpenCode

    وكيل برمجة مفتوح المصدر يعمل في الطرفية داخل مستودعك

    ollama launch opencode --model gemma3:12b
  • Codex

    وكيل البرمجة من OpenAI في سطر الأوامر

    ollama launch codex --model gemma3:12b
  • Droid

    وكيل البرمجة من Factory، للمهام الطويلة عبر عدّة ملفات

    ollama launch droid --model gemma3:12b
  • Hermes Agent

    وكيل برمجة مفتوح من Nous Research، بذاكرة تمتد عبر الجلسات

    ollama launch hermes --model gemma3:12b
  • OpenClaw

    وكيل مفتوح المصدر يشغّل المهام على جهازك بلا خدمة سحابية

    ollama launch openclaw --model gemma3:12b

تحتاج Ollama والأداة نفسها مثبَّتين. إن لم تكن الأداة مثبّتة، يرشدك الأمر إلى طريقة تثبيتها. اكتب ollama launch وحده لاختيار الأداة من قائمة.

عن هذا النموذج

الوصف الرسمي كما نشرته الجهة المطوِّرة، بلغته الأصلية.

Google Gemma 3 logo

This model requires Ollama 0.6 or later. Download Ollama

Gemma is a lightweight, family of models from Google built on Gemini technology. The Gemma 3 models are multimodal—processing text and images—and feature a 128K context window with support for over 140 languages. Available in 270M, 1B, 4B, 12B, and 27B parameter sizes, they excel in tasks like question answering, summarization, and reasoning, while their compact design allows deployment on resource-limited devices.

Models

Text

270M parameter model (32k context window)

ollama run gemma3:270m

1B parameter model (32k context window)

ollama run gemma3:1b 

Multimodal (Vision)

4B parameter model (128k context window)

ollama run gemma3:4b

12B parameter model (128k context window)

ollama run gemma3:12b

27B parameter model (128k context window)

ollama run gemma3:27b

Quantization aware trained models (QAT)

The quantization aware trained Gemma 3 models preserves similar quality as half precision models (BF16) while maintaining a lower memory footprint (3x less compared to non-quantized models).

1B parameter model

ollama run gemma3:1b-it-qat

4B parameter model

ollama run gemma3:4b-it-qat

12B parameter model

ollama run gemma3:12b-it-qat

27B parameter model

ollama run gemma3:27b-it-qat

Evaluation

Chatbot Arena ELO Score

Benchmark Results

Gemma 3 270M

Benchmark n-shot Gemma 3 270m instruction tuned
HellaSwag 0-shot 37.7
PIQA 0-shot 66.2
ARC-c 0-shot 28.2
WinoGrande 0-shot 52.3
BIG-Bench Hard few-shot 26.7
IF Eval 0-shot 51.2

These models were evaluated against a large collection of different datasets and metrics to cover different aspects of text generation:

Reasoning, logic and code capabilities

Benchmark Metric Gemma 3 PT 1B Gemma 3 PT 4B Gemma 3 PT 12B Gemma 3 PT 27B
HellaSwag 10-shot 62.3 77.2 84.2 85.6
BoolQ 0-shot 63.2 72.3 78.8 82.4
PIQA 0-shot 73.8 79.6 81.8 83.3
SocialIQA 0-shot 48.9 51.9 53.4 54.9
TriviaQA 5-shot 39.8 65.8 78.2 85.5
Natural Questions 5-shot 9.48 20.0 31.4 36.1
ARC-c 25-shot 38.4 56.2 68.9 70.6
ARC-e 0-shot 73.0 82.4 88.3 89.0
WinoGrande 5-shot 58.2 64.7 74.3 78.8
BIG-Bench Hard 28.4 50.9 72.6 77.7
DROP 3-shot, F1 42.4 60.1 72.2 77.2
AGIEval 3-5-shot 22.2 42.1 57.4 66.2
MMLU 5-shot, top-1 26.5 59.6 74.5 78.6
MATH 4-shot – 24.2 43.3 50.0
GSM8K 5-shot, maj@1 1.36 38.4 71.0 82.6
GPQA 9.38 15.0 25.4 24.3
MMLU (Pro) 5-shot 11.2 23.7 40.8 43.9
MBPP 3-shot 9.80 46.0 60.4 65.6
HumanEval pass@1 6.10 36.0 45.7 48.8
MMLU (Pro COT) 5-shot 9.7 NaN NaN NaN

Multilingual capabilities

Benchmark Gemma 3 PT 1B Gemma 3 PT 4B Gemma 3 PT 12B Gemma 3 PT 27B
MGSM 2.04 34.7 64.3 74.3
Global-MMLU-Lite 24.9 57.0 69.4 75.7
Belebele 26.6 59.4 78.0 –
WMT24++ (ChrF) 36.7 48.4 53.9 55.7
FloRes 29.5 39.2 46.0 48.8
XL-Sum 4.82 8.55 12.2 14.9
XQuAD (all) 43.9 68.0 74.5 76.8

Multimodal capabilities

Benchmark Gemma 3 PT 4B Gemma 3 PT 12B Gemma 3 PT 27B
COCOcap 102 111 116
DocVQA (val) 72.8 82.3 85.6
InfoVQA (val) 44.1 54.8 59.4
MMMU (pt) 39.2 50.3 56.1
TextVQA (val) 58.9 66.5 68.6
RealWorldQA 45.5 52.2 53.9
ReMI 27.3 38.5 44.8
AI2D 63.2 75.2 79.0
ChartQA 45.4 60.9 63.8
ChartQA (augmented) 81.8 88.5 88.7
VQAv2 – – –
BLINK 38.0 35.9 39.6
OKVQA 51.0 58.7 60.2
TallyQA 42.5 51.8 54.3
SpatialSense VQA 50.9 60.0 59.4
CountBenchQA 26.1 17.8 68.0

Reference

Gemma Terms of Use

أسئلة شائعة عن تشغيل Gemma 3 12B محليًا

هل أستطيع تشغيل Gemma 3 12B على جهازي؟
يحتاج Gemma 3 12B إلى 6.7 جيجابايت من الذاكرة كحد أدنى، والموصى به 11.2 جيجابايت. يكفي أن تفتح هذه الصفحة ليُقيَّم النموذج تلقائيًا أمام كرت شاشتك أو جهاز الماك، ثم تشغّله عبر Ollama أو LM Studio أو llama.cpp.
كم يحتاج Gemma 3 12B من الـ VRAM؟
بتكميم Q4_K_M يستهلك Gemma 3 12B نحو 6.6 جيجابايت من ذاكرة الكرت. أما المستويات الأعلى فتحتاج ذاكرة أكبر، والأدنى تناسب الكروت المحدودة مقابل تنازل في الجودة.