🚀 Seed-Coder-8B-Reasoning-bf16
Seed-Coder是一個強大、透明且參數高效的8B規模開源代碼模型家族,包含基礎、指令和推理等不同變體。本項目旨在推動開源代碼模型的發展,具有以模型為中心、透明和強大等特點。
🚀 快速開始
你需要安裝最新版本的 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-Reasoning-bf16"
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=16384)
response = tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True)
print(response)
✨ 主要特性
- 以模型為中心:Seed-Coder主要利用大語言模型(LLMs)而非手工規則進行代碼數據過濾,最大限度地減少了預訓練數據構建中的人工工作量。
- 透明:我們公開分享了以模型為中心的數據管道的詳細信息,包括篩選GitHub數據、提交數據和與代碼相關的網絡數據的方法。
- 強大:在各種編碼任務中,Seed-Coder在同類規模的開源模型中達到了最先進的性能。
這是Seed-Coder-8B-Reasoning模型的 bf16版本,具有以下特點:
- 類型:因果語言模型
- 訓練階段:預訓練和後訓練
- 數據源:公共數據集
- 上下文長度:65,536
📦 安裝指南
安裝最新版本的 transformers
和 accelerate
:
pip install -U transformers accelerate
💻 使用示例
基礎用法
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "ByteDance-Seed/Seed-Coder-8B-Reasoning-bf16"
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=16384)
response = tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True)
print(response)
📚 詳細文檔
Seed-Coder-8B-Reasoning在競賽編程中表現出色,證明了較小的大語言模型也能勝任複雜的推理任務。我們的模型在IOI'2024上超越了QwQ-32B和DeepSeek-R1,並在Codeforces競賽中達到了與o1-mini相當的ELO評級。
有關詳細的基準測試性能,請參考我們的 📑 技術報告。
📄 許可證
本項目採用MIT許可證。有關詳細信息,請參閱 LICENSE文件。
模型下載
模型名稱 |
長度 |
下載鏈接 |
備註 |
Seed-Coder-8B-Base |
32K |
🤖 Model |
在以模型為中心的代碼數據上進行預訓練。 |
Seed-Coder-8B-Instruct |
32K |
🤖 Model |
進行指令微調以與用戶意圖對齊。 |
Seed-Coder-8B-Reasoning |
64K |
🤖 Model |
通過強化學習提升推理能力。 |
👉 Seed-Coder-8B-Reasoning-bf16 |
64K |
🤖 Model |
通過強化學習提升推理能力。 |