finetuned-qlora-falcon7b-medical
Finetuning of Falcon-7B LLM using QLoRA on Mental Health Conversational Dataset
https://github.com/iamarunbrahma/finetuned-qlora-falcon7b-medical
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.7%) to scientific vocabulary
Keywords
Repository
Finetuning of Falcon-7B LLM using QLoRA on Mental Health Conversational Dataset
Basic Info
Statistics
- Stars: 261
- Watchers: 4
- Forks: 27
- Open Issues: 1
- Releases: 0
Topics
Metadata Files
README.md
Finetuning of Falcon-7B LLM using QLoRA on Mental Health Conversational Dataset
Introduction:
Mental health issues are often misunderstood or not fully grasped by the general public. This lack of understanding can lead to fear, discomfort, and negative perceptions about mental health conditions. Media portrayals of mental health often perpetuate negative stereotypes, leading to misconceptions and fear. Overcoming mental health stigma requires a multi-faceted approach that involves education, raising awareness, promoting empathy and understanding, challenging stereotypes, and ensuring accessible and quality mental health care. Mental health directly impacts an individual's overall well-being, quality of life, and ability to function effectively in daily life. Good mental health is essential for experiencing happiness, fulfilment, and a sense of purpose. Mental health and physical health are closely intertwined. Untreated mental health issues can lead to or worsen physical health problems, such as cardiovascular diseases, weakened immune systems, and chronic conditions.
Core Rationale:
Chatbots offer a readily available and accessible platform for individuals seeking support. They can be accessed anytime and anywhere, providing immediate assistance to those in need. Chatbots can offer empathetic and non-judgmental responses, providing emotional support to users. While they cannot replace human interaction entirely, they can be a helpful supplement, especially in moments of distress.
NOTE: It is important to note that while mental health chatbots can be helpful, they are not a replacement for professional mental health care. They can complement existing mental health services by providing additional support and resources.
Dataset:
The dataset was curated from online FAQs related to mental health, popular healthcare blogs like WebMD, Mayo Clinic and Healthline, and other wiki articles related to mental health. The dataset was pre-processed in a conversational format such that both questions asked by the patient and responses given by the doctor are in the same text. The dataset for this mental health conversational AI can be found here: heliosbrahma/mentalhealthchatbot_dataset.
NOTE: All questions and answers have been anonymized to remove any PII data and preprocessed to remove any unwanted characters.
Model Finetuning:
This is the major step in the entire project. I have used sharded Falcon-7B pre-trained model and finetuned it to using the QLoRA technique on my custom mental health dataset. The entire finetuning process took less than an hour and it was finetuned entirely on Nvidia A100 from Google Colab Pro. But, it could also be trained on free-tier GPU using Nvidia T4 provided by Colab. In that case, we have to ensure to use maxsteps less than 150.
The rationale behind using sharded pre-trained model is mentioned in my blog post: Fine-tuning of Falcon-7B Large Language Model using QLoRA on Mental Health Dataset
Adding here the training loss metrics tracking report from WandB monitoring logs for 180 steps training run: train/loss logs for Falcon-7B PEFT
NOTE: _Try changing hyperparameters in TrainingArguments and LoraConfig based on your requirements. With the settings mentioned in notebook, I achieved 0.031 training loss after 320 steps.
Model Inference:
PEFT fine-tuned model has been updated here: heliosbrahma/falcon-7b-sharded-bf16-finetuned-mental-health-conversational.
Run gradio_chatbot_app.ipynb notebook to get a chatbot like interface using Gradio as frontend for demo. Play around with different hyperparameter config settings for answer generation and run multiple queries to check for the quality of generated response.
It takes less than 3 minutes to generate the model response. Compare the PEFT model response with the original model response in funetuned_qlora_falcon7b.ipynb notebook.
Conclusion:
I have written a detailed technical blog explaining key concepts of QLoRA and PEFT fine-tuning method: Fine-tuning of Falcon-7B Large Language Model using QLoRA on Mental Health Dataset. If you still have any queries, you can open an issue on this repo or comment on my blog.
If you like this project, please :star: this repository.
Owner
- Name: Arun Brahma
- Login: iamarunbrahma
- Kind: user
- Repositories: 46
- Profile: https://github.com/iamarunbrahma
Senior Machine Learning Engineer
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Brahma" given-names: "Arun" title: "Finetuning of Falcon-7B LLM using QLoRA on Mental Health Conversational Dataset" date-released: 2023-09-03 url: "https://github.com/iamarunbrahma/finetuned-qlora-falcon7b-medical"
GitHub Events
Total
- Issues event: 1
- Watch event: 18
- Issue comment event: 1
- Fork event: 1
Last Year
- Issues event: 1
- Watch event: 18
- Issue comment event: 1
- Fork event: 1
Committers
Last synced: 12 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Arun Brahma | m****4@g****m | 18 |
| Arun Brahma | a****a@A****l | 2 |
Issues and Pull Requests
Last synced: 9 months ago
All Time
- Total issues: 2
- Total pull requests: 0
- Average time to close issues: over 1 year
- Average time to close pull requests: N/A
- Total issue authors: 2
- Total pull request authors: 0
- Average comments per issue: 1.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- PRANJALRANA11 (1)