Commit
·
94cd439
1
Parent(s):
d44d431
Update README.md
Browse files
README.md
CHANGED
|
@@ -10,7 +10,32 @@ pipeline_tag: text-generation
|
|
| 10 |
## Llama 2-13b-alpaca-spanish LoRA
|
| 11 |
This is a LoRA for Llama 2 13B trained on a translated [alpaca dataset](https://huggingface.co/datasets/bertin-project/alpaca-spanish) on an attempt to improve spanish performance of the Llama-2 foundation model with a conversational focus.
|
| 12 |
|
| 13 |
-
Base model used was [The Bloke's Llama-2-13B-fp16](https://huggingface.co/TheBloke/Llama-2-13B-fp16) trained in 4bit precision.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
| Training parameteres | |
|
| 16 |
| ----------- | ----------- |
|
|
|
|
| 10 |
## Llama 2-13b-alpaca-spanish LoRA
|
| 11 |
This is a LoRA for Llama 2 13B trained on a translated [alpaca dataset](https://huggingface.co/datasets/bertin-project/alpaca-spanish) on an attempt to improve spanish performance of the Llama-2 foundation model with a conversational focus.
|
| 12 |
|
| 13 |
+
Base model used was [The Bloke's Llama-2-13B-fp16](https://huggingface.co/TheBloke/Llama-2-13B-fp16) trained in 4bit precision with an added padding token.
|
| 14 |
+
|
| 15 |
+
## Important INFO
|
| 16 |
+
The original Llama 2 model does not have a padding token, this came to be restrictive for training for me. To adress this, I added a padding token to the tokenizer associated with the model.
|
| 17 |
+
```python
|
| 18 |
+
from transformers import LlamaTokenizer, LlamaForCausalLM
|
| 19 |
+
|
| 20 |
+
model_name = 'TheBloke/Llama-2-13B-fp16'
|
| 21 |
+
|
| 22 |
+
model = LlamaForCausalLM.from_pretrained(model_name).half()
|
| 23 |
+
tokenizer = LlamaTokenizer.from_pretrained(model_name)
|
| 24 |
+
|
| 25 |
+
# Add padding token
|
| 26 |
+
tokenizer.add_tokens(['<PAD>'])
|
| 27 |
+
tokenizer.pad_token = '<PAD>'
|
| 28 |
+
|
| 29 |
+
# Resizing the model
|
| 30 |
+
model.resize_token_embeddings(len(tokenizer))
|
| 31 |
+
|
| 32 |
+
padded_model_name = 'Llama-2-13B-fp16-padded'
|
| 33 |
+
|
| 34 |
+
# Save
|
| 35 |
+
tokenizer.save_pretrained(padded_model_name)
|
| 36 |
+
model.save_pretrained(padded_model_name)
|
| 37 |
+
|
| 38 |
+
```
|
| 39 |
|
| 40 |
| Training parameteres | |
|
| 41 |
| ----------- | ----------- |
|