Model Card for arafatanam/Mental-Support-Chat-DeepSeek-R1-Distill-Llama-8B

Model Details

Model Description

The arafatanam/Mental-Support-Chat-DeepSeek-R1-Distill-Llama-8B is a fine-tuned language model designed to offer empathetic and supportive mental health conversations. It provides evidence-based guidance, helping users manage stress, anxiety, and emotional well-being. The model was fine-tuned on mental health counseling datasets to enhance response quality, focusing on compassionate and informative interactions.

  • Developed by: Arafat Anam Chowdhury
  • Model type: Language Model
  • Language(s): Supports multiple languages
  • License: Apache 2.0
  • Fine-tuned from model: unsloth/DeepSeek-R1-Distill-Llama-8B

Model Sources

Training Details

The model was trained with a step-wise reduction in loss, indicating improved learning throughout the fine-tuning process.

  • Training Loss Progression:

    • Step 10: 3.2552
    • Step 50: 2.2021
    • Step 100: 1.9797
    • Step 200: 1.8936
    • Step 300: 1.8712
    • Step 320: 1.9309
  • Training Performance Summary:

    • Total FLOPs: 2.49e+17
    • Total Training Steps: 327
    • Final Training Loss: 1.9309
    • Training Runtime: 17,184.85 seconds
    • Samples per Second: 0.613
    • Steps per Second: 0.019

Uses

Direct Use

This model serves as a virtual mental health support assistant, generating responses for individuals experiencing stress, anxiety, or emotional distress. It can be integrated into chatbots and web applications that aim to provide emotional support.

Downstream Use

The model can be integrated into larger mental health platforms, community support systems, and mobile applications. It can be used in university counseling chatbots or digital self-care tools.

Out-of-Scope Use

  • Not for medical diagnosis: The model is not a replacement for professional therapy or psychological treatment.
  • Not suitable for high-risk situations: Users experiencing crises, suicidal thoughts, or severe mental health issues should seek professional help.

Bias, Risks, and Limitations

  • Bias in training data: The model may reflect biases present in the dataset, requiring ongoing evaluation.
  • Generalized advice: The model does not provide personalized therapy and should not replace professional support.
  • Sensitive topics: Users should be informed that responses are AI-generated and monitored for safety.

Recommendations

  • Clearly communicate that the model is for informational purposes only.
  • Continuous evaluation and fine-tuning are recommended to enhance fairness and inclusivity.
  • Implement human oversight in sensitive applications.

How to Get Started with the Model

# Install necessary libraries
!pip install -U torch transformers peft bitsandbytes

# Import required modules
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftConfig, PeftModel

# Define model and adapter
base_model = "deepseek-ai/deepseek-llm-8b-r1"
adapter = "arafatanam/Mental-Support-Chat-DeepSeek-R1-Distill-Llama-8B"

# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained(
    base_model,
    add_bos_token=True,
    trust_remote_code=True,
    padding_side='left'
)

# Load model with PEFT
config = PeftConfig.from_pretrained(adapter)
model = AutoModelForCausalLM.from_pretrained(
    config.base_model_name_or_path,
    load_in_4bit=True,
    device_map='auto',
    torch_dtype='auto'
)
model = PeftModel.from_pretrained(model, adapter)

# Move model to appropriate device
device = "cuda" if torch.cuda.is_available() else "cpu"
model.to(device)
model.eval()

# Define example input
user_message = [{"role": "user", "content":
    "I've been feeling really overwhelmed with everything going on in my life. "
    "I don’t know how to cope with the stress. Can you help me?"
}]

# Tokenize input
input_ids = tokenizer.apply_chat_template(
    conversation=user_message,
    tokenize=True,
    add_generation_prompt=True,
    return_tensors='pt'
).to(device)

# Generate response
output_ids = model.generate(
    input_ids=input_ids,
    max_new_tokens=512,
    do_sample=True,
    temperature=0.2,
    top_k=20,
    top_p=0.9,
    repetition_penalty=1.3,
    typical_p=0.95,
    num_beams=3,
    no_repeat_ngram_size=2,
    pad_token_id=tokenizer.pad_token_id,
    eos_token_id=tokenizer.eos_token_id
)

# Decode response
generated_ids = output_ids[:, input_ids.shape[1]:]
response = tokenizer.decode(generated_ids[0], skip_special_tokens=True).strip()

print("Generated Response:")
print(response)
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for arafatanam/Mental-Support-Chat-DeepSeek-R1-Distill-Llama-8B

Dataset used to train arafatanam/Mental-Support-Chat-DeepSeek-R1-Distill-Llama-8B