Skip to main content

A package for training and evaluating neural rankers.

Project description

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!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rankers-0.0.6.tar.gz (45.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rankers-0.0.6-py3-none-any.whl (65.9 kB view details)

Uploaded Python 3

File details

Details for the file rankers-0.0.6.tar.gz.

File metadata

  • Download URL: rankers-0.0.6.tar.gz
  • Upload date:
  • Size: 45.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.21

File hashes

Hashes for rankers-0.0.6.tar.gz
Algorithm Hash digest
SHA256 01990d80c7889b335a8c7d43a65b415bc1d5c2b0fb3a634bbb4eb426d055e98c
MD5 1a4517441c058e6afe0e47096a76ed8e
BLAKE2b-256 fc1d0a781d7359cb254615295554ac72d8cd4f919bcb5cd6564d44105a9d47c9

See more details on using hashes here.

File details

Details for the file rankers-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: rankers-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 65.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.21

File hashes

Hashes for rankers-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 35c13a543e0ef21c9a706e028b69d6401a83b540abc26fce4a6e1875fa027ea5
MD5 f0cac29effdce492669cd6c6b7666d38
BLAKE2b-256 fb2190030e35e468a0a776028194f2c6c93a1c32208743ceab198a529fe5fd71

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page