Ali-Forootani
commited on
Commit
•
2031406
1
Parent(s):
5fe1b83
Update README.md
Browse files
README.md
CHANGED
@@ -160,7 +160,7 @@ Finally, we can train the model using the ORPOTrainer, which acts as a wrapper.
|
|
160 |
|
161 |
|
162 |
```python
|
163 |
-
|
164 |
dataset_name = "/data/bio-eng-llm/llm_repo/mlabonne/OrpoLlama-3-8B"
|
165 |
|
166 |
dataset = load_dataset(dataset_name, split="all")
|
@@ -242,13 +242,8 @@ Training the model on these 1,000 samples and 20 epochs took about 22 hours on a
|
|
242 |
|
243 |
## Test the model
|
244 |
|
245 |
-
# -*- coding: utf-8 -*-
|
246 |
-
"""
|
247 |
-
Created on Wed Jul 3 15:57:22 2024
|
248 |
-
|
249 |
-
@author: Ali forootani
|
250 |
-
"""
|
251 |
|
|
|
252 |
```bash
|
253 |
pip install -U transformers datasets accelerate peft trl bitsandbytes wandb
|
254 |
pip install -qqq flash-attn
|
@@ -290,15 +285,6 @@ from trl import ORPOConfig, ORPOTrainer, setup_chat_format
|
|
290 |
|
291 |
|
292 |
|
293 |
-
|
294 |
-
"""
|
295 |
-
https://huggingface.co/blog/mlabonne/orpo-llama-3
|
296 |
-
|
297 |
-
mlabonne/orpo-dpo-mix-40k
|
298 |
-
|
299 |
-
https://huggingface.co/datasets/mlabonne/orpo-dpo-mix-40k/tree/main
|
300 |
-
"""
|
301 |
-
|
302 |
if torch.cuda.get_device_capability()[0] >= 128:
|
303 |
|
304 |
attn_implementation = "flash_attention_2"
|
@@ -326,7 +312,7 @@ def setting_directory(depth):
|
|
326 |
sys.path.append(os.path.dirname(root_dir))
|
327 |
return root_dir
|
328 |
|
329 |
-
|
330 |
model_path = "/data/bio-eng-llm/llm_repo/mlabonne/OrpoLlama-3-8B"
|
331 |
|
332 |
|
@@ -375,6 +361,7 @@ model, tokenizer = setup_chat_format(model, tokenizer)
|
|
375 |
root_dir = setting_directory(0)
|
376 |
epochs = 20
|
377 |
|
|
|
378 |
new_model_path = root_dir + f"models/fine_tuned_models/OrpoLlama-3-8B_{epochs}e_qa_qa"
|
379 |
|
380 |
|
@@ -412,4 +399,10 @@ tokenizer.push_to_hub(repo_name, use_auth_token=True)
|
|
412 |
|
413 |
|
414 |
|
|
|
|
|
|
|
|
|
|
|
|
|
415 |
[More Information Needed]
|
|
|
160 |
|
161 |
|
162 |
```python
|
163 |
+
# I saved the dataset in my local directory! but you may not
|
164 |
dataset_name = "/data/bio-eng-llm/llm_repo/mlabonne/OrpoLlama-3-8B"
|
165 |
|
166 |
dataset = load_dataset(dataset_name, split="all")
|
|
|
242 |
|
243 |
## Test the model
|
244 |
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
|
246 |
+
### Required packages
|
247 |
```bash
|
248 |
pip install -U transformers datasets accelerate peft trl bitsandbytes wandb
|
249 |
pip install -qqq flash-attn
|
|
|
285 |
|
286 |
|
287 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
if torch.cuda.get_device_capability()[0] >= 128:
|
289 |
|
290 |
attn_implementation = "flash_attention_2"
|
|
|
312 |
sys.path.append(os.path.dirname(root_dir))
|
313 |
return root_dir
|
314 |
|
315 |
+
# I loaded the base model form local directory but you may load it directy from huggingface
|
316 |
model_path = "/data/bio-eng-llm/llm_repo/mlabonne/OrpoLlama-3-8B"
|
317 |
|
318 |
|
|
|
361 |
root_dir = setting_directory(0)
|
362 |
epochs = 20
|
363 |
|
364 |
+
# I loaded the fine tuned model from my local directory but you may have it somewhere elese
|
365 |
new_model_path = root_dir + f"models/fine_tuned_models/OrpoLlama-3-8B_{epochs}e_qa_qa"
|
366 |
|
367 |
|
|
|
399 |
|
400 |
|
401 |
|
402 |
+
https://huggingface.co/blog/mlabonne/orpo-llama-3
|
403 |
+
mlabonne/orpo-dpo-mix-40k
|
404 |
+
https://huggingface.co/datasets/mlabonne/orpo-dpo-mix-40k/tree/main
|
405 |
+
|
406 |
+
|
407 |
+
|
408 |
[More Information Needed]
|