RichardErkhov
commited on
Commit
•
6602073
1
Parent(s):
c3396d8
uploaded readme
Browse files
README.md
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Quantization made by Richard Erkhov.
|
2 |
+
|
3 |
+
[Github](https://github.com/RichardErkhov)
|
4 |
+
|
5 |
+
[Discord](https://discord.gg/pvy7H8DZMG)
|
6 |
+
|
7 |
+
[Request more models](https://github.com/RichardErkhov/quant_request)
|
8 |
+
|
9 |
+
|
10 |
+
TowerInstruct-7B-v0.2 - bnb 4bits
|
11 |
+
- Model creator: https://huggingface.co/Unbabel/
|
12 |
+
- Original model: https://huggingface.co/Unbabel/TowerInstruct-7B-v0.2/
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
Original model description:
|
18 |
+
---
|
19 |
+
language:
|
20 |
+
- en
|
21 |
+
- de
|
22 |
+
- fr
|
23 |
+
- zh
|
24 |
+
- pt
|
25 |
+
- nl
|
26 |
+
- ru
|
27 |
+
- ko
|
28 |
+
- it
|
29 |
+
- es
|
30 |
+
license: cc-by-nc-4.0
|
31 |
+
metrics:
|
32 |
+
- comet
|
33 |
+
pipeline_tag: translation
|
34 |
+
---
|
35 |
+
# Model Card for TowerInstruct-7B-v0.2
|
36 |
+
|
37 |
+
## Model Details
|
38 |
+
|
39 |
+
### Model Description
|
40 |
+
|
41 |
+
TowerInstruct-7B is a language model that results from fine-tuning TowerBase on the TowerBlocks supervised fine-tuning dataset. TowerInstruct-7B-v0.2 is the first model in the series.
|
42 |
+
The model is trained to handle several translation-related tasks, such as general machine translation (e.g., sentence- and paragraph/document-level translation, terminology-aware translation, context-aware translation), automatic post edition, named-entity recognition, gramatical error correction, and paraphrase generation.
|
43 |
+
We will release more details in the upcoming technical report. For now, you can check results obtained with the model [here](https://unbabel.com/announcing-tower-an-open-multilingual-llm-for-translation-related-tasks/).
|
44 |
+
|
45 |
+
- **Developed by:** Unbabel, Instituto Superior Técnico, CentraleSupélec University of Paris-Saclay
|
46 |
+
- **Model type:** A 7B parameter model fine-tuned on a mix of publicly available, synthetic datasets on translation-related tasks, as well as conversational datasets and code instructions.
|
47 |
+
- **Language(s) (NLP):** English, Portuguese, Spanish, French, German, Dutch, Italian, Korean, Chinese, Russian
|
48 |
+
- **License:** CC-BY-NC-4.0, Llama 2 is licensed under the [LLAMA 2 Community License](https://ai.meta.com/llama/license/), Copyright © Meta Platforms, Inc. All Rights Reserved.
|
49 |
+
- **Finetuned from model:** [TowerBase](https://huggingface.co/Unbabel/TowerBase-7B-v0.1)
|
50 |
+
|
51 |
+
**Update**: TowerInstruct-7B-v0.2 has more reliable document-level translation capabilities in comparison with TowerInstruct-7B-v0.1. The new version of TowerBlocks used to train v0.2 is also available in the Tower collection.
|
52 |
+
|
53 |
+
|
54 |
+
|
55 |
+
## Intended uses & limitations
|
56 |
+
|
57 |
+
The model was initially fine-tuned on a filtered and preprocessed supervised fine-tuning dataset ([TowerBlocks](https://huggingface.co/datasets/Unbabel/TowerBlocks-v0.1)), which contains a diverse range of data sources:
|
58 |
+
- Translation (sentence and paragraph-level)
|
59 |
+
- Automatic Post Edition
|
60 |
+
- Machine Translation Evaluation
|
61 |
+
- Context-aware Translation
|
62 |
+
- Terminology-aware Translation
|
63 |
+
- Multi-reference Translation
|
64 |
+
- Named-entity Recognition
|
65 |
+
- Paraphrase Generation
|
66 |
+
- Synthetic Chat data
|
67 |
+
- Code instructions
|
68 |
+
|
69 |
+
You can find the dataset and all data sources of [TowerBlocks](https://huggingface.co/datasets/Unbabel/TowerBlocks-v0.1) here.
|
70 |
+
|
71 |
+
Here's how you can run the model using the `pipeline()` function from 🤗 Transformers:
|
72 |
+
|
73 |
+
```python
|
74 |
+
# Install transformers from source - only needed for versions <= v4.34
|
75 |
+
# pip install git+https://github.com/huggingface/transformers.git
|
76 |
+
# pip install accelerate
|
77 |
+
|
78 |
+
import torch
|
79 |
+
from transformers import pipeline
|
80 |
+
|
81 |
+
pipe = pipeline("text-generation", model="Unbabel/TowerInstruct-v0.2", torch_dtype=torch.bfloat16, device_map="auto")
|
82 |
+
# We use the tokenizer’s chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating
|
83 |
+
messages = [
|
84 |
+
{"role": "user", "content": "Translate the following text from Portuguese into English.\nPortuguese: Um grupo de investigadores lançou um novo modelo para tarefas relacionadas com tradução.\nEnglish:"},
|
85 |
+
]
|
86 |
+
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
87 |
+
outputs = pipe(prompt, max_new_tokens=256, do_sample=False)
|
88 |
+
print(outputs[0]["generated_text"])
|
89 |
+
# <|im_start|>user
|
90 |
+
# Translate the following text from Portuguese into English.
|
91 |
+
# Portuguese: Um grupo de investigadores lançou um novo modelo para tarefas relacionadas com tradução.
|
92 |
+
# English:<|im_end|>
|
93 |
+
# <|im_start|>assistant
|
94 |
+
# A group of researchers has launched a new model for translation-related tasks.
|
95 |
+
```
|
96 |
+
|
97 |
+
### Out-of-Scope Use
|
98 |
+
|
99 |
+
The model is not guaranteed to perform for languages other than the 10 languages it supports. Even though we trained the model on conversational data and code instructions, it is not intended to be used as a conversational chatbot or code assistant.
|
100 |
+
We are currently working on improving quality and consistency on document-level translation. This model should is not intended to be use as a document-level translator.
|
101 |
+
|
102 |
+
## Bias, Risks, and Limitations
|
103 |
+
|
104 |
+
TowerInstruct-v0.2 has not been aligned to human preferences, so the model may generate problematic outputs (e.g., hallucinations, harmful content, or false statements).
|
105 |
+
|
106 |
+
## Prompt Format
|
107 |
+
|
108 |
+
TowerInstruct-v0.2 was trained using the ChatML prompt templates without any system prompts. An example follows below:
|
109 |
+
```
|
110 |
+
<|im_start|>user
|
111 |
+
{USER PROMPT}<|im_end|>
|
112 |
+
<|im_start|>assistant
|
113 |
+
{MODEL RESPONSE}<|im_end|>
|
114 |
+
<|im_start|>user
|
115 |
+
[...]
|
116 |
+
```
|
117 |
+
|
118 |
+
### Supervised tasks
|
119 |
+
|
120 |
+
The prompts for all supervised tasks can be found in [TowerBlocks](https://huggingface.co/datasets/Unbabel/TowerBlocks-v0.1). We have used multiple prompt templates for each task. While different prompts may offer different outputs, the difference in downstream performance should be very minimal.
|
121 |
+
|
122 |
+
## Training Details
|
123 |
+
|
124 |
+
### Training Data
|
125 |
+
|
126 |
+
Link to [TowerBlocks](https://huggingface.co/datasets/Unbabel/TowerBlocks-v0.1).
|
127 |
+
|
128 |
+
#### Training Hyperparameters
|
129 |
+
|
130 |
+
The following hyperparameters were used during training:
|
131 |
+
|
132 |
+
- total_train_batch_size: 256
|
133 |
+
|
134 |
+
- learning_rate: 7e-06
|
135 |
+
|
136 |
+
- lr_scheduler_type: cosine
|
137 |
+
|
138 |
+
- lr_scheduler_warmup_steps: 500
|
139 |
+
|
140 |
+
- weight_decay: 0.01
|
141 |
+
|
142 |
+
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
143 |
+
|
144 |
+
- num_epochs: 4
|
145 |
+
|
146 |
+
- max_seq_length: 2048
|
147 |
+
|
148 |
+
## Citation
|
149 |
+
|
150 |
+
```bibtex
|
151 |
+
@misc{tower_llm_2024,
|
152 |
+
title={Tower: An Open Multilingual Large Language Model for Translation-Related Tasks},
|
153 |
+
author={Duarte M. Alves and José Pombal and Nuno M. Guerreiro and Pedro H. Martins and João Alves and Amin Farajian and Ben Peters and Ricardo Rei and Patrick Fernandes and Sweta Agrawal and Pierre Colombo and José G. C. de Souza and André F. T. Martins},
|
154 |
+
year={2024},
|
155 |
+
eprint={2402.17733},
|
156 |
+
archivePrefix={arXiv},
|
157 |
+
primaryClass={cs.CL}
|
158 |
+
}
|
159 |
+
```
|
160 |
+
|
161 |
+
[<img src="https://raw.githubusercontent.com/OpenAccess-AI-Collective/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/OpenAccess-AI-Collective/axolotl)
|
162 |
+
|
163 |
+
|