Views
No views yet

| Model | HumanEval(pass@1) | Date |
|---|---|---|
| CodeFuse-DeepSeek-33B | 78.65% | 2024.01 |
| CodeFuse-Mixtral-8x7B | 56.10% | 2024.01 |
| CodeFuse-CodeLlama-34B | 74.4% | 2023.9 |
| CodeFuse-CodeLlama-34B-4bits | 73.8% | 2023.9 |
| CodeFuse-StarCoder-15B | 54.9% | 2023.9 |
| CodeFuse-QWen-14B | 48.78% | 2023.10 |
| CodeFuse-CodeGeeX2-6B | 45.12% | 2023.11 |
| WizardCoder-Python-34B-V1.0 | 73.2% | 2023.8 |
| GPT-4(zero-shot) | 67.0% | 2023.3 |
| PanGu-Coder2 15B | 61.6% | 2023.8 |
| CodeLlama-34b-Python | 53.7% | 2023.8 |
| CodeLlama-34b | 48.8% | 2023.8 |
| GPT-3.5(zero-shot) | 48.1% | 2022.11 |
| OctoCoder | 46.2% | 2023.8 |
| StarCoder-15B | 33.6% | 2023.5 |
| Qwen-14b | 32.3% | 2023.10 |
1"""
2<s>system
3System instruction
4<s>human
5Human 1st round input
6<s>bot
7Bot 1st round output</s>
8<s>human
9Human 2nd round input
10<s>bot
11Bot 2nd round output</s>
12...
13...
14...
15<s>human
16Human nth round input
17<s>bot
18"""1"""
2<s>human
3User prompt...
4<s>bot
5
6"""<s>human
# language: Python
from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
""" Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string.
>>> separate_paren_groups('( ) (( )) (( )( ))')
['()', '(())', '(()())']
"""
<s>bot
# language: Python" for Python) used by CodeGeex models.1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig
3
4def load_model_tokenizer(model_path):
5 tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True, use_fast=False, legacy=False)
6 tokenizer.eos_token = "</s>"
7 tokenizer.pad_token = "</s>"
8 tokenizer.eos_token_id = tokenizer.convert_tokens_to_ids(tokenizer.eos_token)
9 tokenizer.pad_token_id = tokenizer.convert_tokens_to_ids(tokenizer.pad_token)
10 tokenizer.padding_side = "left"
11
12 model = AutoModelForCausalLM.from_pretrained(model_path, device_map='auto',torch_dtype=torch.bfloat16, trust_remote_code=True)
13 return model, tokenizer
14
15
16HUMAN_ROLE_START_TAG = "<s>human\n"
17BOT_ROLE_START_TAG = "<s>bot\n"
18
19text_list = [f'{HUMAN_ROLE_START_TAG}Write a QuickSort program\n#Python\n{BOT_ROLE_START_TAG}']
20
21model, tokenizer = load_model_tokenizer("codefuse-ai/CodeFuse-Mixtral-8x7B")
22inputs = tokenizer(text_list, return_tensors='pt', padding=True, add_special_tokens=False).to('cuda')
23input_ids = inputs["input_ids"]
24attention_mask = inputs["attention_mask"]
25generation_config = GenerationConfig(
26 eos_token_id=tokenizer.eos_token_id,
27 pad_token_id=tokenizer.pad_token_id,
28 temperature=0.1,
29 max_new_tokens=512,
30 num_return_sequences=1,
31 num_beams=1,
32 top_p=0.95,
33 do_sample=False
34)
35outputs = model.generate(
36 inputs= input_ids,
37 attention_mask=attention_mask,
38 **generation_config.to_dict()
39)
40gen_text = tokenizer.batch_decode(outputs[:, input_ids.shape[1]:], skip_special_tokens=True)
41print(gen_text[0])| 模型 | HumanEval(pass@1) | 日期 |
|---|---|---|
| CodeFuse-DeepSeek-33B | 78.65% | 2024.01 |
| CodeFuse-Mixtral-8x7B | 56.10% | 2024.01 |
| CodeFuse-CodeLlama-34B | 74.4% | 2023.9 |
| CodeFuse-CodeLlama-34B-4bits | 73.8% | 2023.9 |
| CodeFuse-StarCoder-15B | 54.9% | 2023.9 |
| CodeFuse-QWen-14B | 48.78% | 2023.10 |
| CodeFuse-CodeGeeX2-6B | 45.12% | 2023.11 |
| WizardCoder-Python-34B-V1.0 | 73.2% | 2023.8 |
| GPT-4(zero-shot) | 67.0% | 2023.3 |
| PanGu-Coder2 15B | 61.6% | 2023.8 |
| CodeLlama-34b-Python | 53.7% | 2023.8 |
| CodeLlama-34b | 48.8% | 2023.8 |
| GPT-3.5(zero-shot) | 48.1% | 2022.11 |
| OctoCoder | 46.2% | 2023.8 |
| StarCoder-15B | 33.6% | 2023.5 |
| Qwen-14b | 32.3% | 2023.10 |
1"""
2<s>system
3System instruction
4<s>human
5Human 1st round input
6<s>bot
7Bot 1st round output</s>
8<s>human
9Human 2nd round input
10<s>bot
11Bot 2nd round output</s>
12...
13...
14...
15<s>human
16Human nth round input
17<s>bot
18"""1"""
2<s>human
3User prompt...
4<s>bot
5
6"""1<s>human
2# language: Python
3from typing import List
4def separate_paren_groups(paren_string: str) -> List[str]:
5 """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
6 separate those group into separate strings and return the list of those.
7 Separate groups are balanced (each open brace is properly closed) and not nested within each other
8 Ignore any spaces in the input string.
9 >>> separate_paren_groups('( ) (( )) (( )( ))')
10 ['()', '(())', '(()())']
11 """
12<s>bot
13# language: Python")。1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig
3
4def load_model_tokenizer(model_path):
5 tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True, use_fast=False, legacy=False)
6 tokenizer.eos_token = "<|end▁of▁sentence|>"
7 tokenizer.pad_token = "<|end▁of▁sentence|>"
8 tokenizer.eos_token_id = tokenizer.convert_tokens_to_ids(tokenizer.eos_token)
9 tokenizer.pad_token_id = tokenizer.convert_tokens_to_ids(tokenizer.pad_token)
10 tokenizer.padding_side = "left"
11
12 model = AutoModelForCausalLM.from_pretrained(model_path, device_map='auto',torch_dtype=torch.bfloat16, trust_remote_code=True)
13 return model, tokenizer
14
15
16HUMAN_ROLE_START_TAG = "<s>human\n"
17BOT_ROLE_START_TAG = "<s>bot\n"
18
19
20text_list = [f'{HUMAN_ROLE_START_TAG}请写一个快排程序\n#Python\n{BOT_ROLE_START_TAG}']
21
22model, tokenizer = load_model_tokenizer("codefuse-ai/CodeFuse-Mixtral-8x7b")
23inputs = tokenizer(text_list, return_tensors='pt', padding=True, add_special_tokens=False).to('cuda')
24input_ids = inputs["input_ids"]
25attention_mask = inputs["attention_mask"]
26generation_config = GenerationConfig(
27 eos_token_id=tokenizer.eos_token_id,
28 pad_token_id=tokenizer.pad_token_id,
29 temperature=0.2,
30 max_new_tokens=512,
31 num_return_sequences=1,
32 num_beams=1,
33 top_p=0.95,
34 do_sample=False
35)
36outputs = model.generate(
37 inputs= input_ids,
38 attention_mask=attention_mask,
39 **generation_config.to_dict()
40)
41gen_text = tokenizer.batch_decode(outputs[:, input_ids.shape[1]:], skip_special_tokens=True)
42print(gen_text[0])