-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
609 additions
and
655 deletions.
There are no files selected for viewing
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: style | ||
|
||
on: | ||
push: {branches: [master]} # pushes to master | ||
pull_request: {} # all PRs | ||
|
||
jobs: | ||
ruff: | ||
strategy: | ||
matrix: | ||
python-version: ['3.10'] | ||
os: ['ubuntu-latest'] | ||
|
||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Cache Dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements.txt', 'requirements-dev.txt') }} | ||
|
||
- name: Install Dependencies | ||
run: | | ||
pip install --upgrade -r requirements-dev.txt | ||
pip install -e . | ||
- name: Ruff | ||
run: 'ruff check --output-format=github pyterrier_dr' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: test | ||
|
||
on: | ||
push: {branches: [master]} # pushes to master | ||
pull_request: {} # all PRs | ||
schedule: [cron: '0 12 * * 3'] # every Wednesday at noon | ||
|
||
jobs: | ||
pytest: | ||
strategy: | ||
matrix: | ||
os: ['ubuntu-latest'] | ||
python-version: ['3.8', '3.12'] | ||
|
||
runs-on: ${{ matrix.os }} | ||
env: | ||
runtag: ${{ matrix.os }}-${{ matrix.python-version }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Cache Dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.runtag }}-${{ hashFiles('requirements.txt', 'requirements-dev.txt') }} | ||
|
||
- name: Loading Torch models from cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: /home/runner/.cache/ | ||
key: model-cache | ||
|
||
- name: Install Dependencies | ||
run: | | ||
pip install --upgrade -r requirements.txt -r requirements-dev.txt | ||
pip install -e . | ||
- name: Unit Test | ||
run: | | ||
pytest --durations=20 -p no:faulthandler --json-report --json-report-file ${{ env.runtag }}.results.json --cov pyterrier_dr --cov-report json:${{ env.runtag }}.coverage.json tests/ | ||
- name: Upload Test Results | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: ${{ env.runtag }}.*.json | ||
overwrite: true | ||
|
||
- name: Report Test Results | ||
if: always() | ||
run: | | ||
printf "**Test Results**\n\n" >> $GITHUB_STEP_SUMMARY | ||
jq '.summary' ${{ env.runtag }}.results.json >> $GITHUB_STEP_SUMMARY | ||
printf "\n\n**Test Coverage**\n\n" >> $GITHUB_STEP_SUMMARY | ||
jq '.files | to_entries[] | " - `" + .key + "`: **" + .value.summary.percent_covered_display + "%**"' -r ${{ env.runtag }}.coverage.json >> $GITHUB_STEP_SUMMARY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,3 +129,5 @@ dmypy.json | |
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024, Sean MacAvaney | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
include requirements.txt | ||
recursive-include pyterrier_dr *.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
[build-system] | ||
requires = ["setuptools >= 61.0"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "pyterrier-dr" | ||
description = "Dense Retrieval for PyTerrier" | ||
requires-python = ">=3.8" | ||
authors = [ | ||
{name = "Sean MacAvaney", email = "[email protected]"}, | ||
] | ||
maintainers = [ | ||
{name = "Sean MacAvaney", email = "[email protected]"}, | ||
] | ||
readme = "README.rst" | ||
classifiers = [ | ||
"Programming Language :: Python", | ||
"Operating System :: OS Independent", | ||
"Topic :: Text Processing", | ||
"Topic :: Text Processing :: Indexing", | ||
"License :: OSI Approved :: MIT License", | ||
] | ||
dynamic = ["version", "dependencies"] | ||
|
||
[tool.setuptools.dynamic] | ||
version = {attr = "pyterrier_dr.__version__"} | ||
dependencies = {file = ["requirements.txt"]} | ||
|
||
[project.optional-dependencies] | ||
bgem3 = [ | ||
"FlagEmbedding", | ||
] | ||
|
||
[tool.setuptools.packages.find] | ||
exclude = ["tests"] | ||
|
||
[project.urls] | ||
Repository = "https://github.com/terrierteam/pyterrier_dr" | ||
"Bug Tracker" = "https://github.com/terrierteam/pyterrier_dr/issues" | ||
|
||
[project.entry-points."pyterrier.artifact"] | ||
"dense_index.flex" = "pyterrier_dr:FlexIndex" | ||
"cde_cache.np_pickle" = "pyterrier_dr:CDECache" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
__version__ = '0.2.0' | ||
|
||
from .util import SimFn, infer_device | ||
from .indexes import DocnoFile, NilIndex, NumpyIndex, RankedLists, FaissFlat, FaissHnsw, MemIndex, TorchIndex | ||
from .flex import FlexIndex | ||
from .biencoder import BiEncoder, BiQueryEncoder, BiDocEncoder, BiScorer | ||
from .hgf_models import HgfBiEncoder, TasB, RetroMAE | ||
from .sbert_models import SBertBiEncoder, Ance, Query2Query, GTR | ||
from .tctcolbert_model import TctColBert | ||
from .electra import ElectraScorer | ||
from .bge_m3 import BGEM3, BGEM3QueryEncoder, BGEM3DocEncoder | ||
from .cde import CDE, CDECache | ||
from .prf import average_prf, vector_prf | ||
from pyterrier_dr.util import SimFn, infer_device | ||
from pyterrier_dr.indexes import DocnoFile, NilIndex, NumpyIndex, RankedLists, FaissFlat, FaissHnsw, MemIndex, TorchIndex | ||
from pyterrier_dr.flex import FlexIndex | ||
from pyterrier_dr.biencoder import BiEncoder, BiQueryEncoder, BiDocEncoder, BiScorer | ||
from pyterrier_dr.hgf_models import HgfBiEncoder, TasB, RetroMAE | ||
from pyterrier_dr.sbert_models import SBertBiEncoder, Ance, Query2Query, GTR | ||
from pyterrier_dr.tctcolbert_model import TctColBert | ||
from pyterrier_dr.electra import ElectraScorer | ||
from pyterrier_dr.bge_m3 import BGEM3, BGEM3QueryEncoder, BGEM3DocEncoder | ||
from pyterrier_dr.cde import CDE, CDECache | ||
from pyterrier_dr.prf import average_prf, vector_prf | ||
|
||
__all__ = ["FlexIndex", "DocnoFile", "NilIndex", "NumpyIndex", "RankedLists", "FaissFlat", "FaissHnsw", "MemIndex", "TorchIndex", | ||
"BiEncoder", "BiQueryEncoder", "BiDocEncoder", "BiScorer", "HgfBiEncoder", "TasB", "RetroMAE", "SBertBiEncoder", "Ance", | ||
"Query2Query", "GTR", "TctColBert", "ElectraScorer", "BGEM3", "BGEM3QueryEncoder", "BGEM3DocEncoder", "CDE", "CDECache", | ||
"SimFn", "infer_device", "average_prf", "vector_prf"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.