Instructions to use NEU-HAI/mental-alpaca with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NEU-HAI/mental-alpaca with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="NEU-HAI/mental-alpaca")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("NEU-HAI/mental-alpaca") model = AutoModelForCausalLM.from_pretrained("NEU-HAI/mental-alpaca") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use NEU-HAI/mental-alpaca with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "NEU-HAI/mental-alpaca" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NEU-HAI/mental-alpaca", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/NEU-HAI/mental-alpaca
- SGLang
How to use NEU-HAI/mental-alpaca with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "NEU-HAI/mental-alpaca" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NEU-HAI/mental-alpaca", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "NEU-HAI/mental-alpaca" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NEU-HAI/mental-alpaca", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use NEU-HAI/mental-alpaca with Docker Model Runner:
docker model run hf.co/NEU-HAI/mental-alpaca
Model Card for mental-alpaca
This is a fine-tuned large language model for mental health prediction via online text data.
Model Details
Model Description
We fine-tune an Alpaca model with 4 high-quality text (6 tasks in total) datasets for the mental health prediction scenario: Dreaddit, DepSeverity, SDCNL, and CCRS-Suicide. We have a separate model, fine-tuned on FLAN-T5-XXL, namely Mental-FLAN-T5, shared here
- Developed by: Northeastern University Human-Centered AI Lab
- Model type: Sequence-to-sequence Text-generation
- Language(s) (NLP): English
- License: cc-by-nc-4.0
- Finetuned from model: https://github.com/tatsu-lab/stanford_alpaca
Model Sources [optional]
- Repository: https://github.com/neuhai/Mental-LLM
- Paper: https://arxiv.org/abs/2307.14385
Uses
Direct Use
The model is intended to be used for research purposes only in English. The model has been fine-tuned for mental health prediction via online text data. Detailed information about the fine-tuning process and prompts can be found in our paper. The use of this model should also comply with the restrictions from stanford_alpaca project and Llama-2-7b.
Out-of-Scope Use
The out-of-scope use of this model should comply with stanford_alpaca project and Llama-2-7b.
Bias, Risks, and Limitations
The Bias, Risks, and Limitations of this model should also comply with stanford_alpaca project and Llama-2-7b.
How to Get Started with the Model
Use the code below to get started with the model.
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("NEU-HAI/Llama-2-7b-alpaca-cleaned")
model = AutoModelForCausalLM.from_pretrained("NEU-HAI/Llama-2-7b-alpaca-cleaned")
Training Details and Evaluation
Detailed information about our work can be found in our paper.
Citation
@article{xu2023leveraging,
title={Mental-LLM: Leveraging large language models for mental health prediction via online text data},
author={Xu, Xuhai and Yao, Bingshen and Dong, Yuanzhe and Gabriel, Saadia and Yu, Hong and Ghassemi, Marzyeh and Hendler, James and Dey, Anind K and Wang, Dakuo},
journal={arXiv preprint arXiv:2307.14385},
year={2023}
}
- Downloads last month
- 1,043