[Admin maintenance] Support new ZeroGPU hardware

#4
by multimodalart HF Staff - opened
Files changed (2) hide show
  1. app.py +32 -4
  2. requirements.txt +4 -3
app.py CHANGED
@@ -6,14 +6,42 @@
6
  # distribution of this software and related documentation without an express
7
  # license agreement from NVIDIA CORPORATION is strictly prohibited.
8
 
9
- import shlex
 
10
  import subprocess
 
11
  import spaces
12
  import gradio as gr
13
 
14
- def install_mamba():
15
- subprocess.run(shlex.split("pip install https://github.com/state-spaces/mamba/releases/download/v2.2.2/mamba_ssm-2.2.2+cu122torch2.3cxx11abiFALSE-cp310-cp310-linux_x86_64.whl"))
16
- install_mamba()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  ABOUT = """
19
  # RE-USE: A universal speech enhancement model for diverse degradations, sampling rates, and languages.
 
6
  # distribution of this software and related documentation without an express
7
  # license agreement from NVIDIA CORPORATION is strictly prohibited.
8
 
9
+ import os
10
+ import sys
11
  import subprocess
12
+ import tempfile
13
  import spaces
14
  import gradio as gr
15
 
16
+ CUDA_HOME = "/cuda-image/usr/local/cuda-13.0"
17
+
18
+
19
+ def _install_mamba_pure_python():
20
+ """Install mamba-ssm + causal-conv1d without the CUDA-kernel build.
21
+ Building from source against torch 2.10 takes >1500s (the ZeroGPU per-call
22
+ cap), so we skip the CUDA kernels and rely on mamba_ssm's pure-Python
23
+ selective_scan_ref fallback. Slower at inference but installs in seconds."""
24
+ try:
25
+ import mamba_ssm # noqa: F401
26
+ import causal_conv1d # noqa: F401
27
+ return
28
+ except ImportError:
29
+ pass
30
+ env = os.environ.copy()
31
+ env["MAMBA_SKIP_CUDA_BUILD"] = "TRUE"
32
+ env["CAUSAL_CONV1D_SKIP_CUDA_BUILD"] = "TRUE"
33
+ env["MAMBA_FORCE_BUILD"] = "FALSE"
34
+ env["CAUSAL_CONV1D_FORCE_BUILD"] = "FALSE"
35
+ subprocess.check_call(
36
+ [sys.executable, "-m", "pip", "install", "--no-deps", "setuptools", "wheel", "ninja", "packaging"],
37
+ )
38
+ subprocess.check_call(
39
+ [sys.executable, "-m", "pip", "install", "--no-build-isolation", "--no-deps", "causal-conv1d", "mamba-ssm"],
40
+ env=env,
41
+ )
42
+
43
+
44
+ _install_mamba_pure_python()
45
 
46
  ABOUT = """
47
  # RE-USE: A universal speech enhancement model for diverse degradations, sampling rates, and languages.
requirements.txt CHANGED
@@ -7,8 +7,9 @@ tensorboard
7
  pesq
8
  einops
9
  matplotlib
10
- torch==2.6.0
11
- torchaudio==2.6.0
 
12
  numpy==1.26.4
13
  resampy
14
- transformers==4.33.3
 
7
  pesq
8
  einops
9
  matplotlib
10
+ torch==2.10.0
11
+ torchaudio==2.10.0
12
+ torchcodec==0.10
13
  numpy==1.26.4
14
  resampy
15
+ transformers