CoolFace
Modelpublic

mabaashar/allam-7b-mental-health-merged

sourceHugging Faceapache-2.0updated 5d agoView on Hugging Face
1likes1.6kdownloads
Model Card

Uploaded model

  • —Developed by: Mohammed Abdullah Ba'ashar-mabaashar
  • —Website: https://www.bytsnbytes.com
  • —License: apache-2.0
  • —Finetuned from model : humain-ai/ALLaM-7B-Instruct-preview

Inference

  • —On a device with a GPU, run the following code -the code is optimized for kaggle/google colab notebooks:

==============================

!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"

import torch

from unsloth import FastLanguageModel

# 🚀 UPDATE THIS LINE WITH YOUR EXACT HUGGING FACE REPOSITORY HFMODELID = "mabaashar/allam-7b-mental-health-merged" MAXSEQLENGTH = 128

#1)fetching finetuned model from HF

print(f"📥 Fetching fine-tuned ALLaM from Hugging Face Hub: {HFMODELID}...") model, tokenizer = FastLanguageModel.frompretrained( modelname=HFMODELID, maxseqlength=MAXSEQLENGTH, loadin4bit=True, devicemap={"": torch.cuda.currentdevice()} )

print("⚡ Switching model over to fast inference mode...") FastLanguageModel.for_inference(model)

# Define your Arabic mental health test prompt question = "اشعر بنوبات غضب. ماذا أفعل ؟" prompt = f"User: {question}\nAssistant: "

inputs = tokenizer([prompt], return_tensors="pt").to("cuda")

print("\n🧠 Generating response from your fine-tuned ALLaM...") with torch.nograd(): outputs = model.generate( **inputs, maxnewtokens=150, usecache=True, temperature=0.7, topp=0.9, eostokenid=tokenizer.eostoken_id )

# Decode and extract the assistant's response cleanly generatedtext = tokenizer.batchdecode(outputs, skipspecialtokens=True)[0] response = generated_text.split("Assistant:")[-1].strip()

print("\n================== 🩺 ALLaM Response ==================") print(response) print("======================================================")

==============================

#Results

The custom fine-tuning approach significantly improved model accuracy, achieving an 84.21% alignment with dialectal Arabic and successfully reducing "Modern Standard Arabic leakage" down to just 6.21%, creating a more natural and empathetic tone for therapeutic contexts.

========= Fine-tuned by Mohammed Abdullah Ba'ashar:

<img src="https://www.bytsnbytes.com/static/website/logo_prod_2.png" width="200"/>