Views
No views yet
transformers library as follows:1import json
2import torch
3from transformers import AutoTokenizer, AutoModelForCausalLM
4
5model_id = "yanolja/YanoljaNEXT-Rosetta-20B"
6model = AutoModelForCausalLM.from_pretrained(
7 model_id,
8 dtype=torch.bfloat16,
9 device_map="auto",
10 max_memory={0: "45GB"},
11)
12tokenizer = AutoTokenizer.from_pretrained(model_id)
13
14target_language = "Korean"
15context = {
16 "context": "Simple introduction about a tech company.",
17 "tone": "Informative and helpful",
18 "glossary": {
19 "Yanolja NEXT": "야놀자넥스트",
20 "travel industry": "여행 산업",
21 }
22}
23
24system = [f"Translate the user's text to {target_language}."]
25for key, value in context.items():
26 key_pascal = key.capitalize()
27 if isinstance(value, dict):
28 system.append(f"{key_pascal}:")
29 for f, t in value.items():
30 system.append(f"- {f} -> {t}")
31 else:
32 system.append(f"{key_pascal}: {value}")
33
34system.append("Provide the final translation immediately without any other text.")
35
36source = {
37 "company_name": "Yanolja NEXT",
38 "description": "Yanolja NEXT is a company that provides cutting-edge "
39 "technology for the global travel industry.",
40}
41
42messages = [
43 {"role": "system", "content": "\n".join(system)},
44 {"role": "user", "content": json.dumps(source, ensure_ascii=False)},
45]
46
47prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
48print(prompt)
49# <|start|>instruction<|message|>Translate the user's text to Korean.
50# Context: Simple introduction about a tech company.
51# Tone: Informative and helpful
52# Glossary:
53# - Yanolja NEXT -> 야놀자넥스트
54# - travel industry -> 여행 산업
55# Provide the final translation immediately without any other text.<|end|><|start|>source<|message|>{"company_name": "Yanolja NEXT", "description": "Yanolja NEXT is a company that provides global cutting-edge technology for the travel industry."}<|end|><|start|>translation<|channel|>final<|message|>
56
57inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
58input_length = inputs["input_ids"].shape[1]
59
60with torch.inference_mode():
61 outputs = model.generate(
62 **inputs,
63 max_new_tokens=64,
64 )
65
66generated_tokens = outputs[0][input_length:]
67translation = tokenizer.decode(generated_tokens, skip_special_tokens=True)
68
69print(json.dumps(json.loads(translation), indent=2, ensure_ascii=False))
70
71# {
72# "company_name": "야놀자넥스트",
73# "description": "야놀자넥스트는 글로벌 여행 산업에 최첨단 기술을 제공하는 기업입니다."
74# }| Language | Portion (%) | Language | Portion (%) |
|---|---|---|---|
| Korean | 24.2 | French | 2.8 |
| English | 16.2 | German | 2.5 |
| Japanese | 5.8 | Russian | 2.4 |
| Italian | 5.3 | Arabic | 2.3 |
| Chinese | 4.4 | Other | 30.2 |
| Spanish | 3.9 |
| Model | CHrF++ Score (WMT24++) |
|---|---|
| yanolja/YanoljaNEXT-Rosetta-20B | 33.87 |
| google/gemini-2.0-flash-001 | 33.81 |
| openai/gpt-oss-120b | 31.51 |
| yanolja/YanoljaNEXT-Rosetta-4B | 31.31 |
| openai/gpt-4.1-nano | 31.15 |
| Qwen/Qwen3-235B-A22B-Instruct-2507-FP8 | 31.02 |
| openai/gpt-oss-20b | 30.56 |
| google/gemma-3-27b-it | 30.05 |
| google/gemma-3-4b-pt | 27.53 |
openai/gpt-oss-20b. Please consult the official Apache 2.0 license terms for detailed usage guidelines.@misc{yanolja2025yanoljanextrosetta,
author = {Yanolja NEXT Co., Ltd.},
title = {YanoljaNEXT-Rosetta-20B},
year = {2025},
publisher = {Hugging Face},
journal = {Hugging Face repository},
howpublished = {\\url{https://huggingface.co/yanolja/YanoljaNEXT-Rosetta-20B}}
}@misc{openai2025gptoss120bgptoss20bmodel,
title={gpt-oss-120b & gpt-oss-20b Model Card},
author={OpenAI},
year={2025},
eprint={2508.10925},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2508.10925},
}
@misc{aihub,
author = {National Information Society Agency (NIA)},
title = {AI-Hub: AI Integrated Platform},
year = {2025},
publisher = {National Information Society Agency},
howpublished = {\\url{https://aihub.or.kr}}
}
@article{europarl,
author = {Koehn, Philipp},
title = {Europarl: A Parallel Corpus for Statistical Machine Translation},
journal = {MT Summit},
year = {2005},
pages = {79--86}
}