Skip to main content

Training Neural Retrievers

Welcome to the rankers repository! This package provides tooling for training neural retrievers using various ranking models. The package is designed to mimic the underlying interface of transformers to get you started quickly.

Features

  • Flexible Model Training: Use the RankerTrainer class to train common ranking architectures.
  • Data Handling: ir_datasets integration and ir-specific data processing in a familiar format.
  • Transformers Integration: Built on top of the Hugging Face transformers library for easy model loading and training.
  • Experiment Tracking: Integrated with wandb for tracking experiments and hyperparameters.

Install

pip install rankers

Latest (Unstable)

pip install -U git+https://github.com/Parry-Parry/rankers.git

Quick Start

To get started, check out the examples in the examples directory. Here's a brief overview of what you can find:

  • train.bert.cat.py: An example script for training a BERT-based ranking model. It includes setting up data arguments, model arguments, and training arguments, and demonstrates how to train and save the model.

Installation

Clone the repository and install the required dependencies:

git clone https://github.com/Parry-Parry/rankers.git
cd rankers
pip install -r requirements.txt

Usage

Models can be instantiated like transformers models, for example, a bi-encoder (dot)

model = Dot.from_pretrained("bert-base-uncased")

Models are converted into rankers in PyTerrier:

ranker = model.to_pyterrier()

Run the example training script:

python examples/train.bert.cat.py --model_name_or_path bert-base-uncased --training_data path/to/data --output_dir path/to/save/model

Contributing

We welcome contributions! Please read our contributing guidelines for more details.

License

This project is licensed under the Apache 2.0 License. See the LICENSE file for details.

Happy training!

Metadata

Release files for rankers 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rankers 0.0.6
File Size Uploaded Provenance Actions
rankers-0.0.6.tar.gz 45.3 kB Without provenance Details for rankers-0.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rankers 0.0.6
File Interpreter ABI Platform Actions
rankers-0.0.6-py3-none-any.whl Python 3 none any Details for rankers-0.0.6-py3-none-any.whl

Total release size: 111.2 kB

Release files / rankers-0.0.6.tar.gz

Download URL rankers-0.0.6.tar.gz
Size 45.3 kB
Tags Source
SHA-256 checksum
How to use checksums
01990d80c7889b335a8c7d43a65b415bc1d5c2b0fb3a634bbb4eb426d055e98c
BLAKE2b-256 checksum
How to use checksums
fc1d0a781d7359cb254615295554ac72d8cd4f919bcb5cd6564d44105a9d47c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.21

Release files / rankers-0.0.6-py3-none-any.whl

Download URL rankers-0.0.6-py3-none-any.whl
Size 65.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
35c13a543e0ef21c9a706e028b69d6401a83b540abc26fce4a6e1875fa027ea5
BLAKE2b-256 checksum
How to use checksums
fb2190030e35e468a0a776028194f2c6c93a1c32208743ceab198a529fe5fd71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.21

Security for rankers 0.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page