MohammedNasser's picture
Update README.md
ab343f1 verified
metadata
library_name: transformers
license: apache-2.0
datasets:
  - MohammedNasser/Arabic_Reasoning_Instruct_QA
language:
  - ar
base_model:
  - silma-ai/SILMA-9B-Instruct-v1.0
pipeline_tag: question-answering

๐ŸŒŸ MohammedNaaser/silma_9b_instruct_ft ๐ŸŒŸ

HF Model Card Python PEFT RAG

๐Ÿš€ Fine-Tuned Arabic Language Model for Enhanced Reasoning and Instructive Tasks ๐Ÿš€

๐Ÿง  Model Overview

Welcome to silma_9b_instruct_ft, an advanced fine-tuned version of the SILMA-9B-Instruct, crafted to boost reasoning capabilities and improve response quality in Arabic-language tasks. This model is tailored for causal language modeling (CAUSAL_LM) and has been optimized using parameter-efficient fine-tuning (PEFT) with LoraConfig.

๐Ÿ”ง Key Features

  • Reasoning Enhancement ๐Ÿงฉ: Fine-tuned specifically for handling complex reasoning tasks in Arabic.
  • PEFT for Efficient Fine-Tuning ๐Ÿ“Š: Employs the LoRA (Low-Rank Adaptation) technique for lightweight and effective fine-tuning.
  • Customizable Attention ๐ŸŽฏ: Incorporates custom attention modules (q_proj, k_proj, v_proj, etc.) to tailor focus during task processing.

๐ŸŽฏ Usage

Here's how to load and start using the model for inference or further fine-tuning:

from transformers import AutoTokenizer, AutoModelForCausalLM

# Load the tokenizer and model
tokenizer = AutoTokenizer.from_pretrained("MohammedNaaser/silma_9b_instruct_ft")
model = AutoModelForCausalLM.from_pretrained("MohammedNaaser/silma_9b_instruct_ft")

# Example inference
input_text = """
ููŠ ุฅุญุฏู‰ ุงู„ุฃู„ุนุงุจุŒ ูŠุฑุจุญ ุงู„ู„ุงุนุจ 3 ู†ู‚ุงุท ุฅุฐุง ูุงุฒุŒ ูˆูŠุฎุณุฑ ู†ู‚ุทุชูŠู† ุฅุฐุง ุฎุณุฑ
ุŒูˆู„ุง ูŠุญุตู„ ุนู„ู‰ ุฃูŠ ู†ู‚ุงุท ุฅุฐุง ุชุนุงุฏู„.
 ุฅุฐุง ู„ุนุจ 20 ู…ุจุงุฑุงุฉ ูˆุงู†ุชู‡ู‰ ุจุฑุตูŠุฏ 15 ู†ู‚ุทุฉุŒ
 ูู…ุง ุฃู‚ู„ ุนุฏุฏ ู…ู† ุงู„ู…ุจุงุฑูŠุงุช ุงู„ุชูŠ ูŠู…ูƒู† ุฃู† ูŠูƒูˆู† ู‚ุฏ ูุงุฒ ุจู‡ุงุŸ
""""
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**inputs)

print(tokenizer.decode(outputs[0], skip_special_tokens=True))

๐Ÿš€ Deployment with Hugging Face Spaces and Gradio

Want to deploy your own interactive chat or Q&A system using this model? Check out Gradio for creating simple UIs!
Create Your Space Here!


โš™๏ธ Training Setup

๐Ÿ“ Fine-Tuning Parameters

  • Base Model: silma-ai/SILMA-9B-Instruct-v1.0
  • Trainer: SFTTrainer from TRL
  • Quantization Config: BitsAndBytesConfig (4-bit with nf4 type)
  • LoRA Parameters:
    • lora_alpha: 16
    • lora_dropout: 0.1
    • lora_r: 4
    • Target modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj

๐Ÿ› ๏ธ File Overview

After saving the fine-tuned model, the following files are generated:

  • adapter_config.json: Configuration file for LoRA adapters.
  • adapter_model.safetensor: Serialized fine-tuned model weights.
  • tokenizer.json, tokenizer_config.json: Tokenizer configuration files.
  • special_tokens_map.json: Mapping for special tokens like [BOS] and [EOS].
  • tokenizer.model: The model used for tokenization.

๐Ÿ”‘ License & Citation

This model is released under the Apache License. If you use it in your work, please consider citing the original SILMA model and the fine-tuning method as follows:

@misc{MohammedNasser_silma9b_ft,
  author = {Mohammed Nasser},
  title = {Fine-Tuning Arabic Instructive Models with PEFT and LoRA},
  year = {2024},
  url = {https://huggingface.co/MohammedNaaser/silma_9b_instruct_ft},
}

๐Ÿง‘โ€๐Ÿ’ป Contributing

Contributions are welcome! If you find any issues or would like to improve this model further, feel free to open an issue or submit a pull request. Let's push the boundaries of Arabic NLP together!