cn0303 commited on
Commit
baeaf14
·
verified ·
1 Parent(s): 869c297

Speed up explainer: prebuilt Mamba kernels (transformers 5.8 + kernels hub), tighter answer budget

Browse files
Files changed (2) hide show
  1. model_brick.py +1 -1
  2. requirements.txt +6 -8
model_brick.py CHANGED
@@ -248,7 +248,7 @@ if _should_load():
248
  prompt_len = inputs["input_ids"].shape[1]
249
  with torch.no_grad():
250
  out = model.generate(
251
- **inputs, max_new_tokens=320, do_sample=False,
252
  pad_token_id=tok.eos_token_id,
253
  )
254
  return tok.decode(out[0][prompt_len:], skip_special_tokens=True).strip()
 
248
  prompt_len = inputs["input_ids"].shape[1]
249
  with torch.no_grad():
250
  out = model.generate(
251
+ **inputs, max_new_tokens=192, do_sample=False,
252
  pad_token_id=tok.eos_token_id,
253
  )
254
  return tok.decode(out[0][prompt_len:], skip_special_tokens=True).strip()
requirements.txt CHANGED
@@ -2,12 +2,10 @@
2
  gradio==6.16.0 # gr.Server (FastAPI) + @app.api queue + ZeroGPU glue
3
  spaces # @spaces.GPU — ZeroGPU allocation on Hugging Face
4
  torch>=2.8.0 # ZeroGPU requirement (>=2.8)
5
- transformers>=4.51.0 # >=4.51 for Qwen3; also runs Nemotron (trust_remote_code)
 
 
 
 
 
6
  accelerate # device placement / efficient loading
7
-
8
- # Optional speed-up for the Nemotron Mamba-2 kernels. Left unpinned because
9
- # they compile against CUDA at build time and can fail; transformers falls back
10
- # to a pure-PyTorch path without them. If the model fails to boot, the clean
11
- # escape hatch is the env var: FITCHECK_MODEL=Qwen/Qwen3-4B-Instruct-2507
12
- # mamba-ssm
13
- # causal-conv1d
 
2
  gradio==6.16.0 # gr.Server (FastAPI) + @app.api queue + ZeroGPU glue
3
  spaces # @spaces.GPU — ZeroGPU allocation on Hugging Face
4
  torch>=2.8.0 # ZeroGPU requirement (>=2.8)
5
+ transformers>=5.8.0 # native NemotronH wired to hub kernels (>=5.8)
6
+ kernels>=0.10.2 # pulls kernels-community/mamba-ssm + causal-conv1d
7
+ # prebuilt for torch>=2.8 — replaces the naive Mamba
8
+ # path (pip mamba-ssm wheels stop at torch 2.7 and
9
+ # ZeroGPU build containers have no nvcc; never add
10
+ # mamba-ssm/causal-conv1d here, the build will fail)
11
  accelerate # device placement / efficient loading