From 0475da22fb840a6906df3f4eafb216a050f5d240 Mon Sep 17 00:00:00 2001 From: Xianchao Wu Date: Wed, 16 Aug 2023 12:17:10 +0000 Subject: [PATCH] humaneval dgx1 --- WizardCoder/humaneval_1_dgx1.sh | 43 ++++++++++++++++++++++++++++++++ WizardCoder/mbpp_3_a100.sh | 1 + WizardCoder/src/humaneval_gen.py | 15 +++++------ 3 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 WizardCoder/humaneval_1_dgx1.sh diff --git a/WizardCoder/humaneval_1_dgx1.sh b/WizardCoder/humaneval_1_dgx1.sh new file mode 100644 index 0000000..dc4e658 --- /dev/null +++ b/WizardCoder/humaneval_1_dgx1.sh @@ -0,0 +1,43 @@ +######################################################################### +# File Name: humaneval_1_dgx1.sh +# Author: Xianchao Wu +# mail: xianchaow@nvidia.com +# Created Time: Wed Aug 16 08:45:55 2023 +######################################################################### +#!/bin/bash + +#model="/path/to/your/model" +model="/workspace/asr/WizardLM/WizardCoder/models--WizardLM--WizardCoder-15B-V1.0/snapshots/926ca1b215c4631bc5f8c3e47173381452c23e5c" +temp=0.2 +max_len=2048 +pred_num=1 #200 +num_seqs_per_iter=1 #2 + +output_path=preds/humaneval_T${temp}_N${pred_num} + +mkdir -p ${output_path} +echo 'Output path: '$output_path +echo 'Model to eval: '$model + +# 164 problems, 21 per GPU if GPU=8 +index=0 +gpu_num=8 +for ((i = 0; i < $gpu_num; i++)); do + start_index=$((i * 21)) + end_index=$(((i + 1) * 21)) + + gpu=$((i)) + echo 'Running process #' ${i} 'from' $start_index 'to' $end_index 'on GPU' ${gpu} + ((index++)) + ( + CUDA_VISIBLE_DEVICES=$gpu python src/humaneval_gen.py --model ${model} \ + --start_index ${start_index} \ + --end_index ${end_index} \ + --temperature ${temp} \ + --num_seqs_per_iter ${num_seqs_per_iter} \ + --N ${pred_num} \ + --max_len ${max_len} \ + --output_path ${output_path} + ) & + if (($index % $gpu_num == 0)); then wait; fi +done diff --git a/WizardCoder/mbpp_3_a100.sh b/WizardCoder/mbpp_3_a100.sh index bbc208b..3312cb8 100644 --- a/WizardCoder/mbpp_3_a100.sh +++ b/WizardCoder/mbpp_3_a100.sh @@ -12,4 +12,5 @@ jsonfn="/workspace/asr/WizardLM/WizardCoder/preds/MBPP_T0.2_N2.jsonl" python -m ipdb main.py --tasks mbpp \ --allow_code_execution \ --load_generations_path $jsonfn \ + --n_samples 2 \ --model incoder-temperature-08 diff --git a/WizardCoder/src/humaneval_gen.py b/WizardCoder/src/humaneval_gen.py index bf61a71..1cda6c0 100644 --- a/WizardCoder/src/humaneval_gen.py +++ b/WizardCoder/src/humaneval_gen.py @@ -52,23 +52,24 @@ def get_model( assert base_model, ( "Please specify a --base_model, e.g. --base_model='bigcode/starcoder'" ) - cache_dir = "/workspace/asr/Llama-X/src/checkpoints_wcode" - tokenizer = AutoTokenizer.from_pretrained(base_model, cache_dir=cache_dir) - import ipdb; ipdb.set_trace() + #cache_dir = "/workspace/asr/Llama-X/src/checkpoints_wcode" + #tokenizer = AutoTokenizer.from_pretrained(base_model, cache_dir=cache_dir) + tokenizer = AutoTokenizer.from_pretrained(base_model) #, cache_dir=cache_dir) + #import ipdb; ipdb.set_trace() if device == "cuda": model = AutoModelForCausalLM.from_pretrained( base_model, load_in_8bit=load_8bit, torch_dtype=torch.float16, device_map="auto", - cache_dir=cache_dir, + #cache_dir=cache_dir, ) elif device == "mps": model = AutoModelForCausalLM.from_pretrained( base_model, device_map={"": device}, torch_dtype=torch.float16, - cache_dir=cache_dir, + #cache_dir=cache_dir, ) model.config.pad_token_id = tokenizer.pad_token_id @@ -101,7 +102,7 @@ def main(): argsdict = vars(args) print(pprint.pformat(argsdict)) - import ipdb; ipdb.set_trace() + #import ipdb; ipdb.set_trace() STOP_SEQS = ['\nclass', '\ndef', '\n#', '\nif', '\nprint'] problems = read_problems() @@ -145,7 +146,7 @@ def main(): loops = 1 for _ in tqdm(range(loops), total=loops, leave=False, ncols=0): - import ipdb; ipdb.set_trace() + #import ipdb; ipdb.set_trace() with torch.no_grad(): gen_tokens = model.generate( **encoding,