File size: 4,766 Bytes
f300c80 7661de5 f300c80 e7ee838 f300c80 6637c4a edaae33 6637c4a 939553d 7661de5 f300c80 7661de5 f300c80 7661de5 f300c80 7661de5 f300c80 7661de5 e7ee838 7661de5 f300c80 7661de5 f300c80 7661de5 f300c80 7661de5 f300c80 7661de5 f300c80 7661de5 f300c80 7661de5 f300c80 22a7edd 7661de5 f300c80 7661de5 f300c80 7661de5 f300c80 7661de5 f300c80 7661de5 f300c80 7661de5 f300c80 7661de5 f300c80 7661de5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
---
library_name: transformers
license: apache-2.0
datasets:
- rhaymison/mental-health-qa
language:
- pt
pipeline_tag: text-generation
base_model: rhaymison/Mistral-portuguese-luana-7b
tags:
- health
- portuguese
---
# Mistral-portuguese-luana-7b-mental-health
<p align="center">
<img src="https://raw.githubusercontent.com/rhaymisonbetini/huggphotos/main/luana-hel.jpeg" width="50%" style="margin-left:'auto' margin-right:'auto' display:'block'"/>
</p>
Luana Mental health is a tuned model of the Luana-7b based on the Mistral 7b architecture.
The model was adjusted to address topics such as depression, problems at work, mental health, problems with studies, drugs and others.
# How to use
You can use the model in its normal form up to 4-bit quantization. Below we will use both approaches.
Remember that verbs are important in your prompt. Tell your model how to act or behave so that you can guide them along the path of their response.
Important points like these help models (even smaller models like 7b) to perform much better.
```python
!pip install -q -U transformers
!pip install -q -U accelerate
!pip install -q -U bitsandbytes
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
model = AutoModelForCausalLM.from_pretrained("rhaymison/Mistral-portuguese-luana-7b-mental-health", device_map= {"": 0})
tokenizer = AutoTokenizer.from_pretrained("rhaymison/Mistral-portuguese-luana-7b-mental-health")
model.eval()
```
You can use with Pipeline but in this example i will use such as Streaming
```python
inputs = tokenizer([f"""<s>Aja como um conselheira de pessoas que estão passandos por dificuldades.
Responda sempre de maneira educada e procure ajudar as pessoas.
[INST] Olá, estou tendo muitos problemas pessoais, briga com meus pais. Tenho tido problemas no trabalho. Preciso de ajuda[/INST]"""], return_tensors="pt")
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
_ = model.generate(**inputs, streamer=streamer, max_new_tokens=200)
#Olá, estou aqui para ajudá-lo. É normal enfrentar problemas pessoais, mas é importante buscar ajuda.
#Vamos conversar sobre suas brigas com seus pais e como podemos resolver isso. Além disso, vamos falar sobre seus problemas no trabalho e como podemos encontrar
#soluções para isso. Você não está sozinho, estou aqui para ajudá-lo. Vamos começar a encontrar maneiras de lidar com essas questões.
#Você gostaria de começar falando sobre sua situação com seus pais?
#Ou talvez queremos começar falando sobre seus problemas no trabalho? O que você acha melhor? Você pode me contar mais sobre isso?
#Estou aqui para ajudá-lo.
```
```python
inputs = tokenizer([f"""<s>Aja como um conselheira de pessoas que estão passandos por dificuldades.
Responda sempre de maneira educada e procure ajudar as pessoas.
[INST] Minha esposa pensa em me deixar, meu chefe só briga comigo no trabalho. Eu estou pensando em tirar minha vida... Não sei mais o que fazer [/INST]"""], return_tensors="pt")
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
_ = model.generate(**inputs, streamer=streamer, max_new_tokens=200)
#Sinto muito por tudo o que você está passando. É importante que você saiba que não está sozinho e que existem pessoas dispostas a ajudá-lo.
#A primeira coisa que você pode fazer é procurar ajuda profissional, como terapia ou aconselhamento.
#É importante falar sobre seus sentimentos e pensamentos com alguém que possa oferecer suporte e orientação.
#Além disso, é fundamental buscar ajuda de emergência se você estiver tendo pensamentos suicidas.
#Lembre-se de que a vida é valiosa e que existem maneiras de superar os desafios.
#Você merece apoio e cuidado. Não hesite em buscar ajuda.
#Você não está sozinho nessa jornada.
```
# 4bits
```python
from transformers import BitsAndBytesConfig
import torch
nb_4bit_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_use_double_quant=True
)
model = AutoModelForCausalLM.from_pretrained(
base_model,
quantization_config=bnb_config,
device_map={"": 0}
)
```
### Comments
Any idea, help or report will always be welcome.
email: [email protected]
<div style="display:flex; flex-direction:row; justify-content:left">
<a href="https://www.linkedin.com/in/heleno-betini-2b3016175/" target="_blank">
<img src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white">
</a>
<a href="https://github.com/rhaymisonbetini" target="_blank">
<img src="https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white">
</a>
|