Update README.md
Browse files
README.md
CHANGED
|
@@ -77,17 +77,53 @@ Users should carefully evaluate outputs before deployment, especially in sensiti
|
|
| 77 |
|
| 78 |
## How to Get Started with the Model
|
| 79 |
|
|
|
|
| 80 |
```python
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
model =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
```
|
| 92 |
|
| 93 |
## Training Details
|
|
|
|
| 77 |
|
| 78 |
## How to Get Started with the Model
|
| 79 |
|
| 80 |
+
### Install dependencies
|
| 81 |
```python
|
| 82 |
+
!pip install unsloth # @ git+https://github.com/unslothai/unsloth.git
|
| 83 |
+
!pip install datasets==2.21.0
|
| 84 |
+
!pip install pandas==2.1.4
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
### Import dependencies
|
| 88 |
+
```python
|
| 89 |
+
from unsloth import FastLanguageModel, is_bfloat16_supported
|
| 90 |
+
from transformers import TextStreamer, AutoTokenizer
|
| 91 |
+
import torch
|
| 92 |
+
from datasets import load_dataset, DatasetDict, concatenate_datasets, Dataset
|
| 93 |
+
from collections import Counter, defaultdict
|
| 94 |
+
import os
|
| 95 |
+
import sys
|
| 96 |
+
|
| 97 |
+
from trl import SFTTrainer
|
| 98 |
+
from transformers import TrainingArguments, TextStreamer
|
| 99 |
+
import pandas as pd
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
### Load the base model
|
| 103 |
+
```python
|
| 104 |
+
model_config = {"model_name": "unsloth/llama-3-8b", "load_in_4bit": False}
|
| 105 |
+
max_seq_length = 2048 # Choose any! We auto support RoPE Scaling internally!
|
| 106 |
+
dtype = None # None for auto detection. Float16 for Tesla T4, V100, Bfloat16 for Ampere+
|
| 107 |
+
load_in_4bit = False # Use 4bit quantization to reduce memory usage. Can be False.
|
| 108 |
+
model_name = "polyglots/SinLlama_v01" # Change the model name
|
| 109 |
+
```
|
| 110 |
|
| 111 |
+
### Load the model
|
| 112 |
+
```python
|
| 113 |
+
model, _ = FastLanguageModel.from_pretrained(
|
| 114 |
+
model_name = model_name,
|
| 115 |
+
max_seq_length = max_seq_length,
|
| 116 |
+
dtype = dtype,
|
| 117 |
+
load_in_4bit = load_in_4bit,
|
| 118 |
+
resize_model_vocab=139336,
|
| 119 |
+
# token = "hf_...", # use one if using gated models like meta-llama/Llama-2-7b-hf
|
| 120 |
+
)
|
| 121 |
+
```
|
| 122 |
|
| 123 |
+
### Load our extended tokenizer
|
| 124 |
+
```python
|
| 125 |
+
tokenizer = AutoTokenizer.from_pretrained("polyglots/Extended-Sinhala-LLaMA")
|
| 126 |
+
model.resize_token_embeddings(len(tokenizer))
|
| 127 |
```
|
| 128 |
|
| 129 |
## Training Details
|