mtreviso commited on
Commit
c33e136
1 Parent(s): 354c654

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +110 -0
README.md ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-4.0
3
+ language:
4
+ - en
5
+ - de
6
+ - zh
7
+ - ru
8
+ - he
9
+ - fr
10
+ - pt
11
+ - nl
12
+ - ko
13
+ - it
14
+ - es
15
+ metrics:
16
+ - comet
17
+ pipeline_tag: translation
18
+ datasets:
19
+ - Unbabel/TowerBlocks-v0.1
20
+ ---
21
+ # Model Card for xTower13B
22
+
23
+ ## Model Details
24
+
25
+ xTower13B is a language model that results from fine-tuning [TowerBase](https://huggingface.co/Unbabel/TowerBase-13B-v0.1) for **explaining** and **correcting translation errors**.
26
+
27
+ xTower was finetuned on a dataset that includes explanations generated from GPT-4 (prompted with and without references),
28
+ along with machine translation data from [TowerBlocks](https://huggingface.co/datasets/Unbabel/TowerBlocks-v0.1). We combined all available data to train a single, multilingual model, employing a mixed prompt setting~(zero-shot, few-shot) during training.
29
+ As a result, xTower can handle both referenceless and reference-based k-shot prompts.
30
+
31
+ Our training hyperparameters and configuration follows that used to train [TowerInstruct](https://huggingface.co/Unbabel/TowerInstruct-13B-v0.1).
32
+
33
+
34
+ - **Developed by:** Unbabel, Instituto Superior Técnico, CentraleSupélec University of Paris-Saclay
35
+ - **Model type:** A 13B parameter model fine-tuned on a mix of publicly available, synthetic datasets on translation-related tasks, as well as conversational datasets and code instructions.
36
+ - **Language(s) (NLP):** English, Portuguese, Spanish, French, German, Dutch, Italian, Korean, Chinese, Russian
37
+ - **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.
38
+ - **Finetuned from model:** [TowerBase](https://huggingface.co/Unbabel/TowerBase-13B-v0.1)
39
+
40
+
41
+
42
+ ## Intended uses & limitations
43
+
44
+ The intented use of the model is two-fold:
45
+ - Explain translation errors in natural language
46
+ - Correct translation errors by providing a translation suggestion
47
+
48
+ The model was trained on explanations from **en-de**, **en-ru**, and **zh-en** language pairs.
49
+ Despite its multilinguality roots, xTower may or may not perform well on unseen language pairs.
50
+
51
+
52
+ ### Usage
53
+
54
+ Here's how you can run the model using the `pipeline()` function from 🤗 Transformers:
55
+
56
+ ```python
57
+ # Install transformers from source - only needed for versions <= v4.34
58
+ # pip install git+https://github.com/huggingface/transformers.git
59
+ # pip install accelerate
60
+
61
+ import torch
62
+ from transformers import pipeline
63
+
64
+ pipe = pipeline("text-generation", model="sardinelab/xTower13B", device_map="auto")
65
+ messages = [
66
+ {
67
+ "role": "user",
68
+ "content": "your_prompt"
69
+ },
70
+ ]
71
+ prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
72
+ outputs = pipe(prompt, max_new_tokens=1024, do_sample=False)
73
+ ```
74
+
75
+
76
+
77
+ ## Bias, Risks, and Limitations
78
+
79
+ xTower has not been aligned to human preferences, so the model may generate problematic outputs (e.g., hallucinations, harmful content, or false statements).
80
+
81
+
82
+ ## Prompt Format
83
+
84
+ xTower was trained using the ChatML prompt templates without any system prompts. An example follows below:
85
+ ```
86
+ <|im_start|>user
87
+ You are provided with a Source, Translation, Translation quality analysis, and Translation quality score (weak, moderate, good, excellent, best). The Translation quality analysis contains a translation with marked error spans with different levels of severity (minor or major). Given this information, generate an explanation for each error and a fully correct translation.
88
+
89
+ English source: All were wearing avalanche beacons.
90
+ German translation: Alle trugen Lawinenschilder.
91
+ Translation quality analysis: Alle trugen <error1 severity=“major”>Lawinenschilder</error1>.
92
+ Translation quality score: weak
93
+ <|im_end|>
94
+ <|im_start|>assistant
95
+ ```
96
+
97
+ After that, the model should generate something like this:
98
+ ```
99
+ Explanation for error1: The term “Lawinenschilder” translates to “avalanche signs”, which is a significant mistranslation of “avalanche beacons”. Avalanche beacons are specific devices used to locate people trapped under snow after an avalanche, not signs. This error changes the meaning of the sentence and introduces confusion about the context.
100
+ Translation correction: Alle trugen Lawinensuchgeräte.
101
+ <|im_end|>
102
+ ```
103
+
104
+ That is, the output consists of a list of explanations for each error, and a final translation correciton.
105
+
106
+ ## Citation
107
+
108
+ ```bibtex
109
+ todo
110
+ ```