Gemma 3 12B — google/gemma-3-12b-it 모델 카드
Gemma 3 12B — google/gemma-3-12b-it 모델 카드
gemma-3-12b-it는 12B 지시 튜닝 모델로, 메모리가 제한된 환경(노트북·데스크톱·자체 클라우드)에서 돌리기 좋은 크기예요. 텍스트와 이미지를 입력받아 텍스트를 생성하는 멀티모달 모델이고 128K 토큰 컨텍스트를 지원해요.
훈련 데이터
12B 모델은 12T 토큰으로 훈련했어요. 140개 이상 언어의 웹 문서, 코드, 수학, 이미지 데이터를 사용했고, CSAM 필터링·민감 데이터 필터링·품질·안전 필터링을 여러 단계로 적용했어요.
transformers로 실행하기
transformers 4.50.0부터 Gemma 3를 지원해요.
# pip install accelerate
from transformers import AutoProcessor, Gemma3ForConditionalGeneration
import torch
model_id = "google/gemma-3-12b-it"
model = Gemma3ForConditionalGeneration.from_pretrained(model_id, device_map="auto").eval()
processor = AutoProcessor.from_pretrained(model_id)
messages = [
{"role": "system", "content": [{"type": "text", "text": "You are a helpful assistant."}]},
{"role": "user", "content": [
{"type": "image", "image": "https://.../bee.jpg"},
{"type": "text", "text": "Describe this image in detail."}
]},
]
inputs = processor.apply_chat_template(
messages, add_generation_prompt=True, tokenize=True,
return_dict=True, return_tensors="pt",
).to(model.device, dtype=torch.bfloat16)
with torch.inference_mode():
generation = model.generate(**inputs, max_new_tokens=100, do_sample=False)
decoded = processor.decode(generation[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True)
print(decoded)
벤치마크 (PT 12B)
- HellaSwag: 84.2, BoolQ: 78.8, TriviaQA: 78.2, BIG-Bench Hard: 72.6, DROP: 72.2
활용
이미지 분석, 요약, 질문 답변, 추론 같은 텍스트 생성·이미지 이해 작업에 널리 쓰여요. 지시 튜닝 모델은 채팅 템플릿을 거쳐 입력을 처리해야 해요.