NorMistral-11b-translate is a finetuned machine-translation version of NorMistral-11b-long. It can translate sentences or documents in all 6 directions between Norwegian Bokmål, Nynorsk and English.
License
We release the model under Apache 2.0 license to indicate that we do not impose any additional constraints on the model weights. However, we do not own the data in the training collection.
Usage
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
# load the NorMistral tokenizer and model
tokenizer = AutoTokenizer.from_pretrained("norallm/normistral-11b-translate")
model = AutoModelForCausalLM.from_pretrained(
"norallm/normistral-11b-translate",
device_map='auto',
torch_dtype=torch.bfloat16
)
# create a conversation and convert it to token indices using the NorMistral chat template
messages = [
{"role": "system", "content": "nynorsk"}, # Optional message to set the target language for translation; "engelsk" by default, "bokmål" and "nynorsk" are supported
{"role": "user", "content": "Hva er hovedstaden i Norge?"}
]
input_tokens = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)
# run the generation (customizable via the various parameters)
output_tokens = model.generate(
input_tokens,
max_new_tokens=2048, # limit max number of generated tokens
do_sample=False # do not randomly sample the outputs
)
# decode the generated tokens back to text; should return "Kva er hovudstaden i Noreg?"
output_str = tokenizer.decode(output_tokens[0, input_tokens.size(1):], skip_special_tokens=True).strip()
Training data
The full training corpus is published as ltg/nob-nno-eng-translation-pairs.
Contact
David Samuel (davisamu@ifi.uio.no)
License
@inproceedings{samuel-etal-2025-small,
title = "Small Languages, Big Models: {A} Study of Continual Training on Languages of {Norway}",
author = "Samuel, David and
Mikhailov, Vladislav and
Velldal, Erik and
{\O}vrelid, Lilja and
Charpentier, Lucas Georges Gabriel and
Kutuzov, Andrey and
Oepen, Stephan",
editor = "Johansson, Richard and
Stymne, Sara",
booktitle = "Proceedings of the Joint 25th Nordic Conference on Computational Linguistics and 11th Baltic Conference on Human Language Technologies (NoDaLiDa/Baltic-HLT 2025)",
month = mar,
year = "2025",
address = "Tallinn, Estonia",
publisher = "University of Tartu Library",
url = "https://aclanthology.org/2025.nodalida-1.61/",
pages = "573--608",
ISBN = "978-9908-53-109-0",
}
- Downloads last month
- 45
