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.4.tar.gz (33.1 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.4-py3-none-any.whl (39.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rankers-0.0.4.tar.gz
  • Upload date:
  • Size: 33.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for rankers-0.0.4.tar.gz
Algorithm Hash digest
SHA256 f7084989397d53008f4aec18b5d961b12dee482ffa71d4a9bd402e176ac234f5
MD5 415fe81fd539698a16f37dd94729a2ca
BLAKE2b-256 133b57d00c97316b4bcf7de43103bc3c5b41e668c1a6f618c01eaae5f551d215

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rankers-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 39.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for rankers-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 42d6d16ffd9b39b92485a529971a861f1c2da19056da3621c722442e314d3484
MD5 467ffe58f53db80b490efd51b9862129
BLAKE2b-256 db1a631ed73a2b763eb7e9a7ba4d90e2b22c3b5a713e35b78a2f747ab540df61

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