Update README.md
Browse files
README.md
CHANGED
|
@@ -9,9 +9,20 @@ tags:
|
|
| 9 |
license: apache-2.0
|
| 10 |
language:
|
| 11 |
- en
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
---
|
| 13 |
|
| 14 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
- **Developed by:** calcpy
|
| 17 |
- **License:** apache-2.0
|
|
@@ -20,3 +31,73 @@ language:
|
|
| 20 |
This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
| 21 |
|
| 22 |
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
license: apache-2.0
|
| 10 |
language:
|
| 11 |
- en
|
| 12 |
+
- sw
|
| 13 |
+
datasets:
|
| 14 |
+
- wikimedia/wikipedia
|
| 15 |
+
- Mollel/alpaca-swahili
|
| 16 |
+
- Mollel/swahili_pretrain_data
|
| 17 |
+
library_name: peft
|
| 18 |
---
|
| 19 |
|
| 20 |
+
# Model description
|
| 21 |
+
|
| 22 |
+
The model can be used for Swahili language generation, translation, and other NLP tasks, especially focused on the pretraining and fine-tuning domains.
|
| 23 |
+
It has been pre-trained and fine-tuned specifically for Swahili language tasks with the Unsloth framework.
|
| 24 |
+
|
| 25 |
+
This is a development version and it's not recommended for general use.
|
| 26 |
|
| 27 |
- **Developed by:** calcpy
|
| 28 |
- **License:** apache-2.0
|
|
|
|
| 31 |
This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
| 32 |
|
| 33 |
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
## Out-of-Scope Use
|
| 37 |
+
|
| 38 |
+
The model is not designed for tasks outside of the Swahili language
|
| 39 |
+
or tasks requiring highly factual precision in domains not covered by the training datasets.
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
## Bias, Risks, and Limitations
|
| 43 |
+
|
| 44 |
+
The model inherits any potential biases present in the Swahili Wikipedia and Mollel's dataset. Users should be cautious when applying this model to sensitive applications.
|
| 45 |
+
|
| 46 |
+
### Recommendations
|
| 47 |
+
|
| 48 |
+
Users should perform bias evaluations specific to their use case and ensure that any downstream applications consider potential ethical implications.
|
| 49 |
+
|
| 50 |
+
## How to Get Started with the Model
|
| 51 |
+
|
| 52 |
+
Use the code below to get started with the model.
|
| 53 |
+
|
| 54 |
+
```python
|
| 55 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 56 |
+
|
| 57 |
+
# Load the model and tokenizer
|
| 58 |
+
model = AutoModelForCausalLM.from_pretrained("path_to_your_model")
|
| 59 |
+
tokenizer = AutoTokenizer.from_pretrained("path_to_your_model")
|
| 60 |
+
|
| 61 |
+
# Example inference
|
| 62 |
+
instruction = "Endelea mlolongo wa fibonacci:"
|
| 63 |
+
input_data = "1, 1, 2, 3, 5, 8,"
|
| 64 |
+
prompt = f"Chini ni maagizo ambayo yanaelezea kazi. Andika jibu ambalo linakamilisha ombi ipasavyo.\n### Maagizo:\n{instruction}\n\n{input_data}\n### Jibu:\n"
|
| 65 |
+
|
| 66 |
+
inputs = tokenizer([f"{prompt}"], return_tensors="pt").to("cuda")
|
| 67 |
+
outputs = model.generate(**inputs, max_new_tokens=64, use_cache=True)
|
| 68 |
+
print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
In this example, the model generates the continuation of the Fibonacci sequence in Swahili.
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
## Training Hyperparameters
|
| 75 |
+
|
| 76 |
+
- ** Training regime: Mixed precision (fp16/bf16)
|
| 77 |
+
- ** Batch size: 2 per device
|
| 78 |
+
- ** Max steps: 24,000 for pretraining, 1,200 for fine-tuning
|
| 79 |
+
- ** Learning rate: 5e-5 (1e-5 for embeddings)
|
| 80 |
+
- ** Warmup steps: 100 for pretraining, 10 for fine-tuning
|
| 81 |
+
- ** Weight decay: 0.01 (pretraining), 0.00 (fine-tuning)
|
| 82 |
+
|
| 83 |
+
## Evaluation
|
| 84 |
+
|
| 85 |
+
The model was only manually evaluated on the Alpaca Swahili dataset for instruction-following capabilities.
|
| 86 |
+
|
| 87 |
+
## Metrics
|
| 88 |
+
|
| 89 |
+
Evaluation metrics will be required for language generation quality and instruction-following precision.
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
## Summary
|
| 93 |
+
|
| 94 |
+
This is a technical release of a small test model to test pre-training and fine-tuning on a single GPU.
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
## Compute Infrastructure
|
| 98 |
+
|
| 99 |
+
- **OS** Ubuntu 22.04.5 LTS
|
| 100 |
+
- **Hardware Type:** NVIDIA GeForce RTX 4090 24 GiB
|
| 101 |
+
- **Hours used:** ~12 hours
|
| 102 |
+
|
| 103 |
+
|