Hermes SIQ-1-35B on ZeroGPU (llama-cpp-python recipe)
Browse files140 unmodified lines141142143144145146147148149150151152153154155156828 unmodified lines985986987988989990991992993994995996997140 unmodified linesdef _split(text):"""Return (clean_answer, thinking). Handles an unterminated <think>."""think_parts = _THINK.findall(text)answer = _THINK.sub("", text)if "<think>" in text and "</think>" not in text:i = text.index("<think>")think_parts.append(text[i + len("<think>"):])answer = text[:i]thinking = "\n\n".join(p.strip() for p in think_parts).strip()# hide a trailing tool call from the visible answeranswer = _TOOL_BLOCK.sub("", answer)return answer.strip(), thinking828 unmodified lines"Explain a black hole like we are old friends.",]with gr.Blocks(title="Hermes · SIQ-1-35B", fill_height=True) as demo:gr.HTML(HERO)meta_state = gr.State([])with gr.Row(equal_height=False):with gr.Column(scale=5):chatbot = gr.Chatbot(height=460, show_label=False,placeholder="Ask Hermes to build something or look something up.",)msg = gr.Textbox(140 unmodified lines141142143144145146147148149150151152153154155156157158159160161162163164828 unmodified lines993994995996997998999100010011002100310041005140 unmodified linesdef _split(text):"""Return (clean_answer, thinking). Robust to the common Qwen-thinking casewhere the chat template injects the opening <think> so the model only emitsthe CLOSING </think> (no opening tag in the stream)."""text = text or ""if "</think>" in text:# everything up to the first </think> is reasoning, even with no <think>i = text.index("</think>")thinking = text[:i].replace("<think>", "").strip()answer = text[i + len("</think>"):]elif "<think>" in text:# opening tag present but not yet closed -> still thinking, no answeri = text.index("<think>")answer = text[:i]thinking = text[i + len("<think>"):].strip()else:answer, thinking = text, ""answer = _TOOL_BLOCK.sub("", answer) # hide tool-call JSONanswer = answer.replace("<think>", "").replace("</think>", "") # stray tagsreturn answer.strip(), thinking828 unmodified lines"Explain a black hole like we are old friends.",]with gr.Blocks(title="Hermes · SIQ-1-35B", fill_height=True, fill_width=True) as demo:gr.HTML(HERO)meta_state = gr.State([])with gr.Row(equal_height=False):with gr.Column(scale=5):chatbot = gr.Chatbot(height=460, show_label=False, sanitize_html=False,placeholder="Ask Hermes to build something or look something up.",)msg = gr.Textbox(
app.py+18-10