forked from nlpxucan/WizardLM
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
46d1ce7
commit 57d32e4
Showing
8 changed files
with
170 additions
and
74 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
# Load model directly | ||
from transformers import AutoTokenizer, AutoModelForCausalLM | ||
|
||
import os | ||
cdir=os.getcwd() | ||
print(cdir) | ||
|
||
tokenizer = AutoTokenizer.from_pretrained("WizardLM/WizardCoder-15B-V1.0", cache_dir=cdir) | ||
print(tokenizer) | ||
|
||
model = AutoModelForCausalLM.from_pretrained("WizardLM/WizardCoder-15B-V1.0", cache_dir=cdir) | ||
print(model) | ||
print(sum(p.numel() for p in model.parameters())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
######################################################################### | ||
# File Name: inf.sh | ||
# Author: Xianchao Wu | ||
# mail: [email protected] | ||
# Created Time: Fri Jul 28 07:55:20 2023 | ||
######################################################################### | ||
#!/bin/bash | ||
|
||
bmodel="/workspace/asr/WizardLM/WizardCoder/models--WizardLM--WizardCoder-15B-V1.0/snapshots/926ca1b215c4631bc5f8c3e47173381452c23e5c" | ||
inpath="./data/in.jsonl" | ||
outpath="./data/out.jsonl" | ||
|
||
python -m ipdb src/inference_wizardcoder.py \ | ||
--base_model $bmodel \ | ||
--input_data_path $inpath \ | ||
--output_data_path $outpath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
######################################################################### | ||
# File Name: mbpp_1.sh | ||
# Author: Xianchao Wu | ||
# mail: [email protected] | ||
# Created Time: Thu Aug 10 06:39:18 2023 | ||
######################################################################### | ||
#!/bin/bash | ||
|
||
#model="/path/to/your/model" | ||
model="/workspace/asr/WizardLM/WizardCoder/models--WizardLM--WizardCoder-15B-V1.0/snapshots/926ca1b215c4631bc5f8c3e47173381452c23e5c" | ||
temp=0.2 # temperature, TODO reset this 温度 | ||
max_len=2048 | ||
pred_num=200 | ||
num_seqs_per_iter=2 | ||
|
||
output_path=preds/MBPP_T${temp}_N${pred_num} | ||
mbpp_path=data/mbpp.test.jsonl # we provide this file in data/mbpp.test.zip | ||
|
||
mkdir -p ${output_path} | ||
echo 'Output path: '$output_path | ||
echo 'Model to eval: '$model | ||
|
||
# for debug NOTE | ||
debug=0 | ||
if [[ $debug == 1 ]] | ||
then | ||
gpu=1 | ||
start_index=0 | ||
end_index=2 | ||
|
||
CUDA_VISIBLE_DEVICES=$gpu python -m ipdb src/mbpp_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} \ | ||
--mbpp_path ${mbpp_path} | ||
|
||
exit 0 | ||
fi | ||
|
||
# 500 problems, 63 per GPU if GPU=8 | ||
index=0 | ||
gpu_num=8 | ||
for ((i = 0; i < $gpu_num; i++)); do | ||
start_index=$((i * 50)) | ||
end_index=$(((i + 1) * 50)) | ||
|
||
gpu=$((i)) | ||
echo 'Running process #' ${i} 'from' $start_index 'to' $end_index 'on GPU' ${gpu} | ||
((index++)) | ||
( | ||
CUDA_VISIBLE_DEVICES=$gpu python src/mbpp_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} \ | ||
--mbpp_path ${mbpp_path} | ||
) & | ||
if (($index % $gpu_num == 0)); then wait; fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.