BEncoderRT commited on
Commit
51e5764
·
verified ·
1 Parent(s): 54fc316

Update README.md

Browse files

# 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
- **Parameter Size (Adapter)**: ~50MB

---

## 📚 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


from unsloth import FastLanguageModel
from peft import PeftModel
import torch

# Base model
base_model, tokenizer = FastLanguageModel.from_pretrained(
"TinyLlama/TinyLlama-1.1B-Chat-v1.0",
max_seq_length=2048,
load_in_4bit=True,
)

# LoRA model
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))

Files changed (1) hide show
  1. README.md +2 -0
README.md CHANGED
@@ -7,4 +7,6 @@ base_model:
7
  pipeline_tag: text-generation
8
  datasets:
9
  - ShenLab/MentalChat16K
 
 
10
  ---
 
7
  pipeline_tag: text-generation
8
  datasets:
9
  - ShenLab/MentalChat16K
10
+ tags:
11
+ - usloth
12
  ---