Instructions to use DHEIVER/Medical-ChatBot with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DHEIVER/Medical-ChatBot with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="DHEIVER/Medical-ChatBot")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("DHEIVER/Medical-ChatBot") model = AutoModelForCausalLM.from_pretrained("DHEIVER/Medical-ChatBot") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use DHEIVER/Medical-ChatBot with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "DHEIVER/Medical-ChatBot" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "DHEIVER/Medical-ChatBot", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/DHEIVER/Medical-ChatBot
- SGLang
How to use DHEIVER/Medical-ChatBot 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 "DHEIVER/Medical-ChatBot" \ --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": "DHEIVER/Medical-ChatBot", "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 "DHEIVER/Medical-ChatBot" \ --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": "DHEIVER/Medical-ChatBot", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use DHEIVER/Medical-ChatBot with Docker Model Runner:
docker model run hf.co/DHEIVER/Medical-ChatBot
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,56 +1,53 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
- en
|
| 9 |
-
library_name: transformers
|
| 10 |
-
---
|
| 11 |
-
Please note that the chatbot is designed for research purposes only and is not intended for use in real medical settings. While the chatbot has been trained to provide accurate and helpful responses, it is not a substitute for professional medical advice, diagnosis, or treatment. The information provided by the chatbot should not be used to make medical decisions, and any health concerns should be addressed by a licensed healthcare provider.
|
| 12 |
-
|
| 13 |
-
## Quickstart
|
| 14 |
|
| 15 |
```python
|
| 16 |
import torch
|
| 17 |
from transformers import GPT2LMHeadModel, GPT2Tokenizer
|
| 18 |
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
tokenizer = GPT2Tokenizer.from_pretrained(
|
| 23 |
-
|
| 24 |
|
| 25 |
-
|
| 26 |
-
"
|
| 27 |
-
"[|
|
| 28 |
-
"[|
|
| 29 |
)
|
| 30 |
-
|
| 31 |
-
inputs = tokenizer(
|
| 32 |
|
| 33 |
with torch.no_grad():
|
| 34 |
-
beam_output =
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
print(tokenizer.decode(beam_output[0], skip_special_tokens=True))
|
| 43 |
```
|
| 44 |
|
| 45 |
-
##
|
|
|
|
| 46 |
```
|
| 47 |
-
|
| 48 |
-
[|
|
| 49 |
-
[|
|
| 50 |
```
|
| 51 |
|
| 52 |
```
|
| 53 |
-
|
| 54 |
-
[|
|
| 55 |
-
[|
|
| 56 |
-
```
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
|
| 3 |
+
## Aviso Legal
|
| 4 |
+
|
| 5 |
+
Este chatbot foi projetado apenas para fins de pesquisa e não se destina ao uso em configurações médicas reais. Embora o chatbot tenha sido treinado para fornecer respostas precisas e úteis, ele não substitui o aconselhamento médico profissional, o diagnóstico ou o tratamento. As informações fornecidas pelo chatbot não devem ser usadas para tomar decisões médicas, e quaisquer preocupações com a saúde devem ser tratadas por um profissional de saúde licenciado.
|
| 6 |
+
|
| 7 |
+
## Início Rápido
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
```python
|
| 10 |
import torch
|
| 11 |
from transformers import GPT2LMHeadModel, GPT2Tokenizer
|
| 12 |
|
| 13 |
|
| 14 |
+
caminho = "Mohammed-Altaf/Medical-ChatBot"
|
| 15 |
+
dispositivo = "cuda" if torch.cuda.is_available() else "cpu"
|
| 16 |
+
tokenizer = GPT2Tokenizer.from_pretrained(caminho)
|
| 17 |
+
modelo = GPT2LMHeadModel.from_pretrained(caminho).to(dispositivo)
|
| 18 |
|
| 19 |
+
entrada_prompt = (
|
| 20 |
+
"A conversa entre humano e assistente de IA.\n"
|
| 21 |
+
"[|Humano|] {input}\n"
|
| 22 |
+
"[|IA|]"
|
| 23 |
)
|
| 24 |
+
frase = entrada_prompt.format_map({'input': "o que é a doença de Parkinson?"})
|
| 25 |
+
inputs = tokenizer(frase, return_tensors="pt").to(dispositivo)
|
| 26 |
|
| 27 |
with torch.no_grad():
|
| 28 |
+
beam_output = modelo.generate(**inputs,
|
| 29 |
+
min_new_tokens=1,
|
| 30 |
+
max_length=512,
|
| 31 |
+
num_beams=3,
|
| 32 |
+
repetition_penalty=1.2,
|
| 33 |
+
early_stopping=True,
|
| 34 |
+
eos_token_id=198
|
| 35 |
+
)
|
| 36 |
print(tokenizer.decode(beam_output[0], skip_special_tokens=True))
|
| 37 |
```
|
| 38 |
|
| 39 |
+
## Exemplos de Saída
|
| 40 |
+
|
| 41 |
```
|
| 42 |
+
A conversa entre humano e assistente de IA.
|
| 43 |
+
[|Humano|] o que é a doença de Parkinson?
|
| 44 |
+
[|IA|] A doença de Parkinson é um distúrbio neurodegenerativo que afeta o movimento. É causada pela perda de células produtoras de dopamina no cérebro.
|
| 45 |
```
|
| 46 |
|
| 47 |
```
|
| 48 |
+
A conversa entre humano e assistente de IA.
|
| 49 |
+
[|Humano|] que tipo de mel é melhor para uma tosse ruim de covid?
|
| 50 |
+
[|IA|] O mel de Manuka mostrou ter propriedades anti-inflamatórias e antibacterianas que podem ajudar a aliviar os sintomas de uma tosse ruim de covid.
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
---
|