Skip to content

Commit

Permalink
humaneval dgx1
Browse files Browse the repository at this point in the history
  • Loading branch information
Xianchao-Wu committed Aug 16, 2023
1 parent 0bb74ce commit 0475da2
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 7 deletions.
43 changes: 43 additions & 0 deletions WizardCoder/humaneval_1_dgx1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#########################################################################
# File Name: humaneval_1_dgx1.sh
# Author: Xianchao Wu
# mail: [email protected]
# 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
1 change: 1 addition & 0 deletions WizardCoder/mbpp_3_a100.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 8 additions & 7 deletions WizardCoder/src/humaneval_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 0475da2

Please sign in to comment.