Text Generation
Transformers
PyTorch
Safetensors
mistral
translation
norwegian
english
bokmaal
nynorsk
conversational
text-generation-inference
Instructions to use norallm/normistral-11b-translate with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use norallm/normistral-11b-translate with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="norallm/normistral-11b-translate") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("norallm/normistral-11b-translate") model = AutoModelForCausalLM.from_pretrained("norallm/normistral-11b-translate") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use norallm/normistral-11b-translate with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "norallm/normistral-11b-translate" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "norallm/normistral-11b-translate", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/norallm/normistral-11b-translate
- SGLang
How to use norallm/normistral-11b-translate with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "norallm/normistral-11b-translate" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "norallm/normistral-11b-translate", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "norallm/normistral-11b-translate" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "norallm/normistral-11b-translate", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use norallm/normistral-11b-translate with Docker Model Runner:
docker model run hf.co/norallm/normistral-11b-translate
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
- 1,151
