Instructions to use GRMenon/mental-mistral-7b-instruct-autotrain with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use GRMenon/mental-mistral-7b-instruct-autotrain with PEFT:
Task type is invalid.
- Transformers
How to use GRMenon/mental-mistral-7b-instruct-autotrain with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="GRMenon/mental-mistral-7b-instruct-autotrain") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("GRMenon/mental-mistral-7b-instruct-autotrain") model = AutoModelForCausalLM.from_pretrained("GRMenon/mental-mistral-7b-instruct-autotrain") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use GRMenon/mental-mistral-7b-instruct-autotrain with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "GRMenon/mental-mistral-7b-instruct-autotrain" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GRMenon/mental-mistral-7b-instruct-autotrain", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/GRMenon/mental-mistral-7b-instruct-autotrain
- SGLang
How to use GRMenon/mental-mistral-7b-instruct-autotrain 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 "GRMenon/mental-mistral-7b-instruct-autotrain" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GRMenon/mental-mistral-7b-instruct-autotrain", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "GRMenon/mental-mistral-7b-instruct-autotrain" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GRMenon/mental-mistral-7b-instruct-autotrain", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use GRMenon/mental-mistral-7b-instruct-autotrain with Docker Model Runner:
docker model run hf.co/GRMenon/mental-mistral-7b-instruct-autotrain
Model Trained Using AutoTrain
This model was trained using AutoTrain and is a fine-tuned version of mistralai/Mistral-7B-Instruct-v0.2 on the mental_health_counseling_conversations dataset.
For more information, please visit AutoTrain.
Model description
A Mistral-7B-Instruct-v0.2 model finetuned on a corpus of mental health conversations between a psychologist and a user.
The intention was to create a mental health assistant, "Connor", to address user questions based on responses from a psychologist.
Training data
The model is finetuned on a corpus of mental health conversations between a psychologist and a client, in the form of context - response pairs. This dataset is a collection of questions and answers sourced from two online counseling and therapy platforms. The questions cover a wide range of mental health topics, and the answers are provided by qualified psychologists.
Dataset found here :-
Training hyperparameters
The following hyperparameters were used during training: TODO
Usage
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_path = "GRMenon/mental-mistral-7b-instruct-autotrain"
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(
model_path,
device_map="auto",
torch_dtype='auto'
).eval()
device = "cuda" if torch.cuda.is_available() else "cpu"
# Prompt content:
messages = [
{"role": "user", "content": "Hey Connor! I have been feeling a bit down lately. I could really use some advice on how to feel better?"}
]
input_ids = tokenizer.apply_chat_template(conversation=messages,
tokenize=True,
add_generation_prompt=True,
return_tensors='pt').to(device)
output_ids = model.generate(input_ids=input_ids,
max_new_tokens=512,
do_sample=True,
pad_token_id=2)
response = tokenizer.batch_decode(output_ids.detach().cpu().numpy(),
skip_special_tokens = True)
# Model response:
print(response[0])
- Downloads last month
- -