Skip to content

Commit

Permalink
Update onboarding docs per #1637 (#1643)
Browse files Browse the repository at this point in the history
  • Loading branch information
lintool committed Sep 23, 2023
1 parent 3f9460c commit 7d18f4b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/conceptual-framework2.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ v2 = encoder.encode(doc_text)

Minor detail here: the encoder is designed to work on batches of input, so the actual vector representation is `v2[0]`.

We can verify that the vector we generated using the encoder is identical to the vector that is stored in the index by computing the L2 norm (which should be zero):
We can verify that the vector we generated using the encoder is identical to the vector that is stored in the index by computing the L2 norm (which should be almost zero):

```python
import numpy as np
Expand Down
5 changes: 4 additions & 1 deletion docs/experiments-nfcorpus.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ python -m pyserini.encode \
encoder --encoder facebook/contriever-msmarco \
--device cpu \
--pooling mean \
--fields title text
--fields title text \
--batch 32
```

We're using the [`facebook/contriever-msmarco`](https://huggingface.co/facebook/contriever-msmarco) encoder, which can be found on HuggingFace.
Expand All @@ -98,6 +99,7 @@ At search time, each document vector is sequentially compared to the query vecto
In other words, the library just performs brute force dot products of each query vector against all document vectors.

The above indexing command takes around 30 minutes to run on a modern laptop, with most of the time occupied by performing neural inference using the CPU.
Adjust the `batch` parameter above accordingly for your hardware; 32 is the default, but reduce the value if you find that the encoding is taking too long.

## Retrieval

Expand All @@ -120,6 +122,7 @@ With the flat index here, we're performing brute-force computation of dot produc
As a result, we are performing _exact_ search, i.e., we are finding the _exact_ top-_k_ documents that have the highest dot products.

The above retrieval command takes only a few minutes on a modern laptop.
Adjust the `threads` and `batch` parameters above accordingly for your hardware.

## Evaluation

Expand Down

0 comments on commit 7d18f4b

Please sign in to comment.