This is a BM25S index created with the
bm25s library (version
0.1.7), an ultra-fast implementation of BM25. It can be used for lexical retrieval tasks.
1pip install "bm25s==0.1.7"
2
3# Include extra dependencies like stemmer
4pip install "bm25s[full]==0.1.7"
5
6# For huggingface hub usage
7pip install huggingface_hub
You can use this index for information retrieval tasks. Here is an example:
1import bm25s
2from bm25s.hf import BM25HF
3
4# Load the index
5retriever = BM25HF.load_from_hub("mteb/index_arxiv_bm25")
6
7# You can retrieve now
8query = "a cat is a feline"
9results = retriever.retrieve(bm25s.tokenize(query), k=3)
1import bm25s
2from bm25s.hf import BM25HF
3
4corpus = [
5 "a cat is a feline and likes to purr",
6 "a dog is the human's best friend and loves to play",
7 "a bird is a beautiful animal that can fly",
8 "a fish is a creature that lives in water and swims",
9]
10
11retriever = BM25HF(corpus=corpus)
12retriever.index(bm25s.tokenize(corpus))
13
14token = None # You can get a token from the Hugging Face website
15retriever.save_to_hub("mteb/index_arxiv_bm25", token=token)
1# Load corpus and index in memory-map (mmap=True) to reduce memory
2retriever = BM25HF.load_from_hub("mteb/index_arxiv_bm25", load_corpus=True, mmap=True)
3
4# Load a different branch/revision
5retriever = BM25HF.load_from_hub("mteb/index_arxiv_bm25", revision="main")
6
7# Change directory where the local files should be downloaded
8retriever = BM25HF.load_from_hub("mteb/index_arxiv_bm25", local_dir="/path/to/dir")
9
10# Load private repositories with a token:
11retriever = BM25HF.load_from_hub("mteb/index_arxiv_bm25", token=token)