Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update onboarding docs per #1637 #1643

Merged
merged 2 commits into from
Sep 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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