Downloads · 30 days
10
2% of all-time downloads
Ahmed792/llama-3.1-8b-egyptian-legal
llama-3.1-8b-egyptian-legal is a text generation model from Ahmed792. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
This model is a fine-tuned version of Meta-Llama-3.1-8B-Instruct, optimized using the Unsloth framework and LoRA adapters. The final weights have been fully merged into a standalone 16-bit format for seamless, direct…
Downloads · 30 days
10
2% of all-time downloads
All-time downloads
444
Public
Parameters
8B
16.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors16.1 GB · 100%
From the Hugging Face model README
This model is a fine-tuned version of Meta-Llama-3.1-8B-Instruct, optimized using the Unsloth framework and LoRA adapters. The final weights have been fully merged into a standalone 16-bit format for seamless, direct inference.
The model was trained on a custom dataset containing Egyptian legal documents, contracts, and localized conversational pairs. It is designed to understand complex legal contexts and respond naturally in the Egyptian Arabic dialect.
You can use this model directly with the official Hugging Face transformers library without needing any extra complex frameworks:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# 1. Define model repository
model_name = "Ahmed792/llama-3.1-8b-egyptian-legal"
# 2. Load the tokenizer and the 16-bit merged model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.float16,
device_map="auto"
)
# 3. Formulate the prompt in Egyptian Arabic
messages = [
{"role": "user", "content": "لو سمحت، إيه هي الإجراءات القانونية لتأسيس شركة في مصر؟"}
]
# 4. Apply the Llama-3 conversational chat template
inputs = tokenizer.apply_chat_template(messages, tokenize=True, return_tensors="pt").to("cuda")
# 5. Generate the response
outputs = model.generate(inputs, max_new_tokens=256, temperature=0.5)
# 6. Decode and print the clean output
print(tokenizer.decode(outputs[0], skip_special_tokens=True))