Model Card for Model ID
Model Details
Model Description
- Developed by: [Kang Seok Ju]
- Contact: [[email protected]]
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-1.1-7b-it"
peft_model_id = "brildev7/gemma-1.1-7b-it-translation-koen-sft-qlora"
quantization_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_compute_dtype=torch.float16,
bnb_4bit_quant_type="nf4"
)
model = AutoModelForCausalLM.from_pretrained(
model_id,
quantization_config=quantization_config,
torch_dtype=torch.float16,
low_cpu_mem_usage=True,
attn_implementation="flash_attention_2",
)
model = PeftModel.from_pretrained(model, peft_model_id)
tokenizer = AutoTokenizer.from_pretrained(peft_model_id)
tokenizer.pad_token_id = tokenizer.eos_token_id
# example
prompt_template = """Translate the following into English:
{}
output:
"""
passage = "๋ฌ์ด ํด๋ฅผ ์์ ํ ๊ฐ๋ฆฌ๋ '๊ฐ๊ธฐ์ผ์'์ด ๋ถ๋ฏธ ๋๋ฅ์์ 7๋
๋ง์ ๊ด์ธก๋๋ฉด์ ์ ์ธ๊ณ ์์ต๋ช
์ ๊ด์ฌ์ด ์ง์ค๋๋ค. ๋ฉ์์ฝ์์ ์์ํด ์บ๋๋ค๊น์ง ๋ถ๋ฏธ๋ฅผ ๊ฐ๋ก์ง๋ฅด๋ฉฐ ๋ํ๋ '์ฐ์ฃผ์ผ'๋ฅผ ๋ณด๊ธฐ ์ํด ์ฌ๋๋ค์ ํ๋ ์ผ์ ๋ฉ์ถ๊ณ ํ๋์ ์ฌ๋ ค๋ค๋ดค๋ค. ๊ฐ๊ธฐ์ผ์์ผ๋ก ์ฐฝ์ถ๋ ๊ฒฝ์ ํจ๊ณผ๋ ์์กฐ์์ ์ด๋ฅธ๋ค๋ ๋ถ์์ด ๋์จ๋ค."
prompt = prompt_template.format(passage)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs,
max_new_tokens=1024,
temperature=0.2,
top_p=0.95,
do_sample=True,
use_cache=False)
print(tokenizer.decode(outputs[0]))
- 7 years after the last solar eclipse, when the moon completely covered the sun was observed in North America, tens of millions of people around the world focused their attention. People stopped what they were doing and looked up to watch the 'cosmic show' that appeared across North America, from Mexico to Canada. An analysis showed that the economic effect created by the lunar eclipse was also in the hundreds of billions of won.
# example
prompt_template = """Translate the following into English:
{}
output:
"""
passage = "์ดํ์งธ ํฉ์ฌ ํ์์ด ์ด์ด์ง๋ฉฐ ์์ผ๊ฐ ํ๋ฆฐ ํ๋ฃจ์์ต๋๋ค. ์ค๋๋ ์์ธ ๋์ฌ์ ํฉ์ฌ์ ๊ฐํ ์ข
์ผ ๋ฟ์๊ณ ๋๋ฐ๋น๊น์ง ๋ ์์ต๋๋ค. ๋ด์ผ๋ ๋๊ธฐ ์ค์ ํฉ์ฌ๊ฐ ๋จ์ ๋ฏธ์ธ๋จผ์ง ๋๋๊ฐ ๋๊ฒ ๋ํ๋๊ฒ ์ต๋๋ค."
prompt = prompt_template.format(passage)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs,
max_new_tokens=1024,
temperature=1,
top_p=0.95,
do_sample=True,
use_cache=False)
print(tokenizer.decode(outputs[0]))
- On the second day of the yellow dust, the day was misty with the continuous phenomenon. On this day, downtown Seoul was covered with yellow dust and covered with yellow dust throughout the day. Yellow dust remained from tomorrow, so the fine dust concentration would be high.
- Downloads last month
- 0
Inference API (serverless) does not yet support peft models for this pipeline type.
Model tree for brildev7/gemma-1.1-7b-it-translation-koen-sft-qlora
Base model
google/gemma-1.1-7b-it