CodeFuse-DeepSeek-33B

我要开发同款
匿名用户2024年07月31日
124阅读

技术信息

官网地址
https://github.com/codefuse-ai
开源地址
https://modelscope.cn/models/codefuse-ai/CodeFuse-DeepSeek-33B
授权协议
other

作品详情

Model Card for CodeFuse-DeepSeek-33B

[中文] [Eglish]

Cloe with HTTP

 git cloe https://www.modelscope.c/codefuse-ai/CodeFuse-DeepSeek-33B.git

Model Descriptio

CodeFuse-DeepSeek-33B is a 33B Code-LLM fietued by QLoRA o multiple code-related tasks o the base model DeepSeek-Coder-33B. It raks first o the HuggigFace Big Code Models Leaderboard (2024.01.30).


News ad Updates

??? 2024-01-30 CodeFuse-DeepSeek-33B raks first o the HuggigFace Big Code Models Leaderboard

??? 2024-01-12 CodeFuse-DeepSeek-33B has bee released, achivig a pass@1 (greedy decodig) score of 78.65% o HumaEval.

?? 2023-11-10 CodeFuse-CodeGeeX2-6B has bee released, achievig a pass@1 (greedy decodig) score of 45.12% o HumaEval, which is a 9.22% icrease compared to CodeGeeX2 35.9%.

