NemoVonNirgend commited on
Commit
ead8f66
·
verified ·
1 Parent(s): 72a9c77

Upload serve_ministral.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. serve_ministral.py +7 -7
serve_ministral.py CHANGED
@@ -88,15 +88,15 @@ async def chat_completions(request: ChatRequest):
88
  )
89
  except Exception as e:
90
  print(f"Chat template error: {e}")
91
- # Fallback: manual formatting
92
- chat_text = ""
93
  for m in messages:
94
- if m["role"] == "user":
95
- chat_text += f"[INST] {m['content']} [/INST]"
 
 
96
  elif m["role"] == "assistant":
97
- chat_text += f" {m['content']}</s>"
98
- elif m["role"] == "system":
99
- chat_text = f"<<SYS>>\n{m['content']}\n<</SYS>>\n\n" + chat_text
100
 
101
  print(f"Input length: {len(chat_text)} chars")
102
 
 
88
  )
89
  except Exception as e:
90
  print(f"Chat template error: {e}")
91
+ # Fallback: ShareGPT format with [INST] tags
92
+ chat_text = "<s>"
93
  for m in messages:
94
+ if m["role"] == "system":
95
+ chat_text += f"[SYSTEM_PROMPT]{m['content']}[/SYSTEM_PROMPT]"
96
+ elif m["role"] == "user":
97
+ chat_text += f"[INST]{m['content']}[/INST]"
98
  elif m["role"] == "assistant":
99
+ chat_text += f"{m['content']}</s>"
 
 
100
 
101
  print(f"Input length: {len(chat_text)} chars")
102