Skip to content

Commit

Permalink
clean scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
natolambert committed Oct 24, 2024
1 parent 5158fc6 commit 553123f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripts/eval/oe-eval.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ set -ex

# Function to print usage
usage() {
echo "Usage: $0 --model-name MODEL_NAME --model-location MODEL_LOCATION [--hf-upload] [--revision REVISION] [--max-length <max_length>]"
echo "Usage: $0 --model-name MODEL_NAME --model-location MODEL_LOCATION [--num_gpus GPUS] [--hf-upload] [--revision REVISION] [--max-length <max_length>]"
exit 1
}

Expand All @@ -45,13 +45,18 @@ while [[ "$#" -gt 0 ]]; do
case $1 in
--model-name) MODEL_NAME="$2"; shift ;;
--model-location) MODEL_LOCATION="$2"; shift ;;
--num_gpus) NUM_GPUS="$2"; shift ;;
--hf-upload) HF_UPLOAD="true" ;;
--revision) REVISION="$2"; shift ;;
--max-length) MAX_LENGTH="$2"; shift ;;
*) echo "Unknown parameter passed: $1"; usage ;;
esac
shift
done

# Optional: Default number of GPUs if not specified
NUM_GPUS="${NUM_GPUS:-1}"

# Check required arguments
if [[ -z "$MODEL_NAME" || -z "$MODEL_LOCATION" ]]; then
echo "Error: --model-name and --model-location are required."
Expand Down
6 changes: 6 additions & 0 deletions scripts/submit_eval_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def adjust_gpus(task_spec, experiment_group, model_name, gpu_multiplier):
parser.add_argument("--run_oe_eval_experiments", action="store_true", help="Run the OE eval tool and experiments too.")
parser.add_argument("--run_safety_evaluations", action="store_true", help="Run the OE safety evaluations too.")
parser.add_argument("--skip_oi_evals", action="store_true", help="Don't run open instruct evals.")
parser.add_argument("--oe_eval_max_length", type=int, default=4096, help="Max length for OE eval.")
args = parser.parse_args()


Expand Down Expand Up @@ -585,6 +586,11 @@ def adjust_gpus(task_spec, experiment_group, model_name, gpu_multiplier):
oe_eval_cmd += f" --model-location beaker://{model_info[1]}"
if args.hf_revision:
oe_eval_cmd += f" --revision {args.hf_revision}"
# add string with number of gpus
oe_eval_cmd += f" --num_gpus {task_spec['resources']['gpuCount']}"
if args.oe_eval_max_length:
oe_eval_cmd += f" --max-length {args.oe_eval_max_length}"
print(f"Running OE eval with command: {oe_eval_cmd}")
subprocess.Popen(oe_eval_cmd, shell=True)

# create an experiment that runs the safety eval tasks
Expand Down

0 comments on commit 553123f

Please sign in to comment.