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
RankerTrainerclass to train common ranking architectures. - Data Handling:
ir_datasetsintegration and ir-specific data processing in a familiar format. - Transformers Integration: Built on top of the Hugging Face
transformerslibrary for easy model loading and training. - Experiment Tracking: Integrated with
wandbfor 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01990d80c7889b335a8c7d43a65b415bc1d5c2b0fb3a634bbb4eb426d055e98c
|
|
| MD5 |
1a4517441c058e6afe0e47096a76ed8e
|
|
| BLAKE2b-256 |
fc1d0a781d7359cb254615295554ac72d8cd4f919bcb5cd6564d44105a9d47c9
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35c13a543e0ef21c9a706e028b69d6401a83b540abc26fce4a6e1875fa027ea5
|
|
| MD5 |
f0cac29effdce492669cd6c6b7666d38
|
|
| BLAKE2b-256 |
fb2190030e35e468a0a776028194f2c6c93a1c32208743ceab198a529fe5fd71
|