jmprcp commited on
Commit
090b9f3
1 Parent(s): 43d4b67

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +141 -0
README.md ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ - de
5
+ - fr
6
+ - zh
7
+ - pt
8
+ - nl
9
+ - ru
10
+ - ko
11
+ - it
12
+ - es
13
+ license: cc-by-nc-4.0
14
+ metrics:
15
+ - comet
16
+ pipeline_tag: translation
17
+ ---
18
+ # Model Card for TowerMistral-Instruct-v0.2
19
+
20
+ ## Model Details
21
+
22
+ ### Model Description
23
+
24
+ TowerMistralInstruct-7B is a language model that results from fine-tuning a Mistral version of TowerBase on the TowerBlocks supervised fine-tuning dataset.
25
+ 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.
26
+
27
+ This model has performance comparable to the larger TowerInstruct-13B-v0.2, while being roughly half the size. Check out our [paper](https://arxiv.org/abs/2402.17733).
28
+
29
+ - **Developed by:** Unbabel, Instituto Superior Técnico, CentraleSupélec University of Paris-Saclay
30
+ - **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.
31
+ - **Language(s) (NLP):** English, Portuguese, Spanish, French, German, Dutch, Italian, Korean, Chinese, Russian
32
+ - **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.
33
+
34
+
35
+ ## Intended uses & limitations
36
+
37
+ 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:
38
+ - Translation (sentence and paragraph-level)
39
+ - Automatic Post Edition
40
+ - Machine Translation Evaluation
41
+ - Context-aware Translation
42
+ - Terminology-aware Translation
43
+ - Multi-reference Translation
44
+ - Named-entity Recognition
45
+ - Paraphrase Generation
46
+ - Synthetic Chat data
47
+ - Code instructions
48
+
49
+ You can find the dataset and all data sources of [TowerBlocks](https://huggingface.co/datasets/Unbabel/TowerBlocks-v0.1) here.
50
+
51
+ Here's how you can run the model using the `pipeline()` function from 🤗 Transformers:
52
+
53
+ ```python
54
+ # Install transformers from source - only needed for versions <= v4.34
55
+ # pip install git+https://github.com/huggingface/transformers.git
56
+ # pip install accelerate
57
+
58
+ import torch
59
+ from transformers import pipeline
60
+
61
+ pipe = pipeline("text-generation", model="Unbabel/TowerMistralInstruct-v0.2", torch_dtype=torch.bfloat16, device_map="auto")
62
+ # We use the tokenizer’s chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating
63
+ messages = [
64
+ {"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:"},
65
+ ]
66
+ prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
67
+ outputs = pipe(prompt, max_new_tokens=256, do_sample=False)
68
+ print(outputs[0]["generated_text"])
69
+ # <|im_start|>user
70
+ # Translate the following text from Portuguese into English.
71
+ # Portuguese: Um grupo de investigadores lançou um novo modelo para tarefas relacionadas com tradução.
72
+ # English:<|im_end|>
73
+ # <|im_start|>assistant
74
+ # A group of researchers has launched a new model for translation-related tasks.
75
+ ```
76
+
77
+ ### Out-of-Scope Use
78
+
79
+ 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.
80
+ 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.
81
+
82
+ ## Bias, Risks, and Limitations
83
+
84
+ TowerMistral-Instruct-v0.2 has not been aligned to human preferences, so the model may generate problematic outputs (e.g., hallucinations, harmful content, or false statements).
85
+
86
+ ## Prompt Format
87
+
88
+ TowerMistral-Instruct-v0.2 was trained using the ChatML prompt templates without any system prompts. An example follows below:
89
+ ```
90
+ <|im_start|>user
91
+ {USER PROMPT}<|im_end|>
92
+ <|im_start|>assistant
93
+ {MODEL RESPONSE}<|im_end|>
94
+ <|im_start|>user
95
+ [...]
96
+ ```
97
+
98
+ ### Supervised tasks
99
+
100
+ 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.
101
+
102
+ ## Training Details
103
+
104
+ ### Training Data
105
+
106
+ Link to [TowerBlocks](https://huggingface.co/datasets/Unbabel/TowerBlocks-v0.1).
107
+
108
+ #### Training Hyperparameters
109
+
110
+ The following hyperparameters were used during training:
111
+
112
+ - total_train_batch_size: 256
113
+
114
+ - learning_rate: 7e-06
115
+
116
+ - lr_scheduler_type: cosine
117
+
118
+ - lr_scheduler_warmup_steps: 500
119
+
120
+ - weight_decay: 0.01
121
+
122
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
123
+
124
+ - num_epochs: 4
125
+
126
+ - max_seq_length: 2048
127
+
128
+ ## Citation
129
+
130
+ ```bibtex
131
+ @misc{tower_llm_2024,
132
+ title={Tower: An Open Multilingual Large Language Model for Translation-Related Tasks},
133
+ 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},
134
+ year={2024},
135
+ eprint={2402.17733},
136
+ archivePrefix={arXiv},
137
+ primaryClass={cs.CL}
138
+ }
139
+ ```
140
+
141
+ [<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)