Views
No views yet

Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
{prompt}
### Response:
| Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
|---|---|---|---|---|---|
| main | 4 | 128 | Evol Instruct Code | 8192 | 18.01 GB |
TheBloke/WizardCoder-33B-V1.1-AWQ.WizardCoder-33B-V1.1-AWQ--quantization awq parameter.python3 -m vllm.entrypoints.api_server --model TheBloke/WizardCoder-33B-V1.1-AWQ --quantization awq --dtype autoquantization=awq.1from vllm import LLM, SamplingParams
2
3prompts = [
4 "Tell me about AI",
5 "Write a story about llamas",
6 "What is 291 - 150?",
7 "How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
8]
9prompt_template=f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
10
11### Instruction:
12{prompt}
13
14### Response:
15'''
16
17prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
18
19sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
20
21llm = LLM(model="TheBloke/WizardCoder-33B-V1.1-AWQ", quantization="awq", dtype="auto")
22
23outputs = llm.generate(prompts, sampling_params)
24
25# Print the outputs.
26for output in outputs:
27 prompt = output.prompt
28 generated_text = output.outputs[0].text
29 print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")ghcr.io/huggingface/text-generation-inference:1.1.0--model-id TheBloke/WizardCoder-33B-V1.1-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096pip3 install huggingface-hub1from huggingface_hub import InferenceClient
2
3endpoint_url = "https://your-endpoint-url-here"
4
5prompt = "Tell me about AI"
6prompt_template=f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
7
8### Instruction:
9{prompt}
10
11### Response:
12'''
13
14client = InferenceClient(endpoint_url)
15response = client.text_generation(prompt,
16 max_new_tokens=128,
17 do_sample=True,
18 temperature=0.7,
19 top_p=0.95,
20 top_k=40,
21 repetition_penalty=1.1)
22
23print(f"Model output: ", response)pip3 install --upgrade "autoawq>=0.1.6" "transformers>=4.35.0"pip3 install https://github.com/casper-hansen/AutoAWQ/releases/download/v0.1.6/autoawq-0.1.6+cu118-cp310-cp310-linux_x86_64.whl1pip3 uninstall -y autoawq
2git clone https://github.com/casper-hansen/AutoAWQ
3cd AutoAWQ
4pip3 install .1from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
2
3model_name_or_path = "TheBloke/WizardCoder-33B-V1.1-AWQ"
4
5tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
6model = AutoModelForCausalLM.from_pretrained(
7 model_name_or_path,
8 low_cpu_mem_usage=True,
9 device_map="cuda:0"
10)
11
12# Using the text streamer to stream output one token at a time
13streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
14
15prompt = "Tell me about AI"
16prompt_template=f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
17
18### Instruction:
19{prompt}
20
21### Response:
22'''
23
24# Convert prompt to tokens
25tokens = tokenizer(
26 prompt_template,
27 return_tensors='pt'
28).input_ids.cuda()
29
30generation_params = {
31 "do_sample": True,
32 "temperature": 0.7,
33 "top_p": 0.95,
34 "top_k": 40,
35 "max_new_tokens": 512,
36 "repetition_penalty": 1.1
37}
38
39# Generate streamed output, visible one token at a time
40generation_output = model.generate(
41 tokens,
42 streamer=streamer,
43 **generation_params
44)
45
46# Generation without a streamer, which will include the prompt in the output
47generation_output = model.generate(
48 tokens,
49 **generation_params
50)
51
52# Get the tokens from the output, decode them, print them
53token_output = generation_output[0]
54text_output = tokenizer.decode(token_output)
55print("model.generate output: ", text_output)
56
57# Inference is also possible via Transformers' pipeline
58from transformers import pipeline
59
60pipe = pipeline(
61 "text-generation",
62 model=model,
63 tokenizer=tokenizer,
64 **generation_params
65)
66
67pipe_output = pipe(prompt_template)[0]['generated_text']
68print("pipeline output: ", pipe_output)
69Loader: AutoAWQ.| Model | Checkpoint | Paper | HumanEval | HumanEval+ | MBPP | MBPP+ | License |
|---|---|---|---|---|---|---|---|
| GPT-4-Turbo (Nov 2023) | - | - | 85.4 | 81.7 | 83.0 | 70.7 | - |
| GPT-4 (May 2023) | - | - | 88.4 | 76.8 | - | - | - |
| GPT-3.5-Turbo (Nov 2023) | - | - | 72.6 | 65.9 | 81.7 | 69.4 | - |
| Gemini Pro | - | - | 63.4 | 55.5 | 72.9 | 57.9 | - |
| DeepSeek-Coder-33B-instruct | - | - | 78.7 | 72.6 | 78.7 | 66.7 | - |
| WizardCoder-33B-V1.1 | 🤗 HF Link | 📃 [WizardCoder] | 79.9 | 73.2 | 78.9 | 66.9 | MSFTResearch |
| WizardCoder-Python-34B-V1.0 | 🤗 HF Link | 📃 [WizardCoder] | 73.2 | 64.6 | 73.2 | 59.9 | Llama2 |
| WizardCoder-15B-V1.0 | 🤗 HF Link | 📃 [WizardCoder] | 59.8 | 52.4 | -- | -- | OpenRAIL-M |
| WizardCoder-Python-13B-V1.0 | 🤗 HF Link | 📃 [WizardCoder] | 64.0 | -- | -- | -- | Llama2 |
| WizardCoder-Python-7B-V1.0 | 🤗 HF Link | 📃 [WizardCoder] | 55.5 | -- | -- | -- | Llama2 |
| WizardCoder-3B-V1.0 | 🤗 HF Link | 📃 [WizardCoder] | 34.8 | -- | -- | -- | OpenRAIL-M |
| WizardCoder-1B-V1.0 | 🤗 HF Link | 📃 [WizardCoder] | 23.8 | -- | -- | -- | OpenRAIL-M |
"Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n{instruction}\n\n### Response:"transformers==4.36.2
vllm==0.2.51model="WizardLM/WizardCoder-33B-V1.1"
2temp=0.0
3max_len=2048
4pred_num=1
5num_seqs_per_iter=1
6
7output_path=preds/T${temp}_N${pred_num}_WizardCoder-33B-V1.1_Greedy_Decode
8
9mkdir -p ${output_path}
10echo 'Output path: '$output_path
11echo 'Model to eval: '$model
12
13# 164 problems, 21 per GPU if GPU=8
14index=0
15gpu_num=8
16for ((i = 0; i < $gpu_num; i++)); do
17 start_index=$((i * 21))
18 end_index=$(((i + 1) * 21))
19
20 gpu=$((i))
21 echo 'Running process #' ${i} 'from' $start_index 'to' $end_index 'on GPU' ${gpu}
22 ((index++))
23 (
24 CUDA_VISIBLE_DEVICES=$gpu python humaneval_gen.py --model ${model} \
25 --start_index ${start_index} --end_index ${end_index} --temperature ${temp} \
26 --num_seqs_per_iter ${num_seqs_per_iter} --N ${pred_num} --max_len ${max_len} --output_path ${output_path} --greedy_decode
27 ) &
28 if (($index % $gpu_num == 0)); then wait; fi
29done1model="WizardLM/WizardCoder-33B-V1.1"
2temp=0.0
3max_len=2048
4pred_num=1
5num_seqs_per_iter=1
6
7output_path=preds/T${temp}_N${pred_num}_WizardCoder-33B-V1.1_Greedy_Decode_vllm
8
9mkdir -p ${output_path}
10echo 'Output path: '$output_path
11echo 'Model to eval: '$model
12
13CUDA_VISIBLE_DEVICES=0,1,2,3 python humaneval_gen_vllm.py --model ${model} \
14 --start_index 0 --end_index 164 --temperature ${temp} \
15 --num_seqs_per_iter ${num_seqs_per_iter} --N ${pred_num} --max_len ${max_len} --output_path ${output_path} --num_gpus 4 --overwrite1git clone https://github.com/evalplus/evalplus.git
2cd evalplus
3export PYTHONPATH=$PYTHONPATH:$(pwd)
4pip install -r requirements.txt1output_path=preds/T0.0_N1_WizardCoder-33B-V1.1_Greedy_Decode
2
3echo 'Output path: '$output_path
4python process_humaneval.py --path ${output_path} --out_path ${output_path}.jsonl --add_prompt
5
6evalplus.evaluate --dataset humaneval --samples ${output_path}.jsonl1model="WizardLM/WizardCoder-33B-V1.1"
2temp=0.0
3max_len=2048
4pred_num=1
5num_seqs_per_iter=1
6
7output_path=preds/MBPP_T${temp}_N${pred_num}_WizardCoder-33B-V1.1_Greedy_Decode
8
9mkdir -p ${output_path}
10echo 'Output path: '$output_path
11echo 'Model to eval: '$model
12
13# 399 problems, 50 per GPU if GPU=8
14index=0
15gpu_num=8
16for ((i = 0; i < $gpu_num; i++)); do
17 start_index=$((i * 50))
18 end_index=$(((i + 1) * 50))
19
20 gpu=$((i))
21 echo 'Running process #' ${i} 'from' $start_index 'to' $end_index 'on GPU' ${gpu}
22 ((index++))
23 (
24 CUDA_VISIBLE_DEVICES=$gpu python mbppplus_gen.py --model ${model} \
25 --start_index ${start_index} --end_index ${end_index} --temperature ${temp} \
26 --num_seqs_per_iter ${num_seqs_per_iter} --N ${pred_num} --max_len ${max_len} --output_path ${output_path} --mbpp_path "mbppplus.json" --greedy_decode
27 ) &
28 if (($index % $gpu_num == 0)); then wait; fi
29done1model="WizardLM/WizardCoder-33B-V1.1"
2temp=0.0
3max_len=2048
4pred_num=1
5num_seqs_per_iter=1
6
7output_path=preds/MBPP_T${temp}_N${pred_num}_WizardCoder-33B-V1.1_Greedy_Decode_vllm
8
9mkdir -p ${output_path}
10echo 'Output path: '$output_path
11echo 'Model to eval: '$model
12
13CUDA_VISIBLE_DEVICES=0,1,2,3 python mbppplus_gen_vllm.py --model ${model} \
14 --start_index ${start_index} --end_index ${end_index} --temperature ${temp} \
15 --num_seqs_per_iter ${num_seqs_per_iter} --N ${pred_num} --max_len ${max_len} --output_path ${output_path} --mbpp_path "mbppplus.json" --num_gpus 41git clone https://github.com/evalplus/evalplus.git
2cd evalplus
3export PYTHONPATH=$PYTHONPATH:$(pwd)
4pip install -r requirements.txt1output_path=preds/MBPP_T0.0_N1_WizardCoder-33B-V1.1_Greedy_Decode
2
3echo 'Output path: '$output_path
4python mbppplus_process_preds.py --path ${output_path} --out_path ${output_path}.jsonl --add_prompt
5
6evalplus.evaluate --dataset mbpp --samples ${output_path}.jsonl@article{luo2023wizardcoder,
title={WizardCoder: Empowering Code Large Language Models with Evol-Instruct},
author={Luo, Ziyang and Xu, Can and Zhao, Pu and Sun, Qingfeng and Geng, Xiubo and Hu, Wenxiang and Tao, Chongyang and Ma, Jing and Lin, Qingwei and Jiang, Daxin},
journal={arXiv preprint arXiv:2306.08568},
year={2023}
}