laurentiubp
commited on
Commit
•
f77d72d
1
Parent(s):
5c85e5b
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: llama3
|
3 |
+
base_model: catallama/CataLlama-v0.2-Base
|
4 |
+
tags:
|
5 |
+
- llama
|
6 |
+
- llama-3
|
7 |
+
- Catalan
|
8 |
+
model-index:
|
9 |
+
- name: CataLlama-v0.2-Instruct-SFT
|
10 |
+
results: []
|
11 |
+
datasets:
|
12 |
+
- catallama/Catalan-Instruct-V2
|
13 |
+
language:
|
14 |
+
- ca
|
15 |
+
- en
|
16 |
+
pipeline_tag: text-generation
|
17 |
+
library_name: transformers
|
18 |
+
---
|
19 |
+
|
20 |
+
![](https://huggingface.co/catallama/CataLlama-v0.1-Instruct-DPO/resolve/main/CataLlama-v0.1.png)
|
21 |
+
|
22 |
+
# CataLlama-v0.2-Instruct-SFT
|
23 |
+
|
24 |
+
**CataLlama-v0.2-Instruct-SFT** is an instruct fine-tune of [catallama/CataLlama-v0.2-Base](https://huggingface.co/catallama/CataLlama-v0.2-Base) on the [catallama/Catalan-Instruct-V2](https://huggingface.co/datasets/catallama/Catalan-Instruct-V2) dataset.
|
25 |
+
|
26 |
+
CataLlama-v0.2 was trained on roughly **800 million new tokens** which is almost double compared to CataLlama-v0.1.
|
27 |
+
|
28 |
+
The model shows improved proficiency with the Catalan language while performing significantly better than CataLlama-v0.2 on all tasks.
|
29 |
+
|
30 |
+
**This is an instruction fine-tuned model proficient on the following tasks in Catalan**
|
31 |
+
|
32 |
+
- *Information extraction (suitable for RAG)*
|
33 |
+
- *Named Entity Recognition (NER)*
|
34 |
+
- *Translation from English to Catalan and Catalan to English*
|
35 |
+
- *Summarization - both short form and long form*
|
36 |
+
- *Sentiment analysis*
|
37 |
+
|
38 |
+
|
39 |
+
**Model developers** [Laurentiu Petrea](https://www.linkedin.com/in/laurentiupetrea/) based on Llama-3 from Meta.
|
40 |
+
|
41 |
+
**Model Architecture** CataLlama is an auto-regressive language model that uses an optimized transformer architecture. The tuned versions use supervised fine-tuning (SFT) and direct preference optimisation (DPO) to align with human preferences for helpfulness and safety.
|
42 |
+
|
43 |
+
**License** The model uses the llama-3 license available at: [https://llama.meta.com/llama3/license](https://llama.meta.com/llama3/license)
|
44 |
+
|
45 |
+
|
46 |
+
### Use with transformers
|
47 |
+
|
48 |
+
See the snippet below for usage with Transformers:
|
49 |
+
|
50 |
+
**The model follows the same prompt template as Llama-3 Instruct**
|
51 |
+
|
52 |
+
```python
|
53 |
+
import transformers
|
54 |
+
import torch
|
55 |
+
|
56 |
+
model_id = "catallama/CataLlama-v0.2-Instruct-SFT"
|
57 |
+
|
58 |
+
pipeline = transformers.pipeline(
|
59 |
+
"text-generation",
|
60 |
+
model=model_id,
|
61 |
+
model_kwargs={"torch_dtype": torch.bfloat16},
|
62 |
+
device_map="auto",
|
63 |
+
)
|
64 |
+
|
65 |
+
messages = [
|
66 |
+
{"role": "user", "content": "Ei com estàs avui?"},
|
67 |
+
]
|
68 |
+
|
69 |
+
prompt = pipeline.tokenizer.apply_chat_template(
|
70 |
+
messages,
|
71 |
+
tokenize=False,
|
72 |
+
add_generation_prompt=True
|
73 |
+
)
|
74 |
+
|
75 |
+
outputs = pipeline(
|
76 |
+
prompt,
|
77 |
+
max_new_tokens=1024,
|
78 |
+
do_sample=True,
|
79 |
+
temperature=0.6,
|
80 |
+
top_p=0.9,
|
81 |
+
)
|
82 |
+
|
83 |
+
print(outputs[0]["generated_text"][len(prompt):])
|
84 |
+
```
|
85 |
+
|
86 |
+
## Training procedure
|
87 |
+
|
88 |
+
The model was trained **with the same prompt template of Llama-3 Instruct**.
|
89 |
+
|
90 |
+
The model was trained for two epochs on **8x A100 80GB GPUs using DeepSpeed ZeRO** State-3 without CPU offloading.
|
91 |
+
|
92 |
+
Then training lasted approximately 8 hours for a total GPU cost of 150€.
|
93 |
+
|
94 |
+
### Training hyperparameters
|
95 |
+
|
96 |
+
The following hyperparameters were used during training:
|
97 |
+
- learning_rate: 2e-05
|
98 |
+
- distributed_type: multi-GPU
|
99 |
+
- num_devices: 8
|
100 |
+
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
101 |
+
- lr_scheduler_type: cosine
|
102 |
+
- lr_scheduler_warmup_steps: 100
|
103 |
+
- num_epochs: 2
|
104 |
+
|
105 |
+
|
106 |
+
## Intended Use
|
107 |
+
|
108 |
+
**Note:** This model is not intended to beat benchmarks, but to demonstrate techniques for augmenting LLMs on new languages and preserve rare languages as part of our world heritage.
|
109 |
+
|
110 |
+
**Intended Use Cases** Llama 3 is intended for commercial and research use in English. Instruction tuned models are intended for assistant-like chat, whereas pretrained models can be adapted for a variety of natural language generation tasks.
|
111 |
+
|
112 |
+
**Out-of-scope** Use in any manner that violates applicable laws or regulations (including trade compliance laws). Use in any other way that is prohibited by the Acceptable Use Policy and Llama 3 Community License. Use in languages other than English**.
|
113 |
+
|
114 |
+
**Note: Developers may fine-tune Llama 3 models for languages beyond English provided they comply with the Llama 3 Community License and the Acceptable Use Policy.
|