Update README.md
Browse files
README.md
CHANGED
|
@@ -1,23 +1,31 @@
|
|
| 1 |
---
|
| 2 |
-
# pretty_name: "" # Example: "MS MARCO Terrier Index"
|
| 3 |
tags:
|
| 4 |
- pyterrier
|
| 5 |
- pyterrier-artifact
|
| 6 |
-
- pyterrier-
|
| 7 |
-
- pyterrier-artifact.dense_index.flex
|
| 8 |
task_categories:
|
| 9 |
- text-retrieval
|
| 10 |
viewer: false
|
|
|
|
|
|
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
-
#
|
| 14 |
|
| 15 |
## Description
|
| 16 |
|
| 17 |
-
|
| 18 |
|
| 19 |
## Usage
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
```python
|
| 22 |
# Load the artifact
|
| 23 |
import pyterrier as pt
|
|
@@ -25,14 +33,28 @@ artifact = pt.Artifact.from_hf('pyterrier-tutorial/bright.sustainable.mini.dense
|
|
| 25 |
# TODO: Show how you use the artifact
|
| 26 |
```
|
| 27 |
|
| 28 |
-
## Benchmarks
|
| 29 |
-
|
| 30 |
-
*TODO: Provide benchmarks for the artifact.*
|
| 31 |
-
|
| 32 |
## Reproduction
|
| 33 |
|
| 34 |
```python
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
```
|
| 37 |
|
| 38 |
## Metadata
|
|
@@ -44,4 +66,4 @@ artifact = pt.Artifact.from_hf('pyterrier-tutorial/bright.sustainable.mini.dense
|
|
| 44 |
"vec_size": 384,
|
| 45 |
"doc_count": 60792
|
| 46 |
}
|
| 47 |
-
```
|
|
|
|
| 1 |
---
|
|
|
|
| 2 |
tags:
|
| 3 |
- pyterrier
|
| 4 |
- pyterrier-artifact
|
| 5 |
+
- pyterrier-dr
|
|
|
|
| 6 |
task_categories:
|
| 7 |
- text-retrieval
|
| 8 |
viewer: false
|
| 9 |
+
language:
|
| 10 |
+
- en
|
| 11 |
+
pretty_name: Dense index of the BRIGHT Sustainable Living collection for PyTerrier
|
| 12 |
---
|
| 13 |
|
| 14 |
+
# Dense index of the BRIGHT Sustainable Living collection for PyTerrier
|
| 15 |
|
| 16 |
## Description
|
| 17 |
|
| 18 |
+
A dense index of the sustainable-living subset of the BRIGHT dataset build with PyTerrier's DR plugin.
|
| 19 |
|
| 20 |
## Usage
|
| 21 |
|
| 22 |
+
You will need to install PyTerrier, and its DR engine:
|
| 23 |
+
|
| 24 |
+
```python
|
| 25 |
+
%pip install pyterrier
|
| 26 |
+
%pip install pyterrier-dr
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
```python
|
| 30 |
# Load the artifact
|
| 31 |
import pyterrier as pt
|
|
|
|
| 33 |
# TODO: Show how you use the artifact
|
| 34 |
```
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
## Reproduction
|
| 37 |
|
| 38 |
```python
|
| 39 |
+
import pyterrier as pt
|
| 40 |
+
from pyterrier_dr import SBertBiEncoder, FlexIndex
|
| 41 |
+
|
| 42 |
+
dataset = pt.get_dataset('irds:bright/sustainable-living')
|
| 43 |
+
|
| 44 |
+
model_mini = SBertBiEncoder(
|
| 45 |
+
"sentence-transformers/all-MiniLM-L6-v2",
|
| 46 |
+
batch_size=32,
|
| 47 |
+
text_field="text"
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
dense_path_mini = "./bright-mini.flex"
|
| 51 |
+
|
| 52 |
+
if os.path.exists(dense_path_mini):
|
| 53 |
+
shutil.rmtree(dense_path_mini)
|
| 54 |
+
|
| 55 |
+
dense_index_mini = FlexIndex(dense_path_mini)
|
| 56 |
+
dense_indexer_mini = model_mini.doc_encoder() >> dense_index_mini.indexer(mode="overwrite")
|
| 57 |
+
dense_indexer_mini.index(dataset.get_corpus_iter())
|
| 58 |
```
|
| 59 |
|
| 60 |
## Metadata
|
|
|
|
| 66 |
"vec_size": 384,
|
| 67 |
"doc_count": 60792
|
| 68 |
}
|
| 69 |
+
```
|