Model Card for Model ID

Model Details

Model Description

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 Examples
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

Adapter
(4)
this model