The model encodes natural language queries and passages into dense vector embeddings that can be indexed with FAISS for efficient semantic search.
This repository contains the complete Hugging Face compatible model including tokenizer, configuration, and custom model implementation.
The fine-tuned model substantially improves retrieval quality on the evaluation set compared with the untuned BERT-base encoder.
1from transformers import AutoTokenizer, AutoModel
2
3model_name = "Innovatewithapple/bert-dense-retriever"
4
5tokenizer = AutoTokenizer.from_pretrained(model_name)
6
7model = AutoModel.from_pretrained(
8 model_name,
9 trust_remote_code=True,
10)
11
12inputs = tokenizer(
13 "What is deep learning?",
14 return_tensors="pt"
15)
16
17embeddings = model(**inputs)
18
19print(embeddings.shape)