Spaces:
Sleeping
Sleeping
雷娃
commited on
Commit
·
0c9602f
1
Parent(s):
217b6e3
add install.sh
Browse files
app.py
CHANGED
|
@@ -2,6 +2,34 @@ from transformers import AutoTokenizer, AutoModelForCausalLM, TextIteratorStream
|
|
| 2 |
from threading import Thread
|
| 3 |
import gradio as gr
|
| 4 |
import json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
# load model and tokenizer
|
| 7 |
model_name = "inclusionAI/Ling-mini-2.0"
|
|
|
|
| 2 |
from threading import Thread
|
| 3 |
import gradio as gr
|
| 4 |
import json
|
| 5 |
+
import subprocess
|
| 6 |
+
import os
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def install_vllm_from_patch():
|
| 10 |
+
script_path = "./install.sh"
|
| 11 |
+
if not os.path.exists(script_path):
|
| 12 |
+
print(f"Error: install.sh is not exist!")
|
| 13 |
+
return False
|
| 14 |
+
|
| 15 |
+
try:
|
| 16 |
+
result = subprocess.run(
|
| 17 |
+
["bash", script_path],
|
| 18 |
+
check=True,
|
| 19 |
+
stdout=subprocess.PIPE,
|
| 20 |
+
stderr=subprocess.PIPE,
|
| 21 |
+
text = True,
|
| 22 |
+
timeout = 500
|
| 23 |
+
)
|
| 24 |
+
print(f"result: {result}")
|
| 25 |
+
return True
|
| 26 |
+
except Exception as e:
|
| 27 |
+
print(f"Error: {str(e)}")
|
| 28 |
+
return False
|
| 29 |
+
|
| 30 |
+
#install vllm from patch file
|
| 31 |
+
install_vllm_from_patch()
|
| 32 |
+
|
| 33 |
|
| 34 |
# load model and tokenizer
|
| 35 |
model_name = "inclusionAI/Ling-mini-2.0"
|