Instructions to use Johonson/adasparse-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Johonson/adasparse-8B with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
AdaSparse-8B (LLaMA-3-8B, MS MARCO)
AdaSparse sparse retriever built on meta-llama/Meta-Llama-3-8B, trained on MS MARCO with
contrastive + knowledge-distillation loss, an adaptive top-k pruning and a learned per-term threshold. This repository
contains the LoRA adapter (including the learned q_thres/d_thres thresholding modules),
the tokenizer, and the retriever config.
Usage
Requires the AdaSparse codebase:
import torch
from transformers import AutoTokenizer
from scaling_retriever.modeling.llm_encoder import LlamaBiSparse
model = LlamaBiSparse.load_from_lora("Johonson/adasparse-8B")
tokenizer = AutoTokenizer.from_pretrained("Johonson/adasparse-8B")
queries = ["What is the capital of France?"]
passages = ["Paris is the capital of France."]
tokenized_queries = tokenizer(queries, max_length=192, truncation=True,
padding="longest", return_tensors="pt")
tokenized_passages = tokenizer(passages, max_length=192, truncation=True,
padding="longest", return_tensors="pt")
query_embeds = model.query_encode(**tokenized_queries)
doc_embeds = model.doc_encode(**tokenized_passages)
scores = torch.matmul(query_embeds, doc_embeds.T)
Note: the base model meta-llama/Meta-Llama-3-8B is gated — request access on its model page first.
- Downloads last month
- 44
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support
Model tree for Johonson/adasparse-8B
Base model
meta-llama/Meta-Llama-3-8B