模型:
TheBloke/WizardCoder-15B-1.0-GPTQ
Chat & support: my new Discord server
Want to contribute? TheBloke's Patreon page
这些文件是用于 WizardLM's WizardCoder 15B 1.0 的GPTQ 4bit模型文件。
这是使用 AutoGPTQ 进行4bit量化的结果。
Below is an instruction that describes a task. Write a response that appropriately completes the request ### Instruction: prompt ### Response:
请确保您正在使用最新版本的文本生成WebUI
首先确保您已安装 AutoGPTQ :
pip install auto-gptq
然后尝试以下示例代码:
from transformers import AutoTokenizer, pipeline, logging
from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
import argparse
model_name_or_path = "TheBloke/WizardCoder-15B-1.0-GPTQ"
# Or to load it locally, pass the local download path
# model_name_or_path = "/path/to/models/TheBloke_WizardCoder-15B-1.0-GPTQ"
use_triton = False
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
use_safetensors=True,
device="cuda:0",
use_triton=use_triton,
quantize_config=None)
# Prevent printing spurious transformers error when using pipeline with AutoGPTQ
logging.set_verbosity(logging.CRITICAL)
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
prompt_template = '''Below is an instruction that describes a task. Write a response that appropriately completes the request
### Instruction: {prompt}
### Response:'''
prompt = prompt_template.format(prompt="How do I sort a list in Python?")
outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.2, top_k=50, top_p=0.95)
print(outputs[0]['generated_text'])
gptq_model-4bit--1g.safetensors
这将与AutoGPTQ和CUDA版本的GPTQ-for-LLaMa配合使用。有关使用最新版本的GPTQ-for-LLaMa Triton模式的问题的报告。如果有问题,请改用AutoGPTQ。
它是使用--act-order(desc_act)创建的,以降低VRAM需求。
如需进一步支持以及有关这些模型和AI的讨论,请加入我们的 Discord :
感谢 chirper.ai 团队!
我收到了很多人的询问,问他们是否可以做出贡献。我喜欢提供模型并帮助人们,非常希望能够花更多的时间做这件事,并扩展到新的项目,如微调/训练。
如果您有能力并愿意做出贡献,我将非常感激并希望能继续提供更多模型,并开始开展新的AI项目。
捐赠者将优先获得有关任何AI / LLM /模型问题和请求的支持,访问私人Discord频道以及其他好处。
特别感谢:CarbonQuill的Luke,Aemon Algiz,Dmitriy Samsonov。
Patreon特别感谢:Ajan Kanaga,Kalila,Derek Yates,Sean Connelly,Luke,Nathan LeClaire,Trenton Dambrowitz,Mano Prime,David Flickinger,vamX,Nikolai Manek,senxiiz,Khalefa Al-Ahmad,Illia Dulskyi,trip7s trip,Jonathan Leane,Talal Aujan,Artur Olbinski,Cory Kujawski,Joseph William Delisle,Pyrater,Oscar Rangel,Lone Striker,Luke Pendergrass,Eugene Pentland,Johann-Peter Hartmann。
感谢所有慷慨的赞助者和捐赠者!
这是WizardCoder的全重量版。
存储库: https://github.com/nlpxucan/WizardLM/tree/main/WizardCoder
Twitter: https://twitter.com/WizardLM_AI/status/1669109414559911937
论文:即将发布,介绍了代码LLMs的全新Evol +方法。
演示(目前仅支持与代码相关的英语说明。):
为了开发我们的WizardCoder模型,我们首先根据编码任务自定义了Evol-Instruct方法。这包括将提示针对与代码相关的领域进行调整。随后,我们使用新创建的遵循指令的训练集对Code LLM StarCoder进行微调。
🔥下图显示了我们的WizardCoder在该基准测试中排名第三,超过了Claude-Plus(59.8对53.0)和Bard(59.8对44.5)。值得注意的是,我们的模型相比这些模型具有更小的大小。
❗注意:在这项研究中,我们从 LLM-Humaneval-Benchmarks 中复制了HumanEval和HumanEval+的得分。值得注意的是,所有提到的模型都使用单次尝试生成每个问题的代码解决方案,并报告通过率百分比。我们的WizardCoder使用贪婪解码生成答案,并使用相同的 code 进行测试。
下表清楚地表明我们的WizardCoder在所有开源模型上具有明显的性能优势。❗如果您对我们模型的不同得分(57.3和59.8)感到困惑,请查看注释。
| Model | HumanEval Pass@1 | MBPP Pass@1 |
|---|---|---|
| CodeGen-16B-Multi | 18.3 | 20.9 |
| CodeGeeX | 22.9 | 24.4 |
| LLaMA-33B | 21.7 | 30.2 |
| LLaMA-65B | 23.7 | 37.7 |
| PaLM-540B | 26.2 | 36.8 |
| PaLM-Coder-540B | 36.0 | 47.0 |
| PaLM 2-S | 37.6 | 50.0 |
| CodeGen-16B-Mono | 29.3 | 35.3 |
| Code-Cushman-001 | 33.5 | 45.9 |
| StarCoder-15B | 33.6 | 43.6* |
| InstructCodeT5+ | 35.0 | -- |
| WizardLM-30B 1.0 | 37.8 | -- |
| WizardCoder-15B 1.0 | 57.3 | 51.8 |
❗注意:StarCoder在MBPP上的复现结果。
❗注意:上表对我们的WizardCoder在HumanEval和MBPP基准测试中与其他模型进行了全面比较。我们按照以前的研究中概述的方法生成每个问题的20个样本来估计pass@1分数,并使用相同的 code 进行评估。 OpenAI 报告的GPT4和GPT3.5的分数分别为67.0和48.1(也许这些是早期版本的GPT4和GPT3.5)。
欢迎大家使用专业和困难的指令来评估WizardCoder,并向我们展示性能差的示例以及您的建议 issue discussion 。我们目前专注于改进Evol-Instruct,并希望在WizardCoder的下一个版本中解决现有的缺点和问题。之后,我们将公开最新的Evol-Instruct算法的代码和流程,并与您共同努力改进它。
在线演示
微调
推断
评估
引用
免责声明
我们将尽可能长期地为您提供最新的模型。如果某个链接不可用,请尝试其他链接。同时,请尽可能多地尝试您在工作和生活中遇到的真实和具有挑战性的与代码相关的问题。我们将根据您的反馈不断改进我们的模型。
我们使用来自 Llama-X 的修改后的代码train.py 对WizardCoder进行微调。我们使用以下超参数对StarCoder-15B进行微调:
| Hyperparameter | StarCoder-15B |
|---|---|
| Batch size | 512 |
| Learning rate | 2e-5 |
| Epochs | 3 |
| Max length | 2048 |
| Warmup step | 30 |
| LR scheduler | cosine |
要复现我们对WizardCoder的微调,请按照以下步骤进行操作:
huggingface-cli login
deepspeed train_wizardcoder.py \
--model_name_or_path "bigcode/starcoder" \
--data_path "/your/path/to/code_instruction_data.json" \
--output_dir "/your/path/to/ckpt" \
--num_train_epochs 3 \
--model_max_length 2048 \
--per_device_train_batch_size 16 \
--per_device_eval_batch_size 1 \
--gradient_accumulation_steps 4 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 50 \
--save_total_limit 2 \
--learning_rate 2e-5 \
--warmup_steps 30 \
--logging_steps 2 \
--lr_scheduler_type "cosine" \
--report_to "tensorboard" \
--gradient_checkpointing True \
--deepspeed configs/deepspeed_config.json \
--fp16 True
我们提供了用于WizardCoder的解码脚本,该脚本读取输入文件并为每个样本生成相应的响应,最后将它们合并到输出文件中。
您可以在src\inference_wizardcoder.py中指定base_model、input_data_path和output_data_path来设置解码模型、输入文件的路径和输出文件的路径。
pip install jsonlines
解码命令如下:
python src\inference_wizardcoder.py \
--base_model "/your/path/to/ckpt" \
--input_data_path "/your/path/to/input/data.jsonl" \
--output_data_path "/your/path/to/output/result.jsonl"
data.jsonl的格式应为:
{"idx": 11, "Instruction": "Write a Python code to count 1 to 10."}
{"idx": 12, "Instruction": "Write a Jave code to sum 1 to 10."}
src\inference_wizardcoder.py中我们的WizardCoder提示是:
Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
{instruction}
### Response:
我们为WizardCoder提供了在HumanEval上的评估脚本。
model="/path/to/your/model"
temp=0.2
max_len=2048
pred_num=200
num_seqs_per_iter=2
output_path=preds/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 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
output_path=preds/T${temp}_N${pred_num}
echo 'Output path: '$output_path
python process_humaneval.py --path ${output_path} --out_path ${output_path}.jsonl --add_prompt
evaluate_functional_correctness ${output_path}.jsonl
如果您在此存储库中使用数据或代码,请引用该存储库。
@misc{luo2023wizardcoder,
title={WizardCoder: Empowering Code Large Language Models with Evol-Instruct},
author={Ziyang Luo and Can Xu and Pu Zhao and Qingfeng Sun and Xiubo Geng and Wenxiang Hu and Chongyang Tao and Jing Ma and Qingwei Lin and Daxin Jiang},
year={2023},
}
与本项目相关的资源,包括代码、数据和模型权重,仅限于学术研究目的,不得用于商业目的。任何版本的WizardCoder生成的内容都受到不可控的变量(如随机性)的影响,因此,不能保证输出的准确性。本项目对模型输出内容不承担任何法律责任,也不对使用相关资源和输出结果导致的任何损失承担责任。