CompressedGemma commited on
Commit
6645bbb
·
verified ·
1 Parent(s): e564509

Upload slimshard.py

Browse files
Files changed (1) hide show
  1. slimshard.py +3 -4
slimshard.py CHANGED
@@ -1221,13 +1221,12 @@ def run_deepseek_v41_generate(
1221
  dev = torch.device("cuda:0" if (device in ("auto", "cuda") and torch.cuda.is_available()) else "cpu")
1222
 
1223
  if use_chat_template and getattr(tok, "chat_template", None):
1224
- ids = tok.apply_chat_template(
1225
  [{"role": "user", "content": prompt}],
1226
  add_generation_prompt=True,
1227
- tokenize=True,
1228
  )
1229
- if isinstance(ids, dict):
1230
- ids = ids["input_ids"]
1231
  else:
1232
  ids = tok.encode(prompt, add_special_tokens=False)
1233
  if not ids:
 
1221
  dev = torch.device("cuda:0" if (device in ("auto", "cuda") and torch.cuda.is_available()) else "cpu")
1222
 
1223
  if use_chat_template and getattr(tok, "chat_template", None):
1224
+ rendered = tok.apply_chat_template(
1225
  [{"role": "user", "content": prompt}],
1226
  add_generation_prompt=True,
1227
+ tokenize=False,
1228
  )
1229
+ ids = tok.encode(rendered, add_special_tokens=False)
 
1230
  else:
1231
  ids = tok.encode(prompt, add_special_tokens=False)
1232
  if not ids: