victor HF Staff commited on
Commit
c98ed72
·
1 Parent(s): 517b1b3

Install pre-built causal-conv1d wheel at startup for fast inference path

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -1,4 +1,17 @@
1
  import os
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  import spaces
3
  import gradio as gr
4
  import torch
 
1
  import os
2
+ import subprocess
3
+ import sys
4
+
5
+ # Install pre-built causal-conv1d wheel (compiled on L4 GPU, can't compile in Space build)
6
+ try:
7
+ import causal_conv1d
8
+ except ImportError:
9
+ subprocess.run([
10
+ sys.executable, "-m", "pip", "install",
11
+ "https://huggingface.co/datasets/victor/misc/resolve/main/wheels/causal_conv1d-1.6.1-cp310-cp310-linux_x86_64.whl",
12
+ "--no-deps", "-q",
13
+ ], check=True)
14
+
15
  import spaces
16
  import gradio as gr
17
  import torch