Update README.md
Browse files
README.md
CHANGED
|
@@ -1,151 +1,5 @@
|
|
| 1 |
-
<<<<<<< HEAD
|
| 2 |
---
|
| 3 |
-
license: gemma
|
| 4 |
-
base_model: google/gemma-7b
|
| 5 |
-
tags:
|
| 6 |
-
- alignment-handbook
|
| 7 |
-
- trl
|
| 8 |
-
- sft
|
| 9 |
-
- generated_from_trainer
|
| 10 |
-
- trl
|
| 11 |
-
- sft
|
| 12 |
-
- generated_from_trainer
|
| 13 |
-
datasets:
|
| 14 |
-
- masakhane/african-translated-alpaca
|
| 15 |
-
model-index:
|
| 16 |
-
- name: zephyr-7b-gemma-sft-african-alpaca
|
| 17 |
-
results: []
|
| 18 |
language:
|
| 19 |
-
- af
|
| 20 |
-
- am
|
| 21 |
- ar
|
| 22 |
-
|
| 23 |
-
-
|
| 24 |
-
---
|
| 25 |
-
|
| 26 |
-
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
| 27 |
-
should probably proofread and complete it, then remove this comment. -->
|
| 28 |
-
|
| 29 |
-
# zephyr-7b-gemma-sft-alpaca
|
| 30 |
-
|
| 31 |
-
This model is a fine-tuned version of [google/gemma-7b](https://huggingface.co/google/gemma-7b) on the masakhane/african-translated-alpaca dataset.
|
| 32 |
-
It achieves the following results on the evaluation set:
|
| 33 |
-
- Loss: 0.2737
|
| 34 |
-
|
| 35 |
-
## Model description
|
| 36 |
-
|
| 37 |
-
More information needed
|
| 38 |
-
|
| 39 |
-
## Intended uses & limitations
|
| 40 |
-
|
| 41 |
-
More information needed
|
| 42 |
-
|
| 43 |
-
## Training and evaluation data
|
| 44 |
-
|
| 45 |
-
More information needed
|
| 46 |
-
|
| 47 |
-
## Training procedure
|
| 48 |
-
|
| 49 |
-
### Training hyperparameters
|
| 50 |
-
|
| 51 |
-
The following hyperparameters were used during training:
|
| 52 |
-
- learning_rate: 1e-05
|
| 53 |
-
- train_batch_size: 1
|
| 54 |
-
- eval_batch_size: 1
|
| 55 |
-
- seed: 42
|
| 56 |
-
- distributed_type: multi-GPU
|
| 57 |
-
- num_devices: 8
|
| 58 |
-
- gradient_accumulation_steps: 2
|
| 59 |
-
- total_train_batch_size: 16
|
| 60 |
-
- total_eval_batch_size: 8
|
| 61 |
-
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
| 62 |
-
- lr_scheduler_type: cosine
|
| 63 |
-
- lr_scheduler_warmup_ratio: 0.1
|
| 64 |
-
- num_epochs: 3
|
| 65 |
-
|
| 66 |
-
### Training results
|
| 67 |
-
|
| 68 |
-
| Training Loss | Epoch | Step | Validation Loss |
|
| 69 |
-
|:-------------:|:-----:|:-----:|:---------------:|
|
| 70 |
-
| 0.8671 | 1.0 | 5882 | 0.7445 |
|
| 71 |
-
| 0.5235 | 2.0 | 11764 | 0.3905 |
|
| 72 |
-
| 0.3309 | 3.0 | 17646 | 0.2737 |
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
### Framework versions
|
| 76 |
-
|
| 77 |
-
- Transformers 4.39.0.dev0
|
| 78 |
-
- Pytorch 2.2.1+cu121
|
| 79 |
-
- Datasets 2.14.6
|
| 80 |
-
- Tokenizers 0.15.2
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
### Usage
|
| 86 |
-
|
| 87 |
-
```python
|
| 88 |
-
|
| 89 |
-
# Install transformers from source - only needed for versions <= v4.34
|
| 90 |
-
# pip install git+https://github.com/huggingface/transformers.git
|
| 91 |
-
# pip install accelerate
|
| 92 |
-
|
| 93 |
-
import torch
|
| 94 |
-
from transformers import pipeline
|
| 95 |
-
|
| 96 |
-
pipe = pipeline("text-generation", model="masakhane/zephyr-7b-gemma-sft-african-alpaca", torch_dtype=torch.bfloat16, device_map="auto")
|
| 97 |
-
|
| 98 |
-
# We use the tokenizer's chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating
|
| 99 |
-
messages = [
|
| 100 |
-
{
|
| 101 |
-
"role": "system",
|
| 102 |
-
"content": "You are a friendly chatbot who answewrs question in given language",
|
| 103 |
-
},
|
| 104 |
-
{"role": "user", "content": "what is the 3 biggest countrys in Africa?"},
|
| 105 |
-
]
|
| 106 |
-
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 107 |
-
outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
| 108 |
-
print(outputs[0]["generated_text"])
|
| 109 |
-
# <|system|>
|
| 110 |
-
# You are a friendly chatbot who always responds in the style of a pirate<eos>
|
| 111 |
-
# <|user|>
|
| 112 |
-
# what is the 3 biggest countrys in Africa?<eos>
|
| 113 |
-
# <|assistant|>
|
| 114 |
-
# The 3 biggest countries in Africa are Nigeria, Ethiopia and South Africa.
|
| 115 |
-
```
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
### Quantized Versions through bitsandbytes
|
| 119 |
-
|
| 120 |
-
``` python
|
| 121 |
-
|
| 122 |
-
import torch
|
| 123 |
-
from transformers import pipeline
|
| 124 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
quantization_config = BitsAndBytesConfig(load_in_4bit=True)
|
| 128 |
-
|
| 129 |
-
tokenizer = AutoTokenizer.from_pretrained("masakhane/zephyr-7b-gemma-sft-african-alpaca")
|
| 130 |
-
model = AutoModelForCausalLM.from_pretrained("masakhane/zephyr-7b-gemma-sft-african-alpaca", quantization_config=quantization_config)
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
pipe = pipeline("text-generation", model=model,tokenizer=tokenizer, torch_dtype=torch.bfloat16, device_map="auto")
|
| 134 |
-
|
| 135 |
-
messages = [
|
| 136 |
-
{
|
| 137 |
-
"role": "system",
|
| 138 |
-
"content": "You are a friendly chatbot who answewrs question in given language",
|
| 139 |
-
},
|
| 140 |
-
{"role": "user", "content": "list languages in Africa?"},
|
| 141 |
-
]
|
| 142 |
-
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 143 |
-
outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
| 144 |
-
print(outputs[0]["generated_text"])
|
| 145 |
-
|
| 146 |
-
```
|
| 147 |
-
=======
|
| 148 |
-
---
|
| 149 |
-
license: apache-2.0
|
| 150 |
-
---
|
| 151 |
-
>>>>>>> 28411f788e80295e38a461856e2fdd0241da04af
|
|
|
|
|
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
language:
|
|
|
|
|
|
|
| 3 |
- ar
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|