Views
No views yet
google/gemma-3-4b-pt. As it is intended solely for text generation, we have extracted and utilized only the Gemma3ForCausalLM component from the original architecture.yanolja/YanoljaNEXT-Rosetta-4Bgoogle/gemma-3-4b-pttransformers library as follows:1import json
2import torch
3from transformers import AutoTokenizer, AutoModelForCausalLM
4
5model_id = "yanolja/YanoljaNEXT-Rosetta-4B"
6model = AutoModelForCausalLM.from_pretrained(
7 model_id,
8 dtype=torch.bfloat16,
9 device_map="auto",
10 max_memory={0: "23GB"},
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# <bos><start_of_turn>instruction
50# Translate the user's text to Korean.
51# Context: Simple introduction about a tech company.
52# Tone: Informative and helpful
53# Glossary:
54# - Yanolja NEXT -> 야놀자넥스트
55# - travel industry -> 여행 산업
56# Provide the final translation immediately without any other text.<end_of_turn>
57# <start_of_turn>source
58# {"company_name": "Yanolja NEXT", "description": "Yanolja NEXT is a company that provides cutting-edge technology for the global travel industry."}<end_of_turn>
59# <start_of_turn>translation
60
61inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
62input_length = inputs["input_ids"].shape[1]
63
64with torch.inference_mode():
65 outputs = model.generate(
66 **inputs,
67 max_new_tokens=64,
68 )
69
70generated_tokens = outputs[0][input_length:]
71translation = tokenizer.decode(generated_tokens, skip_special_tokens=True)
72
73print(json.dumps(json.loads(translation), indent=2, ensure_ascii=False))
74# {
75# "company_name": "야놀자넥스트",
76# "description": "야놀자넥스트는 글로벌 여행 산업에 최첨단 기술을 제공하는 회사입니다."
77# }| 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-12B | 34.75 |
| 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 |
google/gemma-3-4b-pt. Please consult the official Gemma license terms for detailed usage guidelines.@misc{yanolja2025yanoljanextrosetta,
author = {Yanolja NEXT Co., Ltd.},
title = {YanoljaNEXT-Rosetta-4B},
year = {2025},
publisher = {Hugging Face},
journal = {Hugging Face repository},
howpublished = {\\url{https://huggingface.co/yanolja/YanoljaNEXT-Rosetta-4B}}
}@misc{gemma3,
author = {Google},
title = {Gemma 3},
year = {2024},
publisher = {Google DeepMind},
howpublished = {\\url{https://deepmind.google/models/gemma/gemma-3/}}
}
@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}
}