Skip to content

Commit 063d2d4

Browse files
authored
add seed coder - 8b
1 parent 0d2ff70 commit 063d2d4

File tree

3 files changed

+46
-15
lines changed

3 files changed

+46
-15
lines changed

src/chart_models_chat.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,21 @@
55

66
from constants import CHAT_MODELS
77

8+
# "color": "#CC5500", # orange
9+
# "color": "#8B0000", # red
10+
# "color": "#4682B4", # light blue
11+
# "color": "#2E8B57", # green
12+
# "color": "#6A0DAD", # purple
13+
814
def create_chat_models_comparison_plot():
915
model_categories = {
1016
"coding": {
1117
"models": [
1218
# "Qwen Coder - 1.5b",
1319
# "Qwen Coder - 3b",
14-
# "Qwen Coder - 7b",
15-
# "Qwen Coder - 14b",
16-
# "Qwen Coder - 32b",
20+
"Seed Coder - 8b"
1721
],
18-
# "color": "#CC5500", # orange
19-
# "color": "#8B0000", # red
20-
# "color": "#4682B4", # light blue
21-
"color": "#DAA520", # gold
22+
"color": "#DAA520",
2223
"label": "Coding Focused"
2324
},
2425
"thinking": {
@@ -32,23 +33,21 @@ def create_chat_models_comparison_plot():
3233
"Qwen 3 - 32b",
3334
"GLM4-Z1 - 32b",
3435
],
35-
"color": "#CC5500", # orange
36-
# "color": "#2E8B57", # green
36+
"color": "#CC5500",
37+
3738
"label": "Thinking"
3839
},
3940
"coding_and_thinking": {
4041
"models": [
4142
# "Olympic Coder - 7b",
4243
# "Olympic Coder - 32b"
4344
],
44-
"color": "#8B0000", # red
45-
# "color": "#6A0DAD", # purple
46-
# "color": "#4682B4", # light blue
45+
"color": "#8B0000",
46+
4747
"label": "Coding Focused and Thinking"
4848
}
4949
}
5050

51-
# Create DataFrame with all models from CHAT_MODELS
5251
df = pd.DataFrame([
5352
{"model": model, "cps": data["cps"], "vram": data["vram"] / 1024}
5453
for model, data in CHAT_MODELS.items()
@@ -61,7 +60,7 @@ def create_chat_models_comparison_plot():
6160
fig.patch.set_facecolor('#2e2e2e')
6261
ax1.set_facecolor('#2e2e2e')
6362

64-
ax1.set_title("BitsAndBytes (4-bit) - RTX 4090 - 4096 context limit", fontsize=14, color='white', pad=5)
63+
ax1.set_title("BitsAndBytes (4-bit) - RTX 4090", fontsize=14, color='white', pad=5)
6564

6665
ax2 = ax1.twinx()
6766

src/constants.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# ── constants.py ────────────────────────────────────────────────────────────────
2-
# … existing imports / data …
32

43
GLM4Z1_CHAT_TEMPLATE = """[gMASK]<sop>
54
{%- if tools -%}
@@ -377,6 +376,17 @@
377376
'gated': False,
378377
'max_new_tokens': 4096,
379378
},
379+
'Seed Coder - 8b': {
380+
'model': 'Seed Coder - 8b',
381+
'repo_id': 'ByteDance-Seed/Seed-Coder-8B-Instruct',
382+
'cache_dir': 'ByteDance-Seed--Seed-Coder-8B-Instruct',
383+
'cps': 183.82,
384+
'vram': 8441.93,
385+
'function': 'SeedCoder',
386+
'precision': 'bfloat16',
387+
'gated': False,
388+
'max_new_tokens': 4096,
389+
},
380390
'Granite - 8b': {
381391
'model': 'Granite - 8b',
382392
'repo_id': 'ibm-granite/granite-3.3-8b-instruct',

src/module_chat.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,28 @@ def generate_response(self, inputs, remove_token_type_ids: bool = False):
400400
yield text[idx:].strip()
401401

402402

403+
class SeedCoder(BaseModel):
404+
def __init__(self, generation_settings, model_name=None):
405+
model_info = CHAT_MODELS[model_name]
406+
super().__init__(model_info, bnb_bfloat16_settings, generation_settings)
407+
408+
def create_prompt(self, augmented_query):
409+
return f"""<[begin_of_sentence]>system
410+
{system_message}
411+
412+
<[end_of_sentence]><[begin_of_sentence]>user
413+
{augmented_query}<[begin_of_sentence]>assistant
414+
"""
415+
416+
@torch.inference_mode()
417+
def generate_response(self, inputs):
418+
"""
419+
SeedCoder does not accept `token_type_ids`, so remove them
420+
before calling the parent generator.
421+
"""
422+
inputs.pop("token_type_ids", None)
423+
yield from super().generate_response(inputs)
424+
403425

404426
def generate_response(model_instance, augmented_query):
405427
prompt = model_instance.create_prompt(augmented_query)

0 commit comments

Comments
 (0)