๐ค + ๐๐ฉบ๐ฎ๐น + โ = BioBIT_QA
From this repository you can download the BioBIT_QA (Biomedical Bert for ITalian for Question Answering) checkpoint.
BioBIT_QA is built on top of BioBIT, fine-tuned on an Italian Neuropsychological Italian datasets. More details will follow!
Install libraries:
pip install farm-haystack[inference]
Download model locally:
git clone https://huggingface.co/IVN-RIN/bioBIT_QA
Run the code
# Import libraries
from haystack.nodes import FARMReader
from haystack.schema import Document
# Define the reader
reader = FARMReader(
model_name_or_path="bioBIT_QA",
return_no_answer=True
)
# Define context and question
context = '''
This is an example of context
'''
question = 'This is a question example, ok?'
# Wrap context in Document
docs = Document(
content = context
)
# Predict answer
prediction = reader.predict(
query = question,
documents = [docs],
top_k = 5
)
# Print the 5 first predicted answers
for i, ans in enumerate(prediction['answers']):
print(f'Answer num {i+1}, with score {ans.score*100:.2f}%: "{ans.answer}"')
# Inferencing Samples: 100%|โโโโโโโโโโ| 1/1 [00:01<00:00, 1.14s/ Batches]
# Answer num 1, with score 97.91%: "Example answer 01"
# Answer num 2, with score 53.69%: "Example answer 02"
# Answer num 3, with score 0.03%: "Example answer 03"
# ...
Inference API (serverless) does not yet support Haystack models for this pipeline type.