BEncoderRT/tinyllama-mentalchat-lora
010
1---2license: apache-2.03language:4- en5base_model:6- TinyLlama/TinyLlama-1.1B-Chat-v1.07pipeline_tag: text-classification8datasets:9- ShenLab/MentalChat16K10tags:11- unsloth12- lora13- peft14- mental-health15---16 17# TinyLlama MentalChat LoRA18 19This repository contains a **LoRA adapter** fine-tuned on the 20[ShenLab/MentalChat16K](https://huggingface.co/datasets/ShenLab/MentalChat16K) dataset 21for **mental health–related supportive dialogue**.22 23⚠️ **This is not a full model.** 24It is a lightweight **LoRA adapter** that must be used together with the base model.25 26---27 28## 🔍 Model Overview29 30- **Base Model**: TinyLlama/TinyLlama-1.1B-Chat-v1.0 31- **Fine-tuning Method**: LoRA (PEFT) 32- **Domain**: Mental health supportive conversations 33- **Language**: English 34- **Adapter Size**: ~50 MB 35 36---37 38## 📚 Training Data39 40The model was fine-tuned using the **MentalChat16K** dataset, which consists of41mental health–related conversations between users and assistants.42 43- **Dataset**: `ShenLab/MentalChat16K` 44- **Language**: English 45- **Task**: Supportive, empathetic responses in mental health contexts 46 47---48 49## 🚀 Usage50 51### Load Base Model + LoRA Adapter52 53```python54from unsloth import FastLanguageModel55from peft import PeftModel56import torch57 58# Load base model59base_model, tokenizer = FastLanguageModel.from_pretrained(60 "TinyLlama/TinyLlama-1.1B-Chat-v1.0",61 max_seq_length=2048,62 load_in_4bit=True,63)64 65# Load LoRA adapter66lora_model = PeftModel.from_pretrained(67 base_model,68 "BEncoderRT/tinyllama-mentalchat-lora",69)70 71FastLanguageModel.for_inference(lora_model)72FastLanguageModel.for_inference(base_model)73 74def generate(model, prompt, max_new_tokens=200):75 inputs = tokenizer(prompt, return_tensors="pt").to("cuda")76 77 with torch.no_grad():78 outputs = model.generate(79 **inputs,80 max_new_tokens=max_new_tokens,81 do_sample=True,82 temperature=0.7,83 top_p=0.9,84 )85 86 return tokenizer.decode(outputs[0], skip_special_tokens=True)87 88---89 90prompt = """### Instruction:91I feel empty and hopeless lately. Nothing seems meaningful.92 93### Response:94"""95 96print("=== Base Model ===")97print(generate(base_model, prompt))98 99print("\n=== LoRA Model ===")100print(generate(lora_model, prompt))101 102 103 104 105=== Base Model ===106### Instruction:107I feel empty and hopeless lately. Nothing seems meaningful.108 109### Response:110It'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.111 112As 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.113 114Another 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 surrounded115 116 117 118=== LoRA Model ===119### Instruction:120I feel empty and hopeless lately. Nothing seems meaningful.121 122### Response:123It'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.124 125Remember 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.126 127Remember 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.128 129I hope these suggestions help you feel more supported and less alone. Remember that you'