Skip to content

Commit c794a8f

Browse files
authored
Automate benchmarking - disabling the docs workflow (#752)
## Summary <!--- This is a required section; please describe the main purpose of this proposed code change. ---> The docs workflow currently replaces the gh-pages branch with new files due to which the benchmark data is lost. Currently I am disabling this so that we can get the data appended in the gh-pages branch. Also, modified the script to add commit hashes to a json file, so that we do not call github api to fetch it due to API limitations <!--- ## Details This is an optional section; is there anything specific that reviewers should be aware of? ---> ## Testing Done <!--- This is a required section; please describe how this change was tested. ---> <!-- Replace BLANK with your device type. For example, A100-80G-PCIe Complete the following tasks before sending your PR, and replace `[ ]` with `[x]` to indicate you have done them. --> - Hardware Type: <BLANK> - [ ] run `make test` to ensure correctness - [ ] run `make checkstyle` to ensure code style - [ ] run `make test-convergence` to ensure convergence
1 parent 53a37a5 commit c794a8f

File tree

3 files changed

+31
-5
lines changed

3 files changed

+31
-5
lines changed

.github/workflows/benchmark.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ jobs:
2929
OUTPUT_FILENAME: benchmark.csv
3030
GENERATED_CSV: benchmark/data/all_benchmark_data.csv
3131

32-
3332
steps:
3433
- name: Checkout code
3534
uses: actions/checkout@v3
@@ -52,9 +51,15 @@ jobs:
5251
pip install modal
5352
pip install pandas
5453
55-
# - name: Run benchmarks on GPU
56-
# run: |
57-
# modal run dev.modal.benchmarks
54+
# Delete previous benchmark results.
55+
- name: Remove previous benchmark data
56+
run: |
57+
rm -f benchmark/data/all_benchmark_data.csv
58+
59+
60+
- name: Run benchmarks on GPU
61+
run: |
62+
modal run dev.modal.benchmarks
5863
5964
# Step 5: Checkout gh-pages branch in a subfolderAdd commentMore actions
6065
- name: Checkout gh-pages
@@ -69,6 +74,21 @@ jobs:
6974
mkdir -p gh-pages/${OUTPUT_DIR}/${{ steps.get_hash.outputs.hash }}
7075
cp ${GENERATED_CSV} gh-pages/${OUTPUT_DIR}/${{ steps.get_hash.outputs.hash }}/${OUTPUT_FILENAME}
7176
77+
# Step 7: Append commit hash to commits.txt if not already present
78+
- name: Update commits.txt
79+
run: |
80+
cd gh-pages
81+
echo "commits.txt file path: ${OUTPUT_DIR}/commits.txt"
82+
83+
# Create file if it doesn't exist
84+
mkdir -p ${OUTPUT_DIR}
85+
touch ${OUTPUT_DIR}/commits.txt
86+
87+
# Append only if not already present
88+
if ! grep -q "${{ steps.get_hash.outputs.hash }}" ${OUTPUT_DIR}/commits.txt; then
89+
echo "${{ steps.get_hash.outputs.hash }}" >> ${OUTPUT_DIR}/commits.txt
90+
fi
91+
7292
# Step 7: Commit and push
7393
- name: Commit and push to gh-pages
7494
run: |

.github/workflows/docs.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@ on:
33
push:
44
branches:
55
- main
6+
7+
env:
8+
ENABLE_DEPLOY: false
9+
610
permissions:
711
contents: write
812
jobs:
913
deploy:
14+
if: env.ENABLE_DEPLOY == 'true'
1015
runs-on: ubuntu-latest
1116
steps:
1217
- uses: actions/checkout@v4

dev/modal/benchmarks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
repo = image.add_local_dir(ROOT_PATH, remote_path=REMOTE_ROOT_PATH)
1515

1616

17-
@app.function(gpu="A10G", image=repo, timeout=60 * 45)
17+
@app.function(gpu="H100", image=repo, timeout=60 * 45)
1818
def liger_benchmarks():
1919
import subprocess
2020

@@ -25,3 +25,4 @@ def liger_benchmarks():
2525
cwd=REMOTE_ROOT_PATH,
2626
)
2727
subprocess.run(["python benchmark/scripts/benchmark_kto_loss.py"], check=True, shell=True, cwd=REMOTE_ROOT_PATH)
28+
subprocess.run(["python benchmark/scripts/benchmark_cpo_loss.py"], check=True, shell=True, cwd=REMOTE_ROOT_PATH)

0 commit comments

Comments
 (0)