Downloads · 30 days
0
AhmedBou/Arabic-Meta-Llama-3.1-8B-LoRA
Arabic-Meta-Llama-3.1-8B-LoRA is a machine learning model from AhmedBou. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
A suitable name for this section could be:
Downloads · 30 days
0
Access
Public
Updated Jul 29, 2024
Repo size
168 MB
Likes
0
Public
Click a slice to open those files.
.safetensors168 MB · 95%
From the Hugging Face model README
A suitable name for this section could be:
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.
# 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
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)
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|>
This llama model was trained 2x faster with Unsloth and Huggingface's TRL library.