Spaces:
Running
on
Zero
Running
on
Zero
macadeliccc
commited on
Commit
·
5956319
1
Parent(s):
d4ab49e
test
Browse files- app.py +28 -0
- requirements.txt +7 -0
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import spaces
|
3 |
+
import torch
|
4 |
+
import subprocess
|
5 |
+
|
6 |
+
zero = torch.Tensor([0]).cuda()
|
7 |
+
print(zero.device) # <-- 'cpu' 🤔
|
8 |
+
|
9 |
+
@spaces.GPU
|
10 |
+
def start_ochat_server():
|
11 |
+
print(zero.device) # <-- 'cuda:0' 🤗
|
12 |
+
|
13 |
+
# Command to start the ochat inference server
|
14 |
+
command = [
|
15 |
+
"python", "-m", "ochat.serving.openai_api_server",
|
16 |
+
"--model", "openchat/openchat_3.5"
|
17 |
+
]
|
18 |
+
|
19 |
+
# Start the server
|
20 |
+
try:
|
21 |
+
# Use subprocess to run the command
|
22 |
+
subprocess.Popen(command)
|
23 |
+
return "ochat server started successfully"
|
24 |
+
except Exception as e:
|
25 |
+
return f"Failed to start ochat server: {e}"
|
26 |
+
|
27 |
+
|
28 |
+
gr.Interface(fn=start_ochat_server, inputs=gr.Number(), outputs=gr.Text()).launch()
|
requirements.txt
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
git+https://github.com/huggingface/transformers.git
|
2 |
+
git+https://github.com/vllm-project/vllm.git
|
3 |
+
--extra-index-url https://download.pytorch.org/whl/cu113
|
4 |
+
torch
|
5 |
+
datasets
|
6 |
+
accelerate
|
7 |
+
ochat
|