Skip to content

qmkadiri/askyourdocs

 
 

Repository files navigation

askyourdocs

Goal: Locally hosted chatbot answering questions to your documents

User Story: As a public relations employee I would like to ask questions to documents, so I can answer to requests faster

Links

Use Huggingface Models

Install transformers

pip install transformers, torch, SentencePiese, accelerate

download and use a model

from transformers import T5Tokenizer, T5ForConditionalGeneration

tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-small")
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-small")

prompt = "In the following sentence, what is the drugname: Ibuprofen is well known to cause diarrhia."
input_ids = tokenizer(prompt, return_tensors="pt").input_ids

outputs = model.generate(input_ids, max_length = 512)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

About

Ask your documents with locally hosted open source large language model.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%