Skip to content

Commit 1109776

Browse files
authored
add base workflow for running benchmarks on demand (#240)
* add base workflow for running benchmarks on demand * add base workflow for running benchmarks on demand
1 parent 14e2177 commit 1109776

File tree

3 files changed

+51
-3
lines changed

3 files changed

+51
-3
lines changed

.github/workflows/run-benchmarks.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Run benchmarks
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
intensity:
7+
description: 'Intensity of the tests (1-5)'
8+
default: "2"
9+
10+
jobs:
11+
run-benchmarks:
12+
name: Run benchmarks
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
- name: Set up python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: '3.11'
22+
- name: Install Poetry
23+
uses: snok/install-poetry@v1
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
python -m pip install tox
29+
30+
31+
- name: Run
32+
env:
33+
OPEN_AI_KEY: "${{ secrets.E2E_TESTS_OPEN_AI_KEY }}"
34+
NVIDIA_API_KEY: "${{ secrets.E2E_TESTS_NVIDIA_API_KEY }}"
35+
run: |
36+
cd ragstack-e2e-tests
37+
poetry install --no-root
38+
poetry run python benchmarks/runner.py -t all -i ${{ github.event.inputs.intensity }}
39+
poetry run python benchmarks/visualize.py
40+
41+
- name: Dump logs
42+
if: always()
43+
run: |
44+
cd ragstack-e2e-tests
45+
if [ -f "testcases.log" ]; then
46+
cat testcases.log
47+
fi

ragstack-e2e-tests/benchmarks/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export NVIDIA_API_KEY=<your key>
1212

1313
Then you can run the benchmark with the following command:
1414
```
15-
poetry run python benchmarks/runner.py -t *
15+
poetry run python benchmarks/runner.py -t all
1616
```
1717

1818
After the run, all the reports are stored in the `reports` folder.

ragstack-e2e-tests/benchmarks/testcases.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import sys
23

34
from langchain.text_splitter import CharacterTextSplitter
@@ -98,13 +99,13 @@ def embeddings_batch100_chunk512(embeddings_fn):
9899

99100

100101
def openai_ada002(batch_size):
101-
return OpenAIEmbeddings(chunk_size=batch_size)
102+
return OpenAIEmbeddings(chunk_size=batch_size, api_key=os.environ.get("OPEN_AI_KEY"))
102103

103104

104105
def nvidia_nvolveqa40k(batch_size):
105106
# 50 is the max supported batch size
106107
return NVIDIAEmbeddings(
107-
model="nvolveqa_40k", max_batch_size=min(batch_size, 50), model_type="query"
108+
model="nvolveqa_40k", max_batch_size=max(50, batch_size), model_type="query"
108109
)
109110

110111

0 commit comments

Comments
 (0)