brildev7's picture
Update README.md
f1be953 verified
---
language:
- en
- ko
library_name: peft
tags:
- translation
- gemma
base_model: google/gemma-2b
---
# Model Card for Model ID
## Model Details
### Model Description
- **Developed by:** [Kang Seok Ju]
- **Contact:** [brildev7@gmail.com]
## Training Details
### Training Data
https://huggingface.co/datasets/traintogpb/aihub-koen-translation-integrated-tiny-100k
# Inference Examples
```
import os
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
from peft import PeftModel
model_id = "google/gemma-2b"
peft_model_id = "brildev7/gemma-2b-translation-enko-sft-qlora"
quantization_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_compute_dtype=torch.float16,
bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=False
)
model = AutoModelForCausalLM.from_pretrained(
model_id,
quantization_config=quantization_config,
torch_dtype=torch.float16,
attn_implementation="flash_attention_2",
token=os.environ['HF_TOKEN'],
device_map="auto"
)
model = PeftModel.from_pretrained(model, peft_model_id)
tokenizer = AutoTokenizer.from_pretrained(peft_model_id)
tokenizer.pad_token_id = tokenizer.eos_token_id
# example
sentences = "Is it safe to drink milk and eat chicken?"
texts = prompt_template.format(sentences)
inputs = tokenizer(texts, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=1024)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
- 우유를 마시고, 닭고기를 먹으면 안 됩니까?
# example
sentences = "What precautions to take during the bird flu outbreak"
texts = prompt_template.format(sentences)
inputs = tokenizer(texts, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=1024)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
- 바이러스 플루 발생 중 취해야 할 예방 조치
```