Update README.md
Browse files
README.md
CHANGED
|
@@ -23,6 +23,28 @@ You can install the required packages using pip:
|
|
| 23 |
pip install torch transformers
|
| 24 |
```
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
```py
|
| 27 |
# Ignore warnings
|
| 28 |
logging.set_verbosity(logging.CRITICAL)
|
|
|
|
| 23 |
pip install torch transformers
|
| 24 |
```
|
| 25 |
|
| 26 |
+
```py
|
| 27 |
+
# loading tokenizer & model
|
| 28 |
+
model_id = "Ahanaas/Hermes-3-Llama-3.1-8B_finetune_prashu"
|
| 29 |
+
|
| 30 |
+
import torch
|
| 31 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, TrainingArguments
|
| 32 |
+
|
| 33 |
+
# Load base model
|
| 34 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 35 |
+
model_id,
|
| 36 |
+
quantization_config=bnb_config,
|
| 37 |
+
device_map='auto'
|
| 38 |
+
)
|
| 39 |
+
model.config.use_cache = False
|
| 40 |
+
model.config.pretraining_tp = 1
|
| 41 |
+
|
| 42 |
+
# Load tokenizer
|
| 43 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
| 44 |
+
tokenizer.pad_token = tokenizer.eos_token
|
| 45 |
+
tokenizer.padding_side = "right" # Fix weird overflow issue with fp16 training
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
```py
|
| 49 |
# Ignore warnings
|
| 50 |
logging.set_verbosity(logging.CRITICAL)
|