Skip to content

This project demonstrates the fine-tuning of the Phi-2 language model for mental health-focused applications such as sentiment analysis, therapy assistance, and early detection of mental health concerns. Through a carefully curated dataset and a detailed notebook, this repository bridges the gap between AI and mental wellness .

Notifications You must be signed in to change notification settings

ashkunwar/Mental-Health-Finetuning-Using-Phi-2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Fine-Tuning Phi-2 for Mental Health Applications

Overview

This repository contains a Jupyter Notebook showcasing the process of fine-tuning the Phi-2 language model for mental health-related tasks. The goal is to leverage advanced language understanding capabilities to assist in mental health applications such as sentiment analysis, therapy assistance, and early detection of mental health concerns.

Key Features

  • Model Fine-Tuning: Demonstrates fine-tuning the Phi-2 model using a curated dataset.
  • Dataset Handling: Preprocessing and exploration of the dataset tailored for mental health scenarios.
  • Training Pipeline: Comprehensive training loop with evaluation metrics for monitoring performance.
  • Use Cases: Highlights potential use cases in real-world applications, such as chatbot integration or textual analysis for mental health professionals.

Notebook Structure

  1. Introduction
    • Overview of the project goals and the importance of AI in mental health.
  2. Dataset Preparation
    • Steps for data cleaning, tokenization, and splitting into training, validation, and testing sets.
  3. Model Configuration
    • Configuration details for the Phi-2 model and hyperparameters used for fine-tuning.
  4. Training and Evaluation
    • Training loop implementation with metrics like accuracy, loss, and validation performance.
    • Visualization of training progress.
  5. Results and Insights
    • Analysis of the model's performance and limitations.
    • Discussion on ethical considerations in deploying AI for mental health.

Dataset

The dataset used for fine-tuning is marmikpandya from Hugging Face, containing 13,000 samples specifically curated for mental health applications.

Installation

To run the notebook, ensure you have the following dependencies installed:

  • Python 3.8+
  • Jupyter Notebook
  • Transformers (Hugging Face)
  • Datasets (Hugging Face)
  • Torch
  • Matplotlib
  • Scikit-learn

Install dependencies using:

pip install transformers datasets torch matplotlib scikit-learn

Usage

  1. Clone the repository:
    git clone https://github.com/yourusername/phi2-mental-health-finetuning.git
  2. Navigate to the repository:
    cd phi2-mental-health-finetuning
  3. Open the notebook:
    jupyter notebook "Phi-2 finetuning mental health.ipynb"
  4. Follow the steps in the notebook to fine-tune and evaluate the model.

Ethical Considerations

  • Ensure compliance with data privacy regulations when using sensitive mental health data.
  • Address biases in training data to avoid harmful outcomes.
  • Collaborate with mental health professionals for validation and deployment.

Contributions

Contributions are welcome! Feel free to open issues or submit pull requests for enhancements or bug fixes.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Acknowledgments

  • Hugging Face for providing robust NLP tools.
  • OpenAI for advancements in language models.
  • The mental health community for guiding responsible AI applications.

About

This project demonstrates the fine-tuning of the Phi-2 language model for mental health-focused applications such as sentiment analysis, therapy assistance, and early detection of mental health concerns. Through a carefully curated dataset and a detailed notebook, this repository bridges the gap between AI and mental wellness .

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published