Update README.md
Browse files
README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
base_model: unsloth/meta-llama-3.1-8b-bnb-4bit
|
3 |
language:
|
4 |
- en
|
|
|
5 |
license: apache-2.0
|
6 |
tags:
|
7 |
- text-generation-inference
|
@@ -9,14 +10,61 @@ tags:
|
|
9 |
- unsloth
|
10 |
- llama
|
11 |
- trl
|
|
|
|
|
12 |
---
|
13 |
|
14 |
# Uploaded model
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
- **Developed by:** AhmedBou
|
17 |
- **License:** apache-2.0
|
18 |
- **Finetuned from model :** unsloth/meta-llama-3.1-8b-bnb-4bit
|
19 |
|
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)
|
|
|
2 |
base_model: unsloth/meta-llama-3.1-8b-bnb-4bit
|
3 |
language:
|
4 |
- en
|
5 |
+
- ar
|
6 |
license: apache-2.0
|
7 |
tags:
|
8 |
- text-generation-inference
|
|
|
10 |
- unsloth
|
11 |
- llama
|
12 |
- trl
|
13 |
+
datasets:
|
14 |
+
- AhmedBou/Arabic_instruction_dataset_for_llm_ft
|
15 |
---
|
16 |
|
17 |
# Uploaded model
|
18 |
|
19 |
+
For Inference Using thid LoRA adapters please use this code
|
20 |
+
|
21 |
+
````Python
|
22 |
+
# Installs Unsloth, Xformers (Flash Attention) and all other packages!
|
23 |
+
!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
|
24 |
+
!pip install --no-deps "xformers<0.0.27" "trl<0.9.0" peft accelerate bitsandbytes
|
25 |
+
````
|
26 |
+
|
27 |
+
````Python
|
28 |
+
from unsloth import FastLanguageModel
|
29 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
30 |
+
model_name = "AhmedBou/Arabic-Meta-Llama-3.1-8B_LoRA", # YOUR MODEL YOU USED FOR TRAINING
|
31 |
+
max_seq_length = 2048,
|
32 |
+
dtype = None,
|
33 |
+
load_in_4bit = True,
|
34 |
+
)
|
35 |
+
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
|
36 |
+
|
37 |
+
alpaca_prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
|
38 |
+
|
39 |
+
### Instruction:
|
40 |
+
{}
|
41 |
+
|
42 |
+
### Input:
|
43 |
+
{}
|
44 |
+
|
45 |
+
### Response:
|
46 |
+
{}"""
|
47 |
+
|
48 |
+
inputs = tokenizer(
|
49 |
+
[
|
50 |
+
alpaca_prompt.format(
|
51 |
+
"قم بصياغة الجملة الإنجليزية التالية باللغة العربية.", # instruction
|
52 |
+
"We hope that the last cases will soon be resolved through the mechanisms established for this purpose.", # input
|
53 |
+
"", # output - leave this blank for generation!
|
54 |
+
)
|
55 |
+
], return_tensors = "pt").to("cuda")
|
56 |
+
|
57 |
+
from transformers import TextStreamer
|
58 |
+
text_streamer = TextStreamer(tokenizer)
|
59 |
+
_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 128)
|
60 |
+
````
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
- **Developed by:** AhmedBou
|
65 |
- **License:** apache-2.0
|
66 |
- **Finetuned from model :** unsloth/meta-llama-3.1-8b-bnb-4bit
|
67 |
|
68 |
This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
69 |
|
70 |
+
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|