Views
No views yet

pipeline API using the following code:1from transformers import pipeline
2
3model_id = "GaMS-Beta/GaMS-9B-Instruct-DPO-Translator"
4
5pline = pipeline(
6 "text-generation",
7 model=model_id,
8 device_map="cuda" # replace with "mps" to run on a Mac device
9)
10
11# Example of response generation
12message = [{"role": "user", "content": "Prevedi naslednje angleško besedilo v slovenščino.\nToday is a nice day."}]
13response = pline(message, max_new_tokens=512)
14print("Translation:", response[0]["generated_text"][-1]["content"])device_map to auto:1from transformers import pipeline
2
3model_id = "GaMS-Beta/GaMS-9B-Instruct-DPO-Translator"
4
5pline = pipeline(
6 "text-generation",
7 model=model_id,
8 device_map="auto"
9)
10
11# Example of response generation
12message = [{"role": "user", "content": "Prevedi naslednje angleško besedilo v slovenščino.\nToday is a nice day."}]
13response = pline(message, max_new_tokens=512)
14print("Model's response:", response[0]["generated_text"][-1]["content"])
15
16# Example of conversation chain
17new_message = response[0]["generated_text"]
18new_message.append({"role": "user", "content": "Lahko bolj podrobno opišeš ta dogodek?"})
19response = pline(new_message, max_new_tokens=1024)
20print("Model's response:", response[0]["generated_text"][-1]["content"])| Model | Overall Comet | ccnews | nemotron | wikipedia | Bad Lang (%) | Short (%) | Bad Markdown (%) |
|---|---|---|---|---|---|---|---|
| gemini-2.5-flash | 0.717982 | 0.702981 | 0.697498 | 0.753924 | 0.35% | 0.42% | 3.70% |
| GaMS-9B-Instruct-DPO-Translator | 0.714729 | 0.708317 | 0.689316 | 0.746768 | 1.88% | 1.56% | 13.22% |
| GaMS-9B-SFT-Translator-DPO | 0.708042 | 0.702903 | 0.679462 | 0.742583 | 0.91% | 0.28% | 18.28% |
| GaMS-27B-Instruct | 0.701284 | 0.686480 | 0.680014 | 0.730733 | 27.28% | 5.36% | 62.07% |
| GaMS-9B-Instruct | 0.693659 | 0.685006 | 0.673394 | 0.723470 | 13.50% | 4.83% | 33.15% |
| EuroLLM-9B-Instruct | 0.689321 | 0.668084 | 0.670723 | 0.729227 | 8.97% | 1.89% | 35.08% |
| GaMS-9B-SFT-Translator | 0.682467 | 0.676580 | 0.673650 | 0.699602 | 5.14% | 1.48% | 30.53% |
1@misc{vajda2025improvingllmsmachinetranslation,
2 title={Improving LLMs for Machine Translation Using Synthetic Preference Data},
3 author={Dario Vajda and Domen Vreš and Marko Robnik-Šikonja},
4 year={2025},
5 eprint={2508.14951},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 url={https://arxiv.org/abs/2508.14951},
9}