Views
No views yet
transformers library:1import transformers
2from transformers import AutoTokenizer, AutoModelForCausalLM
3
4# Load Model and Tokenizer
5model_name = "PrompTartLAB/gemma2_2B_PTT_en_ko"
6model = AutoModelForCausalLM.from_pretrained(
7 model_name,
8 torch_dtype="auto",
9 device_map="auto",
10)
11tokenizer = AutoTokenizer.from_pretrained(model_name)
12
13# Example sentence
14text = "The model was fine-tuned using knowledge distillation techniques. The training dataset was created using a collaborative multi-agent framework powered by large language models."
15prompt = f"Translate input sentence to Korean \n### Input: {text} \n### Translated:"
16
17# Tokenize and generate translation
18input_ids = tokenizer(prompt, return_tensors="pt").to(model.device)
19outputs = model.generate(**input_ids, max_new_tokens=1024)
20out_message = tokenizer.decode(outputs[0][len(input_ids["input_ids"][0]):], skip_special_tokens=True)
21
22# " 모델은 지식 증류 기법(knowledge distillation techniques)을 사용하여 훈련되었습니다. 훈련 데이터셋은 대형 언어 모델(large language models)에 의해 구동되는 협력형 다중 에이전트 프레임워크(collaborative multi-agent framework)를 사용하여 생성되었습니다."
231@inproceedings{jiyoon-etal-2024-efficient,
2 title = "Efficient Technical Term Translation: A Knowledge Distillation Approach for Parenthetical Terminology Translation",
3 author = "Jiyoon, Myung and
4 Park, Jihyeon and
5 Son, Jungki and
6 Lee, Kyungro and
7 Han, Joohyung",
8 editor = "Haddow, Barry and
9 Kocmi, Tom and
10 Koehn, Philipp and
11 Monz, Christof",
12 booktitle = "Proceedings of the Ninth Conference on Machine Translation",
13 month = nov,
14 year = "2024",
15 address = "Miami, Florida, USA",
16 publisher = "Association for Computational Linguistics",
17 url = "https://aclanthology.org/2024.wmt-1.129",
18 doi = "10.18653/v1/2024.wmt-1.129",
19 pages = "1410--1427",
20 abstract = "This paper addresses the challenge of accurately translating technical terms, which are crucial for clear communication in specialized fields. We introduce the Parenthetical Terminology Translation (PTT) task, designed to mitigate potential inaccuracies by displaying the original term in parentheses alongside its translation. To implement this approach, we generated a representative PTT dataset using a collaborative approach with large language models and applied knowledge distillation to fine-tune traditional Neural Machine Translation (NMT) models and small-sized Large Language Models (sLMs). Additionally, we developed a novel evaluation metric to assess both overall translation accuracy and the correct parenthetical presentation of terms. Our findings indicate that sLMs did not consistently outperform NMT models, with fine-tuning proving more effective than few-shot prompting, particularly in models with continued pre-training in the target language. These insights contribute to the advancement of more reliable terminology translation methodologies.",
21}