robinsmits
commited on
Commit
•
125fa3e
1
Parent(s):
f792f3b
Update README.md
Browse files
README.md
CHANGED
@@ -1,36 +1,113 @@
|
|
1 |
---
|
2 |
-
|
3 |
-
|
|
|
|
|
4 |
tags:
|
5 |
- generated_from_trainer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
model-index:
|
7 |
- name: polylm_13b_ft_alpaca_clean_dutch
|
8 |
results: []
|
9 |
---
|
10 |
|
11 |
-
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
12 |
-
should probably proofread and complete it, then remove this comment. -->
|
13 |
-
|
14 |
# polylm_13b_ft_alpaca_clean_dutch
|
15 |
|
16 |
-
|
|
|
|
|
17 |
It achieves the following results on the evaluation set:
|
18 |
- Loss: 1.3839
|
19 |
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
## Intended uses & limitations
|
25 |
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
## Training and evaluation data
|
29 |
|
30 |
-
|
|
|
|
|
|
|
|
|
31 |
|
32 |
## Training procedure
|
33 |
|
|
|
|
|
|
|
|
|
34 |
### Training hyperparameters
|
35 |
|
36 |
The following hyperparameters were used during training:
|
@@ -45,6 +122,17 @@ The following hyperparameters were used during training:
|
|
45 |
- lr_scheduler_warmup_steps: 64
|
46 |
- num_epochs: 1
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
### Training results
|
49 |
|
50 |
| Training Loss | Epoch | Step | Validation Loss |
|
@@ -56,10 +144,10 @@ The following hyperparameters were used during training:
|
|
56 |
| 1.3798 | 0.82 | 640 | 1.3870 |
|
57 |
| 1.3629 | 0.99 | 768 | 1.3839 |
|
58 |
|
59 |
-
|
60 |
### Framework versions
|
61 |
|
62 |
- Transformers 4.34.0
|
63 |
- Pytorch 2.0.1+cu118
|
64 |
- Datasets 2.14.5
|
65 |
- Tokenizers 0.14.1
|
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- nl
|
4 |
+
license: cc-by-nc-4.0
|
5 |
+
library_name: peft
|
6 |
tags:
|
7 |
- generated_from_trainer
|
8 |
+
- alpaca
|
9 |
+
- Transformers
|
10 |
+
- PolyLM
|
11 |
+
- text-generation-inference
|
12 |
+
datasets:
|
13 |
+
- BramVanroy/alpaca-cleaned-dutch
|
14 |
+
inference: false
|
15 |
+
base_model: DAMO-NLP-MT/polylm-13b-fine-grained-shards
|
16 |
+
pipeline_tag: text-generation
|
17 |
model-index:
|
18 |
- name: polylm_13b_ft_alpaca_clean_dutch
|
19 |
results: []
|
20 |
---
|
21 |
|
|
|
|
|
|
|
22 |
# polylm_13b_ft_alpaca_clean_dutch
|
23 |
|
24 |
+
## Model description
|
25 |
+
|
26 |
+
This adapter model is a fine-tuned version of [DAMO-NLP-MT/polylm-13b](https://huggingface.co/DAMO-NLP-MT/polylm-13b).
|
27 |
It achieves the following results on the evaluation set:
|
28 |
- Loss: 1.3839
|
29 |
|
30 |
+
Finetuning was performed on the Dutch [BramVanroy/alpaca-cleaned-dutch](https://www.huggingface.co/datasets/BramVanroy/alpaca-cleaned-dutch) dataset which contains 52K of records with instruction following-data translated from English to Dutch.
|
31 |
+
|
32 |
+
See [DAMO-NLP-MT/polylm-13b-fine-grained-shards](https://huggingface.co/DAMO-NLP-MT/polylm-13b-fine-grained-shards) for all information about the base model.
|
33 |
+
|
34 |
+
## Model usage
|
35 |
+
|
36 |
+
A basic example of how to use the finetuned model.
|
37 |
+
|
38 |
+
```
|
39 |
+
import torch
|
40 |
+
from peft import AutoPeftModelForCausalLM
|
41 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
42 |
+
|
43 |
+
model_name = "robinsmits/polylm_13b_ft_alpaca_clean_dutch"
|
44 |
+
|
45 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast = False, legacy = False)
|
46 |
+
|
47 |
+
model = AutoPeftModelForCausalLM.from_pretrained(model_name, device_map = "auto", load_in_4bit = True, torch_dtype = torch.bfloat16)
|
48 |
+
|
49 |
+
prompt = "### Instructie:\nWat zijn de drie belangrijkste softwareonderdelen die worden gebruikt bij webontwikkeling?\n\n### Antwoord:\n"
|
50 |
+
|
51 |
+
inputs = tokenizer(prompt, return_tensors = "pt")
|
52 |
+
sample = model.generate(input_ids = inputs.input_ids.cuda(),
|
53 |
+
attention_mask = inputs.attention_mask.cuda(),
|
54 |
+
max_new_tokens = 128,
|
55 |
+
do_sample = True,
|
56 |
+
top_p = 0.85,
|
57 |
+
top_k = 50,
|
58 |
+
temperature = 0.5,
|
59 |
+
repetition_penalty = 1.2,
|
60 |
+
num_return_sequences = 1,
|
61 |
+
pad_token_id = tokenizer.eos_token_id,
|
62 |
+
forced_eos_token_id = tokenizer.eos_token_id)
|
63 |
+
output = tokenizer.decode(sample[0], skip_special_tokens = True)
|
64 |
+
|
65 |
+
print(output.split(prompt)[1])
|
66 |
+
```
|
67 |
|
68 |
+
The prompt and generated output for the above mentioned example is similar to the output shown below.
|
69 |
+
|
70 |
+
```
|
71 |
+
### Instructie:
|
72 |
+
Wat zijn de drie belangrijkste softwareonderdelen die worden gebruikt bij webontwikkeling?
|
73 |
+
|
74 |
+
### Antwoord:
|
75 |
+
|
76 |
+
De drie belangrijkste onderdelen van webontwikkeling waaraan wordt gedacht tijdens het ontwerpen en bouwen van websites, zijn HTML (Hypertext Markup Language), CSS (Cascading Style Sheets) en JavaScript. Het is belangrijk om te weten hoe deze drie elementen werken samen met elkaar voordat je een website ontwikkelt of verbeterd kunt maken. Bovendien moet je begrijpen wat elk onderdeel doet wanneer het op dezelfde pagina staat ingebed in verschillende contexten. Dit zal helpen bij het creëren van consistente inhoud zonder fouten zoals verwarring tussen browsers of compatibiliteitsproblemen. Ten slotte kan kennis over de functies
|
77 |
+
```
|
78 |
+
|
79 |
+
For more extensive usage and a lot of generated samples (both good and bad samples) see the following [Inference Notebook](https://github.com/RobinSmits/Dutch-LLMs/blob/main/PolyLM_13B_Alpaca_Clean_Dutch_Inference.ipynb)
|
80 |
|
81 |
## Intended uses & limitations
|
82 |
|
83 |
+
The PolyLM-13B model was trained on 18 languages. The primary focus was to create a multi-lingual Open LLM.
|
84 |
+
Dutch was one of those 18 languages. For training the model a diverse combination of multi-lingual datasets was used.
|
85 |
+
|
86 |
+
The generated output and performance of this model for the Dutch language is very likely not always comparable to the various Open-Llama models that have been finetuned on English Alpaca datasets.
|
87 |
+
|
88 |
+
The primary intention of this finetuned model is to explore and research the use of the Dutch language in combination with an Open LLM model.
|
89 |
+
|
90 |
+
## Bias, Risks, and Limitations
|
91 |
+
|
92 |
+
The information below is copied from the base model's [official model card](https://arxiv.org/pdf/2307.06018.pdf).
|
93 |
+
This applies also to the finetuned model.
|
94 |
+
|
95 |
+
> Our contributions are fully methodological: adding the support of multilingualism to LLM during training and SFT phases. It is unavoidable that PolyLM might exhibit several common deficiencies of language models, e.g. hallucination and toxicity. PolyLM should not be used directly in any application, without a prior assessment of safety and fairness concerns specific to the application.
|
96 |
|
97 |
## Training and evaluation data
|
98 |
|
99 |
+
This model was trained on the [BramVanroy/alpaca-cleaned-dutch](https://www.huggingface.co/datasets/BramVanroy/alpaca-cleaned-dutch) dataset.
|
100 |
+
|
101 |
+
The dataset is the Dutch translation of the English Alpaca Cleaned instruction dataset.
|
102 |
+
|
103 |
+
Based on the dataset license only Non-Commercial use is allowed. Commercial use is strictly forbidden.
|
104 |
|
105 |
## Training procedure
|
106 |
|
107 |
+
This model was finetuned with a QLoRA setup on a Google Colab A100 GPU in about 3.5 hours.
|
108 |
+
|
109 |
+
The notebook used for training can be found here: [Training Notebook](https://github.com/RobinSmits/Dutch-LLMs/blob/main/PolyLM_13B_Alpaca_Clean_Dutch_Qlora.ipynb)
|
110 |
+
|
111 |
### Training hyperparameters
|
112 |
|
113 |
The following hyperparameters were used during training:
|
|
|
122 |
- lr_scheduler_warmup_steps: 64
|
123 |
- num_epochs: 1
|
124 |
|
125 |
+
The following bitsandbytes quantization config was used during training:
|
126 |
+
- load_in_8bit: False
|
127 |
+
- load_in_4bit: True
|
128 |
+
- llm_int8_threshold: 6.0
|
129 |
+
- llm_int8_skip_modules: None
|
130 |
+
- llm_int8_enable_fp32_cpu_offload: False
|
131 |
+
- llm_int8_has_fp16_weight: False
|
132 |
+
- bnb_4bit_quant_type: nf4
|
133 |
+
- bnb_4bit_use_double_quant: True
|
134 |
+
- bnb_4bit_compute_dtype: bfloat16
|
135 |
+
|
136 |
### Training results
|
137 |
|
138 |
| Training Loss | Epoch | Step | Validation Loss |
|
|
|
144 |
| 1.3798 | 0.82 | 640 | 1.3870 |
|
145 |
| 1.3629 | 0.99 | 768 | 1.3839 |
|
146 |
|
|
|
147 |
### Framework versions
|
148 |
|
149 |
- Transformers 4.34.0
|
150 |
- Pytorch 2.0.1+cu118
|
151 |
- Datasets 2.14.5
|
152 |
- Tokenizers 0.14.1
|
153 |
+
- PEFT 0.5.0
|