CoolFace
Modelpublic

Unbabel/Tower-Plus-9B

sourceHugging Facecc-by-nc-sa-4.0updated 1y agoView on Hugging Face
41likes3.4kdownloads
README.md110 linesDownload Raw Back to root
1---2base_model: google/gemma-2-9b3license: cc-by-nc-sa-4.04language:5- de6- nl7- is8- es9- fr10- pt11- uk12- hi13- zh14- ru15- cs16- ko17- ja18- it19- en20- da21- pl22- hu23- sv24- 'no'25- ro26- fi27library_name: transformers28---29 30![Tower Plus Pareto](./Tower-plus-pareto.png)31 32# Model Description:33 34**Tower+ 9B** is build on top of Gemma 2 9B. The model goes through the Continuous Pretraining (CPT), Instruction Tuning (IT), Weighted Preference Optimization (WPO). During all stages we include parallel and multilingual data (covering 22 languages).35 36This approach makes Tower+ 9B one of the best multilingual LLMs under 10B parameters.37 38- **Developed by:** Unbabel39- **Model type:** A 9B parameter model fine-tuned on a mix of _translation-related tasks_ as well as  _general instruction-following_ datasets that include reasoning, code instructions, etc.40- **Languages:** German, Spanish, French, Italian, Korean, Dutch, Russian, English, Portuguese (Portugal), Portuguese (Brazilian), Spanish (Latin America), Chinese (Simplified), Chinese (Traditional), Czech, Ukrainian, Hindi, Icelandic, Japanese, Polish, Swedish, Hungarian, Romanian, Danish, Norwegian (Nynorsk), Norwegian (Bokmål), Finnish41- **License:** CC-BY-NC-4.042- **Context Size:**: 8192 tokens43 44# Intended uses & limitations45 46Tower is intended for multilingual tasks and its specially strong on machine translation. 47 48Because Tower is also a strong multilingual model you can also use it for other multilingual tasks. 49 50Another usecase Tower works well is for creating multilingual synthethic data (for the languages it covers). You can do this either by translating instructions and the respective answers or by asking the model to create an instruction given a document as seed data.51 52# Usage:53 54When using the model, make sure your prompt is formated correctly! 55 56Also, we recommend using VLLM rather than Hugging Face.57 58### Using on VLLM:59 60```python61# pip install vllm62# Gemma by default only uses 4k context. You need to set the following variables:63# export VLLM_WORKER_MULTIPROC_METHOD=spawn64# export VLLM_ALLOW_LONG_MAX_MODEL_LEN=165 66from vllm import LLM, SamplingParams67 68sampling_params = SamplingParams(69  best_of=1,70  temperature=0,71  max_tokens=8192,72)73llm = LLM(model="Unbabel/Tower-Plus-9B", tensor_parallel_size=1)74messages = [{"role": "user", "content": "Translate the following English source text to Portuguese (Portugal):\nEnglish: Hello world!\nPortuguese (Portugal): "}]75outputs = llm.chat(messages, sampling_params)76# Make sure your prompt_token_ids look like this77print (outputs[0].outputs[0].text)78# > Olá, mundo!79```80 81### Using on Transformers:82 83```python84# Install transformers from source - only needed for versions <= v4.3485# pip install git+https://github.com/huggingface/transformers.git86# pip install accelerate87import torch88from transformers import pipeline89 90pipe = pipeline("text-generation", model="Unbabel/Tower-Plus-9B", device_map="auto")91# We use the tokenizer’s chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating92messages = [{"role": "user", "content": "Translate the following English source text to Portuguese (Portugal):\nEnglish: Hello world!\nPortuguese (Portugal): "}]93input_ids = pipe.tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True)94outputs = pipe(messages, max_new_tokens=256, do_sample=False)95print(outputs[0]["generated_text"])96```97 98# Citation99If you use this model please cite our paper:100```101@misc{rei2025towerplus,102      title={Tower+: Bridging Generality and Translation Specialization in Multilingual LLMs}, 103      author={Ricardo Rei and Nuno M. Guerreiro and José Pombal and João Alves and Pedro Teixeirinha and Amin Farajian and André F. T. Martins},104      year={2025},105      eprint={2506.17080},106      archivePrefix={arXiv},107      primaryClass={cs.CL},108      url={https://arxiv.org/abs/2506.17080}, 109}110```