abhinand/MedEmbed-training-triplets-v1
Viewer • Updated • 304k • 90 • 9
How to use shabawak/Bio_Clinical_ColBERT-finetuned with Adapters:
from adapters import AutoAdapterModel
model = AutoAdapterModel.from_pretrained("undefined")
model.load_adapter("shabawak/Bio_Clinical_ColBERT-finetuned", set_active=True)This is a fine-tuned emilyalsentzer/Bio_ClinicalBERT model trained on medical question-answer triplets using the abhinand/MedEmbed-training-triplets-v1 dataset.
abhinand/MedEmbed-training-triplets-v1ClinicalBERT (or similar encoder)Dense retrieval for:
Bio_Clinical_ColBERT-finetuned using RAGatouille
Bio_Clinical_ColBERT-finetuned operates using ColBERT + RAGatouille. To install it along with its dependencies, run:
pip install -U ragatouille
For in-memory searching, simply:
from ragatouille import RAGPretrainedModel
RAG = RAGPretrainedModel.from_pretrained("shabawak/Bio_Clinical_ColBERT-finetuned")
RAG.encode(['document_1', 'document_2', ...])
RAG.search_encoded_documents(query="your search query")
ColBERT's late-interaction retrieval requires indexing first. This step is slow, but retrieval is fast.
from ragatouille import RAGPretrainedModel
RAG = RAGPretrainedModel.from_pretrained("bclavie/JaColBERT")
documents = ['document_1', 'document_2', ...] # Your documents
RAG.index(name="My_first_index", collection=documents)
After indexing, querying is straightforward. If reopening a session, load the index first:
RAG = RAGPretrainedModel.from_index(".ragatouille/colbert/indexes/My_first_index")
results = RAG.search(query="What is the expected outcome for a patient diagnosed with D-2-hydroxyglutaric aciduria type I?",k=5)
[[{'content': 'In April 1984, Miyazaki opened his own office in Suginami Ward, naming it Nibariki.\n\n\n=== Studio Ghibli ===\n\n\n==== Early films (1985–1996) ====\nIn June 1985, Miyazaki, Takahata, Tokuma and Suzuki founded the animation production company Studio Ghibli, with funding from Tokuma Shoten. Studio Ghibli\'s first film, Laputa: Castle in the Sky (1986), employed the same production crew of Nausicaä. Miyazaki\'s designs for the film\'s setting were inspired by Greek architecture and "European urbanistic templates".',
'score': 25.90448570251465,
'rank': 1,
'document_id': 'miyazaki',
'document_metadata': {'entity': 'person', 'source': 'wikipedia'}},
{'content': 'Hayao Miyazaki (宮崎 駿 or 宮﨑 駿, Miyazaki Hayao, Japanese: [mijaꜜzaki hajao]; born January 5, 1941) is a Japanese animator, filmmaker, and manga artist. A co-founder of Studio Ghibli, he has attained international acclaim as a masterful storyteller and creator of Japanese animated feature films, and is widely regarded as one of the most accomplished filmmakers in the history of animation.\nBorn in Tokyo City in the Empire of Japan, Miyazaki expressed interest in manga and animation from an early age, and he joined Toei Animation in 1963. During his early years at Toei Animation he worked as an in-between artist and later collaborated with director Isao Takahata.',
'score': 25.572620391845703,
'rank': 2,
'document_id': 'miyazaki',
'document_metadata': {'entity': 'person', 'source': 'wikipedia'}},
{'content': 'Glen Keane said Miyazaki is a "huge influence" on Walt Disney Animation Studios and has been "part of our heritage" ever since The Rescuers Down Under (1990). The Disney Renaissance era was also prompted by competition with the development of Miyazaki\'s films. Artists from Pixar and Aardman Studios signed a tribute stating, "You\'re our inspiration, Miyazaki-san!"',
'score': 24.84041976928711,
'rank': 3,
'document_id': 'miyazaki',
'document_metadata': {'entity': 'person', 'source': 'wikipedia'}}]]
Base model
emilyalsentzer/Bio_ClinicalBERT