File size: 4,519 Bytes
430538f
 
 
6660e70
430538f
 
 
 
 
 
6660e70
430538f
 
 
 
 
6660e70
430538f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6660e70
 
430538f
6660e70
430538f
6660e70
430538f
6660e70
430538f
 
 
 
 
 
 
63f513e
 
 
 
430538f
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

### Model Sources

Paper: LLaMAX: Scaling Linguistic Horizons of LLM by Enhancing Translation Capabilities Beyond 100 Languages

Link: https://arxiv.org/pdf/2407

Repository: https://github.com/CONE-MT/

### Model Description
LLaMAX is a multilingual language model, developed through continued pre-training on Llama2, and supports over 100 languages.
Its translation capabilities far exceed general models of the same scale, and it can serve as a base model to support downstream multilingual tasks.


### 🔥 Effortless Multilingual Translation with a Simple Prompt

LLaMAX supports translation between more than 100 languages, surpassing the performance of similarly scaled LLMs.

```angular2html

def prompt_template(query, src_language, trg_language):

    instruction = f'Translate the following sentences from {src_language} to {trg_language}.'

    prompt = (

        'Below is an instruction that describes a task, paired with an input that provides further context. '

        'Write a response that appropriately completes the request.\n'

        f'### Instruction:\n{instruction}\n'

        f'### Input:\n{query}\n### Response:'

    )

    return prompt

```

And then run the following codes to execute translation:
```angular2html

from transformers import AutoTokenizer, LlamaForCausalLM



model = LlamaForCausalLM.from_pretrained(PATH_TO_CONVERTED_WEIGHTS)

tokenizer = AutoTokenizer.from_pretrained(PATH_TO_CONVERTED_TOKENIZER)



query = "你好,今天是个好日子"

prompt = Prompt_template(query, 'Chinese', 'English')

inputs = tokenizer(prompt, return_tensors="pt")



generate_ids = model.generate(inputs.input_ids, max_length=30)

tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]

# => "Hello, today is a good day"

```

### 🔥 Effective Base Model for Multilingual Task

LLaMAX preserves its efficacy in general tasks and improves the performance on multilingual tasks.
We fine-tuned LLaMAX using only the English training set of downstream task, which also shows significant improvements in non-English. We provide fine-tuning LLaMAX models for the following three tasks:

Math Reasoning: https://huggingface.co/LLaMAX/LLaMAX2-7B-MetaMath

Commonsense Reasoning: https://huggingface.co/LLaMAX/LLaMAX2-7B-X-CSQA

Natural Language Inference: https://huggingface.co/LLaMAX/LLaMAX2-7B-XNLI


### Supported Languages
Akrikaans (af), Amharic (am), Arabic (ar), Armenian (hy), Assamese (as), Asturian (ast), Azerbaijani (az), Belarusian (be), Bengali (bn), Bosnian (bs), Bulgarian (bg), Burmese (my), Catalan (ca), Cebuano (ceb), Chinese Simpl (zho), Chinese Trad (zho), Croatian (hr), Czech (cs), Danish (da), Dutch (nl), English (en), Estonian (et), Filipino (tl), Finnish (fi), French (fr), Fulah (ff), Galician (gl), Ganda (lg), Georgian (ka), German (de), Greek (el), Gujarati (gu), Hausa (ha), Hebrew (he), Hindi (hi), Hungarian (hu), Icelandic (is), Igbo (ig), Indonesian (id), Irish (ga), Italian (it), Japanese (ja), Javanese (jv), Kabuverdianu (kea), Kamba (kam), Kannada (kn), Kazakh (kk), Khmer (km), Korean (ko), Kyrgyz (ky), Lao (lo), Latvian (lv), Lingala (ln), Lithuanian (lt), Luo (luo), Luxembourgish (lb), Macedonian (mk), Malay (ms), Malayalam (ml), Maltese (mt), Maori (mi), Marathi (mr), Mongolian (mn), Nepali (ne), Northern Sotho (ns), Norwegian (no), Nyanja (ny), Occitan (oc), Oriya (or), Oromo (om), Pashto (ps), Persian (fa), Polish (pl), Portuguese (pt), Punjabi (pa), Romanian (ro), Russian (ru), Serbian (sr), Shona (sn), Sindhi (sd), Slovak (sk), Slovenian (sl), Somali (so), Sorani Kurdish (ku), Spanish (es), Swahili (sw), Swedish (sv), Tajik (tg), Tamil (ta), Telugu (te), Thai (th), Turkish (tr), Ukrainian (uk), Umbundu (umb), Urdu (ur), Uzbek (uz), Vietnamese (vi), Welsh (cy), Wolof (wo), Xhosa (xh), Yoruba (yo), Zulu (zu)


### Model Index
|                           LLaMAX                           |                           LLaMAX-Alpaca                           |
|:----------------------------------------------------------:|:-----------------------------------------------------------------:|
|      [Link](https://huggingface.co/LLaMAX/LLaMAX2-7B)      |      [Link](https://huggingface.co/LLaMAX/LLaMAX2-7B-Alpaca)      |
 |      [Link](https://huggingface.co/LLaMAX/LLaMAX3-8B)      |      [Link](https://huggingface.co/LLaMAX/LLaMAX3-8B-Alpaca)      |

### Citation
If our model helps your work, please cite this paper:

```

```