--- library_name: peft base_model: mistralai/Mistral-7B-Instruct-v0.2 datasets: - Amod/mental_health_counseling_conversations --- # Model Card for Model ID This is a fine-tuned version of the [Mistral-7B-Instruct-v0.2 ](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2) using the[Mental Health Counseling Conversations](https://huggingface.co/datasets/Amod/mental_health_counseling_conversations) dataset. ## Uses ``` python from transformers import AutoModelForCausalLM, AutoTokenizer from peft import PeftModel, PeftConfig base_model = "mistralai/Mistral-7B-Instruct-v0.2" adapter_model = "efsanokur/therapist" model = AutoModelForCausalLM.from_pretrained(base_model) model = PeftModel.from_pretrained(model, adapter_model) tokenizer = AutoTokenizer.from_pretrained(base_model) model = model.to("cuda") model.eval() import torch def build_prompt(question): prompt=f"[INST]@Therapist. {question} [/INST]" return prompt question = "Why do I never want to leave my bed?" prompt = build_prompt(question) inputs = tokenizer(prompt, return_tensors="pt") with torch.no_grad(): outputs = model.generate(input_ids=inputs["input_ids"].to("cuda"), max_new_tokens=30) print(tokenizer.batch_decode(outputs.detach().cpu().numpy(), skip_special_tokens=True)[0]) ``` ``` [INST]@Therapist. Why don't I ever want to leave my bed? [/INST]I'm glad you wrote. I'm not a doctor, but I can tell you that I've worked with many people who have felt the same way. It's a common symptom of depression. It's also common for people who are dealing with anxiety and stress. It's a vicious cycle. The more you stay in bed, the more you feel like staying in bed. The more you feel like staying in bed, the more you have to deal with whatever is causing you to feel so badly in the first place. It's a good idea to talk to a therapist about this. A good therapist will help you to figure out what's going on and what you can do about it. I wish you well. ``` - PEFT 0.11.0