https://huggingface.co/google/gemma-3-27b-it
google/gemma-3-27b-it · Hugging Face
This repository is publicly accessible, but you have to accept the conditions to access its files and content. To access Gemma on Hugging Face, you’re required to review and agree to Google’s usage license. To do this, please ensure you’re logged in
huggingface.co
생성형 AI 모델로 질문 답변, 생성 작업에 괜찮은 모델이 3월에 출시했었는데 이것저것 돌려보다 image to text에서 성능이 괜찮은 것 같아 기록합니다.
Gemma3는 140개 넘는 언어를 지원해 주고 멀티모달 기능이 있습니다.

https://ai.google.dev/gemma/docs/core?hl=ko
Gemma3 모델 각 크기별 필요한 대략적인 GPU, TPU 메모리 사항입니다.
저는 H100 80GB 머신으로 27B 16비트 모델 사용했는데, 사실상 거의 60GB는 쓰이더라구요.
- Gemma3 사용 예시
(transformers 4.50.0 이상 필요)
$ pip install -U transformers
!huggingface-cli login --token="자신의 토큰 입력"
from transformers import pipeline
import torch
pipe = pipeline(
"image-text-to-text",
model="google/gemma-3-27b-it",
device="cuda",
torch_dtype=torch.bfloat16
)
import requests
from PIL import Image
url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/0052a70beed5bf71b92610a43a52df6d286cd5f3/diffusers/rabbit.jpg"
image = Image.open(requests.get(url, stream=True).raw)
messages = [
{
"role": "system",
"content": [{"type": "text", "text": "You are a helpful assistant."}]
},
{
"role": "user",
"content": [
{"type": "image", "image": image},
{"type": "text", "text": "이미지에 대해 설명해줘"}
]
}
]
output = pipe(text=messages, max_new_tokens=200)
print(output[0]["generated_text"][-1]["content"])

이런 토끼 이미지가 받아지고요.

이렇게 text화 해줍니다.
이전에 llama3.2 기반으로 한 것보다 성능 좋은 것 같습니다.
RAG 테스트 위해 벡터 DB에 있는 데이터에 대한 설명을 요구했는데, llama3.3 70B에 비해 Gemma3는 추론성향이 강한 것 같더라고요.
멀티모달엔 Gemma3, RAG엔 아직 llama3.3 쓰려고요.
Llama4는 언제 나올까요
'AI > LLM' 카테고리의 다른 글
| QWQ vs Llama3.3 Ollama 기반 Agentic RAG 해보기 (0) | 2025.04.09 |
|---|---|
| PyMuPDF4LLM vs PyMuPDFLoader(PDF loader 비교) (0) | 2025.04.04 |
| Qwen2.5-VL-32B 모델로 image to text(이미지로 텍스트 생성) 해보기(Gemma3 비교) (0) | 2025.04.03 |
| Qwen2.5-VL-32B 모델로 OCR, 질문 답 해보기(LLM OCR) (0) | 2025.04.02 |
| SmolDocling으로 OCR 하는 방법 및 후기(PyMuPDFLoader markdown 비교) (1) | 2025.04.01 |