Ryex's picture
Update README.md
c8cb9aa verified
---
base_model: google/gemma-2-9b
license: cc-by-nc-sa-4.0
language:
- de
- nl
- is
- es
- fr
- pt
- uk
- hi
- zh
- ru
- cs
- ko
- ja
- it
- en
- da
- pl
- hu
- sv
- 'no'
- ro
- fi
library_name: transformers
---
# Model Card for Model ID
<!-- Provide a quick summary of what the model is/does. -->
A fairly effective attempt at uncensoring Tower Plus, while maintaining some core functionality.
Below is taken directly from Unbabel/Tower-Plus-9B
# Usage:
When using the model, make sure your prompt is formated correctly!
Also, we recommend using VLLM rather than Hugging Face.
### Using on VLLM:
```python
# pip install vllm
# Gemma by default only uses 4k context. You need to set the following variables:
# export VLLM_WORKER_MULTIPROC_METHOD=spawn
# export VLLM_ALLOW_LONG_MAX_MODEL_LEN=1
from vllm import LLM, SamplingParams
sampling_params = SamplingParams(
best_of=1,
temperature=0,
max_tokens=8192,
)
llm = LLM(model="Unbabel/Tower-Plus-9B", tensor_parallel_size=1)
messages = [{"role": "user", "content": "Translate the following English source text to Portuguese (Portugal):\nEnglish: Hello world!\nPortuguese (Portugal): "}]
outputs = llm.chat(messages, sampling_params)
# Make sure your prompt_token_ids look like this
print (outputs[0].outputs[0].text)
# > Olá, mundo!
```
### Using on Transformers:
```python
# Install transformers from source - only needed for versions <= v4.34
# pip install git+https://github.com/huggingface/transformers.git
# pip install accelerate
import torch
from transformers import pipeline
pipe = pipeline("text-generation", model="Unbabel/Tower-Plus-9B", device_map="auto")
# We use the tokenizer’s chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating
messages = [{"role": "user", "content": "Translate the following English source text to Portuguese (Portugal):\nEnglish: Hello world!\nPortuguese (Portugal): "}]
input_ids = pipe.tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True)
outputs = pipe(messages, max_new_tokens=256, do_sample=False)
print(outputs[0]["generated_text"])
```
# Citation
```
@misc{rei2025towerplus,
title={Tower+: Bridging Generality and Translation Specialization in Multilingual LLMs},
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},
year={2025},
eprint={2506.17080},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2506.17080},
}
```