Spaces:
Running on Zero
Running on Zero
space: load Nemotron the normal way — transformers-native (no trust_remote_code), NO mamba_ssm/causal_conv1d. Those custom Triton CUDA kernels were the segfault (THCPModule_initExtension); native falls back to pure-torch Mamba on ZeroGPU.
Browse files- requirements.txt +7 -9
- space/app.py +6 -3
requirements.txt
CHANGED
|
@@ -1,18 +1,16 @@
|
|
| 1 |
-
# HF Space (Gradio SDK + ZeroGPU)
|
| 2 |
-
#
|
| 3 |
-
#
|
| 4 |
-
#
|
| 5 |
-
#
|
| 6 |
-
#
|
| 7 |
spaces
|
| 8 |
torch==2.10.0
|
| 9 |
transformers>=5
|
| 10 |
accelerate
|
| 11 |
huggingface_hub>=1.2
|
|
|
|
| 12 |
textual>=1.0
|
| 13 |
rich>=13.0
|
| 14 |
pyyaml>=6.0
|
| 15 |
httpx>=0.27
|
| 16 |
-
# Nemotron-H hard-imports mamba_ssm's triton kernels (torch 2.10 / cu12 / cp312).
|
| 17 |
-
https://github.com/state-spaces/mamba/releases/download/v2.3.2.post1/mamba_ssm-2.3.2.post1+cu12torch2.10cxx11abiTRUE-cp312-cp312-linux_x86_64.whl
|
| 18 |
-
https://github.com/Dao-AILab/causal-conv1d/releases/download/v1.6.2.post1/causal_conv1d-1.6.2.post1+cu12torch2.10cxx11abiTRUE-cp312-cp312-linux_x86_64.whl
|
|
|
|
| 1 |
+
# HF Space (Gradio SDK + ZeroGPU), structured like the org's working spaces:
|
| 2 |
+
# gradio.Server + @app.api + app.launch(). Load the model the NORMAL way —
|
| 3 |
+
# transformers-native NemotronH, NO mamba_ssm / causal_conv1d. Those custom
|
| 4 |
+
# Triton CUDA kernels are what segfaulted on ZeroGPU (THCPModule_initExtension);
|
| 5 |
+
# working Nemotron ZeroGPU spaces never install them and let transformers fall
|
| 6 |
+
# back to pure PyTorch for the Mamba ops. bf16, no bitsandbytes.
|
| 7 |
spaces
|
| 8 |
torch==2.10.0
|
| 9 |
transformers>=5
|
| 10 |
accelerate
|
| 11 |
huggingface_hub>=1.2
|
| 12 |
+
sentencepiece
|
| 13 |
textual>=1.0
|
| 14 |
rich>=13.0
|
| 15 |
pyyaml>=6.0
|
| 16 |
httpx>=0.27
|
|
|
|
|
|
|
|
|
space/app.py
CHANGED
|
@@ -57,15 +57,18 @@ WARDEN_ERR = "spaces package not present (not on a ZeroGPU Space)"
|
|
| 57 |
|
| 58 |
if spaces is not None:
|
| 59 |
try:
|
| 60 |
-
from mamba_ssm.ops.triton.layernorm_gated import rmsnorm_fn # noqa: F401
|
| 61 |
import torch
|
| 62 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 63 |
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
model = AutoModelForCausalLM.from_pretrained(
|
| 66 |
WARDEN_REPO,
|
| 67 |
torch_dtype=torch.bfloat16,
|
| 68 |
-
trust_remote_code=True,
|
| 69 |
low_cpu_mem_usage=True,
|
| 70 |
)
|
| 71 |
model.to("cuda") # intercepted by ZeroGPU emulation; migrated per call
|
|
|
|
| 57 |
|
| 58 |
if spaces is not None:
|
| 59 |
try:
|
|
|
|
| 60 |
import torch
|
| 61 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 62 |
|
| 63 |
+
# NO trust_remote_code: use transformers' NATIVE NemotronH, which falls
|
| 64 |
+
# back to pure-PyTorch Mamba ops when mamba_ssm isn't installed. The
|
| 65 |
+
# NVIDIA remote modeling code instead hard-requires mamba_ssm's Triton
|
| 66 |
+
# CUDA kernels, which segfault under ZeroGPU. This is how working
|
| 67 |
+
# Nemotron ZeroGPU spaces do it.
|
| 68 |
+
tok = AutoTokenizer.from_pretrained(WARDEN_REPO)
|
| 69 |
model = AutoModelForCausalLM.from_pretrained(
|
| 70 |
WARDEN_REPO,
|
| 71 |
torch_dtype=torch.bfloat16,
|
|
|
|
| 72 |
low_cpu_mem_usage=True,
|
| 73 |
)
|
| 74 |
model.to("cuda") # intercepted by ZeroGPU emulation; migrated per call
|