🚀 Nxcode - CQ - 7B - orpo
Nxcode - CQ - 7B - orpo是一个基于无参考模型的整体偏好优化方法,在100k高质量排序数据样本上对Qwen/CodeQwen1.5 - 7B进行微调得到的模型。

🚀 快速开始
这里提供了一个使用apply_chat_template
的代码片段,向你展示如何加载分词器和模型,以及如何生成内容。如果你在加载分词器时遇到错误,应该升级transformers库。
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "cuda"
model = AutoModelForCausalLM.from_pretrained(
"NTQAI/Nxcode-CQ-7B-orpo",
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("NTQAI/Nxcode-CQ-7B-orpo")
prompt = """Complete the following Python function:
from typing import List
def has_close_elements(numbers: List[float], threshold: float) -> bool:
""" Check if in given list of numbers, are any two numbers closer to each other than
given threshold.
>>> has_close_elements([1.0, 2.0, 3.0], 0.5)
False
>>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)
True
"""
"""
messages = [
{"role": "user", "content": prompt}
]
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
outputs = model.generate(inputs, max_new_tokens=512, do_sample=False, top_k=50, top_p=0.95, num_return_sequences=1, eos_token_id=tokenizer.eos_token_id)
res = tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True)
✨ 主要特性
EvalPlus |
pass@1 |
HumanEval |
86.6 |
HumanEval+ |
83.5 |
MBPP(v0.2.0) |
82.3 |
MBPP+(v0.2.0) |
70.4 |
我们使用以下简单模板为Evalplus生成解决方案:
"Complete the following Python function:\n{prompt}"
Evalplus排行榜
模型 |
HumanEval |
HumanEval+ |
GPT - 4 - Turbo (2024年4月) |
90.2 |
86.6 |
GPT - 4 (2023年5月) |
88.4 |
81.17 |
GPT - 4 - Turbo (2023年11月) |
85.4 |
79.3 |
CodeQwen1.5 - 7B - Chat |
83.5 |
78.7 |
claude - 3 - opus (2024年3月) |
82.9 |
76.8 |
DeepSeek - Coder - 33B - instruct |
81.1 |
75.0 |
WizardCoder - 33B - V1.1 |
79.9 |
73.2 |
OpenCodeInterpreter - DS - 33B |
79.3 |
73.8 |
speechless - codellama - 34B - v2.0 |
77.4 |
72 |
GPT - 3.5 - Turbo (2023年11月) |
76.8 |
70.7 |
Llama3 - 70B - instruct |
76.2 |
70.7 |
Bigcode排行榜
Bigcode排行榜
2024年5月9日

📄 许可证
本项目使用tongyi - qianwen - research许可证。
联系信息
如果您有与本项目相关的个人交流需求,请联系Nha Nguyen Van (nha.nguyen@ntq - solution.com.vn)。