Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,14 @@
|
|
1 |
import subprocess
|
2 |
import sys
|
|
|
3 |
import spaces
|
4 |
|
5 |
# install packages for mamba
|
6 |
-
|
7 |
-
subprocess.run("pip install https://github.com/
|
|
|
|
|
|
|
8 |
|
9 |
import torch
|
10 |
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
|
@@ -44,7 +48,7 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
44 |
if device == "cuda":
|
45 |
model = torch.compile(model)
|
46 |
|
47 |
-
|
48 |
|
49 |
@spaces.GPU
|
50 |
def stream_chat(
|
|
|
1 |
import subprocess
|
2 |
import sys
|
3 |
+
import shlex
|
4 |
import spaces
|
5 |
|
6 |
# install packages for mamba
|
7 |
+
def install():
|
8 |
+
subprocess.run(shlex.split("pip install https://github.com/Dao-AILab/causal-conv1d/releases/download/v1.0.0/causal_conv1d-1.0.0+cu122torch2.2cxx11abiTRUE-cp310-cp310-linux_x86_64.whl"))
|
9 |
+
subprocess.run(shlex.split("pip install https://github.com/state-spaces/mamba/releases/download/v1.0.1/mamba_ssm-1.0.1+cu122torch2.2cxx11abiTRUE-cp310-cp310-linux_x86_64.whl"))
|
10 |
+
|
11 |
+
install()
|
12 |
|
13 |
import torch
|
14 |
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
|
|
|
48 |
if device == "cuda":
|
49 |
model = torch.compile(model)
|
50 |
|
51 |
+
|
52 |
|
53 |
@spaces.GPU
|
54 |
def stream_chat(
|