Downloads · 30 days
0
PhaaNe/gpt_depression
gpt_depression is a text classification model from PhaaNe. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
This model is a fine-tuned version of openai/gpt-oss-20b for depression detection in text. It uses QLoRA (Quantized LoRA) fine-tuning to efficiently adapt the large language model for binary classification of depressi…
Downloads · 30 days
0
Access
Public
Updated Sep 16, 2025
Repo size
124 MB
Likes
0
Public
Click a slice to open those files.
.safetensors127 MB · 59%
From the Hugging Face model README
This model is a fine-tuned version of openai/gpt-oss-20b for depression detection in text. It uses QLoRA (Quantized LoRA) fine-tuning to efficiently adapt the large language model for binary classification of depression indicators in text.
pip install transformers torch peft accelerate bitsandbytes
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
# Load model and tokenizer
model_id = "openai/gpt-oss-20b"
adapter_id = "PhaaNe/gpt_depression"
# Configure quantization
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True,
bnb_4bit_compute_dtype=torch.bfloat16,
)
# Load base model
tokenizer = AutoTokenizer.from_pretrained(model_id)
base_model = AutoModelForCausalLM.from_pretrained(
model_id,
quantization_config=bnb_config,
device_map="auto",
torch_dtype=torch.bfloat16,
)
# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, adapter_id)
# Prepare input
text = "I feel hopeless and nothing seems to matter anymore. I cant find joy in anything."
instruction = "Analyze this text for depression indicators. Respond depression or non-depression:"
prompt = f"{instruction}
{text}
"
# Tokenize and generate
inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=1024)
inputs = {k: v.to(model.device) for k, v in inputs.items()}
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=10,
do_sample=False,
pad_token_id=tokenizer.eos_token_id,
)
# Decode response
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
prediction = response[len(prompt):].strip()
print(f"Prediction: {prediction}")
The model was trained on a depression detection dataset with the following characteristics:
This model is designed for research and educational purposes in mental health text analysis. It can be used to:
If you use this model in your research, please cite:
@misc{gpt_depression_2024,
title={GPT-OSS 20B Depression Detection},
author={PhaaNe},
year={2024},
publisher={Hugging Face},
url={https://huggingface.co/PhaaNe/gpt_depression}
}
This model is released under the Apache 2.0 License.