Skip to main content

A package to running RAG models, especially for the TREC 2023 Retrieval Augmented Generation (RAG) track.

Project description

Ragnarök

PyPI Downloads Downloads

LICENSE

Ragnarök is a battleground for the best retrieval-augmented generation (RAG) models!

📟 Instructions

Source Installation

Create a new conda environment and install the dependencies:

conda create -n ragnarok python=3.10 -y
conda activate ragnarok
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 # For CUDA 11.8
pip install -r requirements.txt

PyPI Installation

pip install pyragnarok

Let's generate!

For example, to run the command-r-plus model on the rag24.researchy-dev_large dataset with bm25 retrieval methods with augmented generation based on the top-20 segments, you can run the following command:

python src/ragnarok/scripts/run_ragnarok.py  --model_path=command-r-plus  --topk=20 \
  --dataset=rag24.researchy-dev  --retrieval_method=bm25 --prompt_mode=cohere  \
  --context_size=8192 --max_output_tokens=1024 

Or to run the gpt-4o model on the rag24.raggy-dev dataset with bm25 followed by rank_zephyr_rho retrieval methods, with augmented generation based on the top-5 segments, you can run the following command:

python src/ragnarok/scripts/run_ragnarok.py  --model_path=gpt-4o  --topk=100,5 \
    --dataset=rag24.raggy-dev  --retrieval_method=bm25,rank_zephyr_rho --prompt_mode=chatqa  \
    --context_size=8192 --max_output_tokens=1024  --use_azure_openai

Contributing

If you would like to contribute to the project, please refer to the contribution guidelines.

🦙🐧 Model Zoo

Most LLMs supported by VLLM/FastChat should additionally be supported by Ragnarök too, albeit we do not test all of them. If you would like to see a specific model added, please open an issue or a pull request. The following is a table of generation models which we regularly use with Ragnarök:

Model Name Identifier/Link
GPT-4o gpt-4o
GPT-4 gpt-4
GPT-3.5-turbo gpt-35-turbo
command-r-plus command-r-plus
command-r command-r
Llama-3 8B Instruct meta-llama/Meta-Llama-3-8B-Instruct
Llama3-ChatQA-1.5 nvidia/Llama3-ChatQA-1.5

✨ References

If you use Ragnarök, please cite the following:

TODO

🙏 Acknowledgments

This research is supported in part by the Natural Sciences and Engineering Research Council (NSERC) of Canada.

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

pyragnarok-0.0.1.tar.gz (37.9 kB view details)

Uploaded Source

Built Distribution

pyragnarok-0.0.1-py3-none-any.whl (45.7 kB view details)

Uploaded Python 3

File details

Details for the file pyragnarok-0.0.1.tar.gz.

File metadata

  • Download URL: pyragnarok-0.0.1.tar.gz
  • Upload date:
  • Size: 37.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.6

File hashes

Hashes for pyragnarok-0.0.1.tar.gz
Algorithm Hash digest
SHA256 0dc0c015c749c465c4c8c82d921d2fa6a06f53aa84d240f0e6afc18b865ffbb6
MD5 34e7a5c46e8f0aeb6f268aa74fbeb1f6
BLAKE2b-256 94c3598123fa3b36addae7e248fca91d6990b15b9e09595a8b187573116296a7

See more details on using hashes here.

File details

Details for the file pyragnarok-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyragnarok-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 45.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.6

File hashes

Hashes for pyragnarok-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dc797830f8b2b5133984f97e739a8ab177205ea03cd19aee3ddccd947da5f94b
MD5 67d18539d8e1cdbb98b794d06a3fa556
BLAKE2b-256 321dfc7faf6f6b3e2cf07712a4fc747156dbd09e17e81d3f3ffc5ce8b4257771

See more details on using hashes here.

Supported by

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