File size: 1,179 Bytes
a41dcbf 18223e8 2233474 f39c382 fd608d5 863ee30 f39c382 863ee30 f39c382 6866579 f39c382 863ee30 30b7a6d |
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 |
---
license: afl-3.0
---
# Docto Bot
## Usage (HuggingFace Transformers)
```
pip install -U transformers
```
```python
import random
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("docto/Docto-Bot")
model = AutoModelForCausalLM.from_pretrained("docto/Docto-Bot")
special_token = '<|endoftext|>'
prompt_text = 'Question: I am having fever\nAnswer:'
#prompt_text = f'Question: {userinput}\nAnswer:'
encoded_prompt = tokenizer.encode(prompt_text,
add_special_tokens = False,
return_tensors = 'pt')
output_sequences = model.generate(
input_ids = encoded_prompt,
max_length = 700,
temperature = 0.9,
top_k = 20,
top_p = 0.9,
repetition_penalty = 1,
do_sample = True,
num_return_sequences = 4
)
result = tokenizer.decode(random.choice(output_sequences))
result = result[result.index("Answer: "):result.index(special_token)]
print(result[8:])
```
## Training Data
The Docto-Bot was trained on [Medical Question/Answer dataset](https://github.com/LasseRegin/medical-question-answer-data) |