File size: 4,173 Bytes
2220b96 947b904 54fc316 51e5764 e2d4828 b6114f8 e2d4828 b6114f8 e2d4828 b6114f8 e2d4828 b6114f8 e2d4828 b6114f8 e2d4828 b6114f8 e2d4828 b6114f8 e2d4828 b6114f8 e2d4828 b6114f8 233e70c e2d4828 b6114f8 55e81ad 233e70c 55e81ad 233e70c 55e81ad |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
---
license: apache-2.0
language:
- en
base_model:
- TinyLlama/TinyLlama-1.1B-Chat-v1.0
pipeline_tag: text-classification
datasets:
- ShenLab/MentalChat16K
tags:
- unsloth
- lora
- peft
- mental-health
---
# TinyLlama MentalChat LoRA
This repository contains a **LoRA adapter** fine-tuned on the
[ShenLab/MentalChat16K](https://huggingface.co/datasets/ShenLab/MentalChat16K) dataset
for **mental health–related supportive dialogue**.
⚠️ **This is not a full model.**
It is a lightweight **LoRA adapter** that must be used together with the base model.
---
## 🔍 Model Overview
- **Base Model**: TinyLlama/TinyLlama-1.1B-Chat-v1.0
- **Fine-tuning Method**: LoRA (PEFT)
- **Domain**: Mental health supportive conversations
- **Language**: English
- **Adapter Size**: ~50 MB
---
## 📚 Training Data
The model was fine-tuned using the **MentalChat16K** dataset, which consists of
mental health–related conversations between users and assistants.
- **Dataset**: `ShenLab/MentalChat16K`
- **Language**: English
- **Task**: Supportive, empathetic responses in mental health contexts
---
## 🚀 Usage
### Load Base Model + LoRA Adapter
```python
from unsloth import FastLanguageModel
from peft import PeftModel
import torch
# Load base model
base_model, tokenizer = FastLanguageModel.from_pretrained(
"TinyLlama/TinyLlama-1.1B-Chat-v1.0",
max_seq_length=2048,
load_in_4bit=True,
)
# Load LoRA adapter
lora_model = PeftModel.from_pretrained(
base_model,
"BEncoderRT/tinyllama-mentalchat-lora",
)
FastLanguageModel.for_inference(lora_model)
FastLanguageModel.for_inference(base_model)
def generate(model, prompt, max_new_tokens=200):
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=max_new_tokens,
do_sample=True,
temperature=0.7,
top_p=0.9,
)
return tokenizer.decode(outputs[0], skip_special_tokens=True)
---
prompt = """### Instruction:
I feel empty and hopeless lately. Nothing seems meaningful.
### Response:
"""
print("=== Base Model ===")
print(generate(base_model, prompt))
print("\n=== LoRA Model ===")
print(generate(lora_model, prompt))
=== Base Model ===
### Instruction:
I feel empty and hopeless lately. Nothing seems meaningful.
### Response:
It's okay to feel like this. We all have moments where life seems empty and meaningless. It's important to remember that it's normal to feel this way sometimes. Remember that you are not alone in this, and that you can find ways to cope and find meaning in your life.
As we continue to talk, I'd like to explore some specific ways you can find meaning in your life. One possibility is by pursuing your passions. Do you have any hobbies or interests that bring you joy? Maybe exploring a new hobby or starting a hobby you've been wanting to try. This could be a great way to find a sense of purpose and fulfillment in your life.
Another idea could be to focus on the present moment. Take a few deep breaths and try to notice the sensations in your body. Notice the feelings of happiness or sadness that arise when you're surrounded
=== LoRA Model ===
### Instruction:
I feel empty and hopeless lately. Nothing seems meaningful.
### Response:
It's understandable that you're feeling down at the moment, but let's take a moment to acknowledge the emotions we're experiencing. Sometimes, it can be helpful to talk about our thoughts and feelings in a safe and non-judgmental space.
Remember that it's not just you who's going through this, but also the people around you. It's important to share your feelings with them, even if they're not the same as you. They may be able to provide you with some support and understanding.
Remember that this is a journey, and it's okay to take time to reflect on what's important to you. It's also important to remember that there are many ways to cope with stress and anxiety, including self-care, exercise, and spending time in nature.
I hope these suggestions help you feel more supported and less alone. Remember that you' |