?? 2023-10-20 CodeFuse-QWe-14B techical documetatio has bee released. For those iterested, please refer to the CodeFuse article o our WeChat official accout via the provided lik.(https://mp.weixi.qq.com/s/PCQPkvbvfxSPzsqjOILCDw)

?? 2023-10-16 CodeFuse-QWe-14B has bee released, achievig a pass@1 (greedy decodig) score of 48.78% o HumaEval, which is a 16% icrease compared to Qwe-14b's 32.3%.

?? 2023-09-27 CodeFuse-StarCoder-15B has bee released, achievig a pass@1 (greedy decodig) score of 54.9% o HumaEval, which is a 21% icrease compared to StarCoder's 33.6%.

??? 2023-09-26 We are pleased to aouce the release of the 4-bit quatized versio of CodeFuse-CodeLlama-34B. Despite the quatizatio process, the model still achieves a remarkable 73.8% accuracy (greedy decodig) o the HumaEval pass@1 metric.

??? 2023-09-11 CodeFuse-CodeLlama34B has achived 74.4% of pass@1 (greedy decodig) o HumaEval, which is SOTA results for opespurced LLMs at preset.


Code Commuity

Homepage: ? https://github.com/codefuse-ai (Please give us your support with a Star? + Fork? + Watch?)

  • If you wish to fie-tue the model yourself, you ca visit ✨MFTCoder✨✨

  • If you wish to see a demo of the model, you ca visit ✨CodeFuse Demo✨✨

Cotact Us:

Performace

Code

Model HumaEval(pass@1) Date
CodeFuse-CodeLlama-34B 74.4% 2023.9
CodeFuse-CodeLlama-34B-4bits 73.8% 2023.9
WizardCoder-Pytho-34B-V1.0 73.2% 2023.8
GPT-4(zero-shot) 67.0% 2023.3
PaGu-Coder2 15B 61.6% 2023.8
CodeLlama-34b-Pytho 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
Qwe-14b 32.3% 2023.10
CodeFuse-StarCoder-15B 54.9% 2023.9
CodeFuse-QWe-14B 48.78% 2023.10
CodeFuse-CodeGeeX2-6B 45.12% 2023.11
CodeFuse-DeepSeek-33B 78.65% 2024.01

NLP


Requiremets

  • pytho>=3.8
  • pytorch>=2.0.0
  • trasformers>=4.33.2
  • Setecepiece
  • CUDA 11.4

Iferece Strig Format

The iferece strig is a cocateated strig formed by combiig coversatio data(system, huma ad bot cotets) i the traiig data format. It is used as iput durig the iferece process. Here are examples of prompts used to request the model:

Multi-Roud with System Prompt:

"""
<s>system
System istructio
<s>huma
Huma 1st roud iput
<s>bot
Bot 1st roud output<|ed▁of▁setece|>
<s>huma
Huma 2d roud iput
<s>bot
Bot 2d roud output<|ed▁of▁setece|>
...
...
...
<s>huma
Huma th roud iput
<s>bot
"""

Sigle-Roud without System Prompt:

"""
<s>huma
User prompt...
<s>bot

"""

I this format, the system sectio is optioal ad the coversatio ca be either sigle-tur or multi-tur. Whe applyig iferece, you always make your iput strig ed with "\<s>bot" to ask the model geeratig aswers.

For example, the format used to ifer HumaEval is like the followig:

<s>huma
# laguage: Pytho
from typig import List
def separate_pare_groups(pare_strig: str) -> List[str]:
    """ Iput to this fuctio is a strig cotaiig multiple groups of ested paretheses. Your goal is to
    separate those group ito separate strigs ad retur the list of those.
    Separate groups are balaced (each ope brace is properly closed) ad ot ested withi each other
    Igore ay spaces i the iput strig.
    >>> separate_pare_groups('( ) (( )) (( )( ))')
    ['()', '(())', '(()())']
    """
<s>bot

Specifically, we also add the Programmig Laguage Tag (e.g. # laguage: Pytho for Pytho) used by CodeGeex models.

Quickstart

import torch
from modelscope import AutoTokeizer, AutoModelForCausalLM, GeeratioCofig, sapshot_dowload

def load_model_tokeizer(model_path):
    tokeizer = AutoTokeizer.from_pretraied(model_path, trust_remote_code=True, use_fast=False, legacy=False)
    tokeizer.eos_toke = "<|ed▁of▁setece|>"
    tokeizer.pad_toke = "<|ed▁of▁setece|>"
    tokeizer.eos_toke_id = tokeizer.covert_tokes_to_ids(tokeizer.eos_toke)
    tokeizer.pad_toke_id = tokeizer.covert_tokes_to_ids(tokeizer.pad_toke)
    tokeizer.paddig_side = "left"

    model = AutoModelForCausalLM.from_pretraied(model_path, device_map='auto',torch_dtype=torch.bfloat16, trust_remote_code=True)
    retur model, tokeizer


HUMAN_ROLE_START_TAG = "<s>huma\"
BOT_ROLE_START_TAG = "<s>bot\"

model_dir = sapshot_dowload('codefuse-ai/CodeFuse-DeepSeek-33B', revisio='v1.0.0')
text_list = [f'{HUMAN_ROLE_START_TAG}请写一个快排程序\#Pytho\{BOT_ROLE_START_TAG}']

model, tokeizer = load_model_tokeizer(model_dir)
iputs = tokeizer(text_list, retur_tesors='pt', paddig=True, add_special_tokes=False).to('cuda')
iput_ids = iputs["iput_ids"]
attetio_mask = iputs["attetio_mask"]
geeratio_cofig = GeeratioCofig(
        eos_toke_id=tokeizer.eos_toke_id,
        pad_toke_id=tokeizer.pad_toke_id,
        temperature=0.2,
        max_ew_tokes=512,
        um_retur_sequeces=1,
        um_beams=1,
        top_p=0.95,
        do_sample=False
)
outputs = model.geerate(
        iputs= iput_ids,
        attetio_mask=attetio_mask,
        **geeratio_cofig.to_dict()
)
ge_text = tokeizer.batch_decode(outputs[:, iput_ids.shape[1]:], skip_special_tokes=True)
prit(ge_text[0])

模型简介

CodeFuse-DeepSeek-33B 是一个通过QLoRA对基座模型DeepSeek-Coder-33B进行多代码任务微调而得到的代码大模型。

新闻

??? 2024-01-30 CodeFuse-DeepSeek-33B荣登HuggigFace Big Code Models LeaderBoard榜单榜首

??? 2024-01-12 CodeFuse-DeepSeek-33B模型发布,模型在HumaEval pass@1指标为78.65% (贪婪解码)。

?? 2023-11-10 开源了CodeFuse-CodeGeeX2-6B模型,在HumaEval pass@1(greedy decodig)上可以达到48.12%, 比CodeGeeX2提高了9.22%的代码能力(HumaEval)

?? 2023-10-20 公布了CodeFuse-QWe-14B技术文档,感兴趣详见微信公众号CodeFuse文章:https://mp.weixi.qq.com/s/PCQPkvbvfxSPzsqjOILCDw

?? 2023-10-16开源了CodeFuse-QWe-14B模型,在HumaEval pass@1(greedy decodig)上可以达到48.78%, 比Qwe-14b提高了16%的代码能力(HumaEval)

?? 2023-09-27开源了CodeFuse-StarCoder-15B模型,在HumaEval pass@1(greedy decodig)上可以达到54.9%, 比StarCoder提高了21%的代码能力(HumaEval)

??? 2023-09-26 CodeFuse-CodeLlama-34B 4bits量化版本发布,量化后模型在HumaEval pass@1指标为73.8% (贪婪解码)。

??? 2023-09-11 CodeFuse-CodeLlama-34B发布,HumaEval pass@1指标达到74.4% (贪婪解码), 为当前开源SOTA。


代码社区

大本营: ? https://github.com/codefuse-ai (请支持我们的项目Star? + Fork? + Watch?

联系我们:

评测表现

代码

模型 HumaEval(pass@1) 日期
CodeFuse-CodeLlama-34B 74.4% 2023.9
CodeFuse-CodeLlama-34B-4bits 73.8% 2023.9
WizardCoder-Pytho-34B-V1.0 73.2% 2023.8
GPT-4(zero-shot) 67.0% 2023.3
PaGu-Coder2 15B 61.6% 2023.8
CodeLlama-34b-Pytho 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
Qwe-14b 32.3% 2023.10
CodeFuse-StarCoder-15B 54.9% 2023.9
CodeFuse-QWe-14B 48.78% 2023.8
CodeFuse-CodeGeeX2-6B 45.12% 2023.11
CodeFuse-DeepSeek-33B. 78.65% 2024.01

NLP

Requiremets

  • pytho>=3.8
  • pytorch>=2.0.0
  • trasformers>=4.33.2
  • Setecepiece
  • CUDA 11.4

推理数据格式

推理数据为模型在训练数据格式下拼接的字符串形式,它也是推理时输入prompt拼接的方式. 下面分别是带系统提示的多轮会话格式和不带系统提示的单轮会话格式:

带System提示的多轮会话格式:

"""
<s>system
System istructio
<s>huma
Huma 1st roud iput
<s>bot
Bot 1st roud output<|ed▁of▁setece|>
<s>huma
Huma 2d roud iput
<s>bot
Bot 2d roud output<|ed▁of▁setece|>
...
...
...
<s>huma
Huma th roud iput
<s>bot
"""

不带System提示的单轮会话格式:

"""
<s>huma
User prompt...
<s>bot

"""

在这个格式中,System提示是可选的(按需设定),支持单轮会话也支持多轮会话。推理时,请确保拼接的prompt字符串以"\<s>bot\"结尾,引导模型生成回答。

例如,推理HumaEval数据时使用的格式如下所示:

<s>huma
# laguage: Pytho
from typig import List
def separate_pare_groups(pare_strig: str) -> List[str]:
    """ Iput to this fuctio is a strig cotaiig multiple groups of ested paretheses. Your goal is to
    separate those group ito separate strigs ad retur the list of those.
    Separate groups are balaced (each ope brace is properly closed) ad ot ested withi each other
    Igore ay spaces i the iput strig.
    >>> separate_pare_groups('( ) (( )) (( )( ))')
    ['()', '(())', '(()())']
    """
<s>bot

特别地,我们也使用了CodeGeeX系列模型采用的编程语言区分标签(例如,对于Pytho语言,我们会使用# laguage: Pytho)。

快速使用

import torch
from modelscope import AutoTokeizer, AutoModelForCausalLM, GeeratioCofig, sapshot_dowload

def load_model_tokeizer(model_path):
    tokeizer = AutoTokeizer.from_pretraied(model_path, trust_remote_code=True, use_fast=False, legacy=False)
    tokeizer.eos_toke = "<|ed▁of▁setece|>"
    tokeizer.pad_toke = "<|ed▁of▁setece|>"
    tokeizer.eos_toke_id = tokeizer.covert_tokes_to_ids(tokeizer.eos_toke)
    tokeizer.pad_toke_id = tokeizer.covert_tokes_to_ids(tokeizer.pad_toke)
    tokeizer.paddig_side = "left"

    model = AutoModelForCausalLM.from_pretraied(model_path, device_map='auto',torch_dtype=torch.bfloat16, trust_remote_code=True)
    retur model, tokeizer


HUMAN_ROLE_START_TAG = "<s>huma\"
BOT_ROLE_START_TAG = "<s>bot\"

model_dir = sapshot_dowload('codefuse-ai/CodeFuse-DeepSeek-33B', revisio='v1.0.0')
text_list = [f'{HUMAN_ROLE_START_TAG}请写一个快排程序\#Pytho\{BOT_ROLE_START_TAG}']

model, tokeizer = load_model_tokeizer(model_dir)
iputs = tokeizer(text_list, retur_tesors='pt', paddig=True, add_special_tokes=False).to('cuda')
iput_ids = iputs["iput_ids"]
attetio_mask = iputs["attetio_mask"]
geeratio_cofig = GeeratioCofig(
        eos_toke_id=tokeizer.eos_toke_id,
        pad_toke_id=tokeizer.pad_toke_id,
        temperature=0.2,
        max_ew_tokes=512,
        um_retur_sequeces=1,
        um_beams=1,
        top_p=0.95,
        do_sample=False
)
outputs = model.geerate(
        iputs= iput_ids,
        attetio_mask=attetio_mask,
        **geeratio_cofig.to_dict()
)
ge_text = tokeizer.batch_decode(outputs[:, iput_ids.shape[1]:], skip_special_tokes=True)
prit(ge_text[0])

加入我们

我们是平台技术事业群AI Native团队,负责蚂蚁蚂蚁集团平台工程的智能化,团队成立3年多以来,支持了蚂蚁集团云计算基础设施智能化运维的升级改造。团队的Missio是,通过世界级的技术创新和影响,构建有广泛用户的算法服务和平台,支撑内外部产品和业务落地。团队秉承创新基因,在支撑业务落地的同时,推动技术影响。3年以来在ICLR、NeurIPS、KDD、ACL等顶会发表论文20余篇,创新业务结果获得两次蚂蚁技术最高奖T-Star,1次蚂蚁集团最高奖SuperMA。开源项目CodeFuse获得4K点赞(2024年2月),Huggigface和modelscope上模型累积下载量超过150万次。

我们正在寻找行业中的佼佼者加入我们的团队!如果您希望在一个充满活力、创新和卓越文化的环境中发展您的职业生涯,欢迎您查看我们的社招&校招机会,加入我们,一起创造下一个行业里程碑。

校招:https://hrrecommed.atgroup.com/guide.html?code=8uoP5mlus5DqQYbEEqcE2FD5JZH21MwvMUIb9mb6X3osXPuBraG54SyM8GL7

社招:https://talet.atgroup.com/off-campus-positio?positioId=1933830

功能介绍

Model Card for CodeFuse-DeepSeek-33B [中文] [English] Clone with HTTP git clone https://www

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论