한국어/영어 번역용으로 훈련한 모형입니다. llama3.2의 경우 한국어-영어 번역에 오류가 잦아 별도로 훈련시켰습니다.
성능향상을 위해 추가훈련을 진행했습니다.
아래 사항에 주의해 주세요:
이 모델은 문장단위 번역으로 훈련시켰습니다. 따라서 긴 텍스트의 경우 번역에 오류가 있을 수 있습니다. 또한 인풋 텍스트에 줄바꿈이 있을 경우 결과물을 추출하는데 복잡해질 수 있습니다.
이 모델의 주 용도는 금융/경영 관련으로 상정하고 훈련했습니다.
총 47만여개의 금융 관련 문장 페어를 사용하여 훈련하였습니다. 추가로 약 50여만개의 일반 문장을 사용하였습니다.
이하 모델카드는 시간이 나는대로 추가하겠습니다.
주의할 몇몇 점
숫자 등을 마음대로 생성하는 경우가 있어, "퍼센트, 금액, 숫자는 본문의 숫자를 그대로 사용하세요."" 등의 프롬프트를 추가하는 등을 고려해 주시기 바랍니다.
영한 번역은 성능이 상당히 부족합니다.
사용에 있어, 아래 코드를 참고해주세요:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_path = "kwoncho/Llama-3.2-3B-KO-EN-Translation"
model = AutoModelForCausalLM.from_pretrained(
model_path,
torch_dtype=torch.bfloat16,
device_map="cuda:0",
)
tokenizer = AutoTokenizer.from_pretrained(model_path)
한국어 -> 영어의 경우
test_input = "삼성생명이 프랑스의 인프라 투자 전문 운용사의 2대 주주로 올랐다."
prompt = f"""
### Instruction:
주어진 텍스트를 영어로 번역하세요.
### Input:
{test_input}
### Output:
"""
영어 -> 한국어의 경우
test_input = """Retailers were “incentivising via discounts and different forms of promotions” for those at the lower end of the income spectrum while also “trying to grab higher-income individuals to make purchases during this wider window”, he said."""
prompt = f"""
### Instruction:
주어진 텍스트를 한국어로 번역하세요.
### Input:
{test_input}
### Output:
"""
input_ids = tokenizer.encode(prompt, return_tensors="pt").to(model.device)
output = model.generate(
input_ids,
max_new_tokens=200,
temperature=0.1,
top_p=1,
repetition_penalty=1.3,
do_sample=True,
eos_token_id=tokenizer.eos_token_id
)
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
outputs = generated_text.split("Output:")[1].strip().split('\n')[0].strip()
print(outputs) ### 한영 번역의 경우
"Samsung Life Insurance has become the second-largest shareholder of a French infrastructure investment management company."
print(outputs) ### 영한 번역의 경우
"그는 "소매상들은 소득 하위층을 대상으로 할부, 할인 등 다양한 형태의 인센티브를 제공하면서도 상위 계층의 고객들을 끌어모으려 하고 있다"고 말했다."
Model Details
Model Description
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
Developed by: Hyunkwon Cho (Kwon Cho)
Funded by [optional]: [More Information Needed]
Shared by [optional]: [More Information Needed]
Model type: [More Information Needed]
Language(s) (NLP): [More Information Needed]
License: [More Information Needed]
Finetuned from model [optional]: [More Information Needed]
Model Sources [optional]
Repository: [More Information Needed]
Paper [optional]: [More Information Needed]
Demo [optional]: [More Information Needed]
Uses
Direct Use
[More Information Needed]
Downstream Use [optional]
[More Information Needed]
Out-of-Scope Use
[More Information Needed]
Bias, Risks, and Limitations
[More Information Needed]
Recommendations
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.