🚀 Seed-Coder-8B-Instruct
Seed-Coder-8B-Instruct 是一款強大的開源代碼模型,具有以模型為中心、透明和高性能等特點,在多種編碼任務中表現出色。
🚀 快速開始
你需要安裝最新版本的 transformers
和 accelerate
:
pip install -U transformers accelerate
以下是一個簡單的示例,展示瞭如何使用 Hugging Face pipeline
API 加載模型並生成代碼:
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "ByteDance-Seed/Seed-Coder-8B-Instruct"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True)
messages = [
{"role": "user", "content": "Write a quick sort algorithm."},
]
input_ids = tokenizer.apply_chat_template(
messages,
tokenize=True,
return_tensors="pt",
add_generation_prompt=True,
).to(model.device)
outputs = model.generate(input_ids, max_new_tokens=512)
response = tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True)
print(response)
✨ 主要特性
我們很高興推出 Seed-Coder,這是一個強大、透明且參數高效的 8B 規模開源代碼模型家族,包括基礎、指令和推理變體。Seed-Coder 通過以下亮點推動了開源代碼模型的發展:
- 以模型為中心:Seed-Coder 主要利用大語言模型(LLMs)而不是手工規則進行代碼數據過濾,最大限度地減少了預訓練數據構建中的人工工作量。
- 透明:我們公開分享了以模型為中心的數據管道的詳細信息,包括整理 GitHub 數據、提交數據和代碼相關網絡數據的方法。
- 強大:在各種編碼任務中,Seed-Coder 在同類規模的開源模型中達到了最先進的性能。
本倉庫包含 Seed-Coder-8B-Instruct 模型,該模型具有以下特點:
- 類型:因果語言模型
- 訓練階段:預訓練和後訓練
- 數據源:公共數據集、合成數據
- 上下文長度:32,768
📦 模型下載
模型名稱 |
長度 |
下載 |
說明 |
Seed-Coder-8B-Base |
32K |
🤗 模型 |
在以模型為中心的代碼數據上進行預訓練。 |
👉 Seed-Coder-8B-Instruct |
32K |
🤗 模型 |
經過指令微調,以符合用戶意圖。 |
Seed-Coder-8B-Reasoning |
64K |
🤗 模型 |
經過強化學習訓練,以提高推理能力。 |
Seed-Coder-8B-Reasoning-bf16 |
64K |
🤗 模型 |
經過強化學習訓練,以提高推理能力。 |
📚 詳細文檔
評估
Seed-Coder-8B-Instruct 已經在廣泛的編碼任務中進行了評估,包括代碼生成、代碼推理、代碼編輯和軟件工程,在約 8B 的開源模型中達到了最先進的性能。
模型 |
HumanEval |
MBPP |
MHPP |
BigCodeBench (Full) |
BigCodeBench (Hard) |
LiveCodeBench (2410 – 2502) |
CodeLlama-7B-Instruct |
40.9 |
54.0 |
6.7 |
25.7 |
4.1 |
3.6 |
DeepSeek-Coder-6.7B-Instruct |
74.4 |
74.9 |
20.0 |
43.8 |
15.5 |
9.6 |
CodeQwen1.5-7B-Chat |
83.5 |
77.7 |
17.6 |
43.6 |
15.5 |
3.0 |
Yi-Coder-9B-Chat |
82.3 |
82.0 |
26.7 |
49.0 |
17.6 |
17.5 |
Llama-3.1-8B-Instruct |
68.3 |
70.1 |
17.1 |
40.5 |
13.5 |
11.5 |
OpenCoder-8B-Instruct |
83.5 |
79.1 |
30.5 |
50.9 |
18.9 |
17.1 |
Qwen2.5-Coder-7B-Instruct |
88.4 |
83.5 |
26.7 |
48.8 |
20.3 |
17.3 |
Qwen3-8B |
84.8 |
77.0 |
32.8 |
51.7 |
23.0 |
23.5 |
Seed-Coder-8B-Instruct |
84.8 |
85.2 |
36.2 |
53.3 |
26.4 |
24.7 |
有關詳細的基準測試性能,請參考我們的 📑 技術報告。
📄 許可證
本項目採用 MIT 許可證。有關詳細信息,請參閱 許可證文件。