Skip to content

Commit

Permalink
add GH actions
Browse files Browse the repository at this point in the history
  • Loading branch information
natolambert committed Jan 26, 2024
1 parent 25a1380 commit bc27ebe
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 27 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Quality

on:
push:
branches:
- main
- v*-release
pull_request:
branches:
- main

jobs:

check_code_quality:
name: Check code quality
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Python environment
uses: actions/setup-python@v2
with:
python-version: 3.10.10
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .
- name: Code quality
run: |
make quality
31 changes: 31 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Tests

on:
push:
branches:
- main
- v*-release
pull_request:
branches:
- main

jobs:

unit-tests:
name: Run unit tests
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Python environment
uses: actions/setup-python@v2
with:
python-version: 3.10.10
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .
- name: Run unit tests
run: HF_TOKEN=$HF_TOKEN pytest tests/
28 changes: 1 addition & 27 deletions scripts/run_rm.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import transformers
from accelerate import Accelerator
from accelerate.logging import get_logger
from datasets import concatenate_datasets, load_dataset
from fastchat.conversation import get_conv_template
from huggingface_hub import HfApi
from tqdm import tqdm
Expand All @@ -34,7 +33,7 @@
pipeline,
)

from herm import load_eval_dataset, prepare_dialogue, prepare_dialogue_from_tokenizer
from herm import load_eval_dataset

# get token from HF_TOKEN env variable, but if it doesn't exist pass none
HF_TOKEN = os.getenv("HF_TOKEN", None)
Expand All @@ -44,31 +43,6 @@
EVAL_REPO = "ai2-rlhf-collab/rm-benchmark-results"
PREFS_REPO = "ai2-rlhf-collab/rm-testset-results"

EVAL_SUBSETS = [ # noqa
# custom subsets above
"alpacaeval-easy",
"alpacaeval-hard",
"alpacaeval-length",
"llmbar-adver-GPTInst",
"llmbar-adver-GPTOut",
"llmbar-adver-manual",
"llmbar-adver-neighbor",
"llmbar-natural",
"mt-bench-easy",
"mt-bench-hard",
"mt-bench-med",
"refusals-dangerous",
"refusals-offensive",
# pref subsets below
"anthropic",
"summarize",
"summarize_prompted",
"pku_better",
"pku_safer",
"shp",
]


def get_args():
"""
Parse arguments strings model and chat_template
Expand Down

0 comments on commit bc27ebe

Please sign in to comment.