File size: 3,030 Bytes
c8714ea
 
 
 
eafcbce
c8714ea
 
 
 
 
 
 
eafcbce
 
c8714ea
 
db1a727
8b8dd27
db1a727
 
 
 
 
 
 
 
eafcbce
f85ddba
eafcbce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a102156
95acb72
a102156
eafcbce
a102156
 
 
 
 
 
 
 
 
 
 
 
eafcbce
c9f8e17
c8714ea
 
 
 
 
 
eafcbce
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
base_model: unsloth/meta-llama-3.1-8b-bnb-4bit
language:
- en
- ar
license: apache-2.0
tags:
- text-generation-inference
- transformers
- unsloth
- llama
- trl
datasets:
- AhmedBou/Arabic_instruction_dataset_for_llm_ft
---

A suitable name for this section could be:

# Model Description

This model is fine-tuned from LLama 3.1 8B, enhanced for improved capability in the Arabic language. 
It was fine-tuned on 10,000 samples using Alpaca prompt instructions.

Please refer to this repository when using the model.

## To perform inference using these LoRA adapters, please use the following code:


````Python
# Installs Unsloth, Xformers (Flash Attention) and all other packages!
!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
!pip install --no-deps "xformers<0.0.27" "trl<0.9.0" peft accelerate bitsandbytes
````

````Python
from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained(
    model_name = "AhmedBou/Arabic-Meta-Llama-3.1-8B_LoRA", # YOUR MODEL YOU USED FOR TRAINING
    max_seq_length = 2048,
    dtype = None,
    load_in_4bit = True,
)
FastLanguageModel.for_inference(model) # Enable native 2x faster inference

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.

### Instruction:
{}

### Input:
{}

### Response:
{}"""

inputs = tokenizer(
[
    alpaca_prompt.format(
        "قم بصياغة الجملة الإنجليزية التالية باللغة العربية.", # instruction
        "We hope that the last cases will soon be resolved through the mechanisms established for this purpose.", # input
        "", # output - leave this blank for generation!
    )
], return_tensors = "pt").to("cuda")

from transformers import TextStreamer
text_streamer = TextStreamer(tokenizer)
_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 128)
````

````Markdown

The Outout is:

<|begin_of_text|>Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.

### Instruction:
قم بصياغة الجملة الإنجليزية التالية باللغة العربية.

### Input:
We hope that the last cases will soon be resolved through the mechanisms established for this purpose.

### Response:
وأملنا في أن يكون هناك حل سريع للمواد الأخيرة من خلال الآليات المحددة لهذا الغرض.<|end_of_text|>

````

# Uploaded  model
- **Developed by:** AhmedBou
- **License:** apache-2.0
- **Finetuned from model :** unsloth/meta-llama-3.1-8b-bnb-4bit

This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.

[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)