AlexWortega commited on
Commit
2ffa91d
·
verified ·
1 Parent(s): 5dbd59b

Hermes SIQ-1-35B on ZeroGPU (llama-cpp-python recipe)

Browse files
Files changed (1) hide show
  1. app.py +16 -9
app.py CHANGED
@@ -56,7 +56,7 @@ GGUF_REPO = os.environ.get("GGUF_REPO", "AlexWortega/SIQ-1-35B")
56
  GGUF_FILE = os.environ.get("GGUF_FILE", "gguf/SIQ-1-35B.Q4_K_M.gguf")
57
  N_CTX = int(os.environ.get("N_CTX", "16384")) # keep cold-start init light
58
 
59
- print("=== APP BUILD MARKER: chunkfix-v3 ===", flush=True)
60
  print("Downloading GGUF from the Hub ...", flush=True)
61
  MODEL_PATH = hf_hub_download(GGUF_REPO, GGUF_FILE)
62
  print("GGUF ready at", MODEL_PATH, flush=True)
@@ -796,14 +796,21 @@ def respond(message, history, base_sys, skills, custom_skills, use_tools,
796
  answer = raw = thinking = tools = doc = ""
797
  doc_name = "artifact.html"
798
  in_tok = out_tok = 0
799
- for answer, raw, thinking, tools, doc, doc_name, in_tok, out_tok in _agent_stream(
800
- message, prior, system_prompt, temperature, max_tokens, use_tools
801
- ):
802
- history[-1]["content"] = _chat_message(
803
- answer, thinking, tools, streaming=True, in_tok=in_tok, out_tok=out_tok
804
- )
805
- prev = _BUILDING_PREVIEW if doc else _EMPTY_PREVIEW
806
- yield history, "", raw, (thinking or _NO_REASONING), doc, prev, (tools or _NO_TOOLS), meta
 
 
 
 
 
 
 
807
  history[-1]["content"] = _chat_message(answer, thinking, tools, streaming=False)
808
  meta = meta + [{
809
  "turn_id": uuid.uuid4().hex, "user": message, "answer": answer,
 
56
  GGUF_FILE = os.environ.get("GGUF_FILE", "gguf/SIQ-1-35B.Q4_K_M.gguf")
57
  N_CTX = int(os.environ.get("N_CTX", "16384")) # keep cold-start init light
58
 
59
+ print("=== APP BUILD MARKER: chunkfix-v4 ===", flush=True)
60
  print("Downloading GGUF from the Hub ...", flush=True)
61
  MODEL_PATH = hf_hub_download(GGUF_REPO, GGUF_FILE)
62
  print("GGUF ready at", MODEL_PATH, flush=True)
 
796
  answer = raw = thinking = tools = doc = ""
797
  doc_name = "artifact.html"
798
  in_tok = out_tok = 0
799
+ try:
800
+ for answer, raw, thinking, tools, doc, doc_name, in_tok, out_tok in _agent_stream(
801
+ message, prior, system_prompt, temperature, max_tokens, use_tools
802
+ ):
803
+ history[-1]["content"] = _chat_message(
804
+ answer, thinking, tools, streaming=True, in_tok=in_tok, out_tok=out_tok
805
+ )
806
+ prev = _BUILDING_PREVIEW if doc else _EMPTY_PREVIEW
807
+ yield history, "", raw, (thinking or _NO_REASONING), doc, prev, (tools or _NO_TOOLS), meta
808
+ except Exception:
809
+ import traceback
810
+ tb = traceback.format_exc()
811
+ history[-1]["content"] = f"⚠️ **generation crashed**\n\n```\n{tb[-1800:]}\n```"
812
+ yield history, "", tb, (thinking or _NO_REASONING), doc, _EMPTY_PREVIEW, (tools or _NO_TOOLS), meta
813
+ return
814
  history[-1]["content"] = _chat_message(answer, thinking, tools, streaming=False)
815
  meta = meta + [{
816
  "turn_id": uuid.uuid4().hex, "user": message, "answer": answer,