Views
No views yet
google/gemma-3n-E2B-it 를 한국어 instruction 데이터(KoAlpaca v1.1a)로 QLoRA 추가 학습한 모델입니다.1from transformers import AutoProcessor, AutoModelForImageTextToText
2import torch
3
4model_id = "ION-Communications/gemma-3n-E2B-ko"
5
6processor = AutoProcessor.from_pretrained(model_id)
7model = AutoModelForImageTextToText.from_pretrained(
8 model_id,
9 dtype=torch.bfloat16,
10 device_map="auto",
11)
12
13messages = [
14 {
15 "role": "user",
16 "content": [
17 {"type": "text", "text": "한국의 수도는?"}
18 ],
19 }
20]
21
22input_ids = processor.apply_chat_template(
23 messages,
24 add_generation_prompt=True,
25 tokenize=True,
26 return_tensors="pt",
27).to(model.device)
28
29out = model.generate(
30 input_ids=input_ids,
31 max_new_tokens=128,
32)
33
34print(processor.decode(out[0], skip_special_tokens=True))
35