Spaces:
Runtime error
Runtime error
erwold
commited on
Commit
·
a899a5c
1
Parent(s):
5e2c351
Initial Commit
Browse files
app.py
CHANGED
@@ -11,14 +11,18 @@ import math
|
|
11 |
import logging
|
12 |
import sys
|
13 |
|
14 |
-
import
|
15 |
-
# 设置环境变量,强制禁用 accelerate 的显存管理
|
16 |
-
os.environ["ACCELERATE_USE_MEMORY_EFFICIENT_ATTENTION"] = "false"
|
17 |
-
os.environ["ACCELERATE_DISABLE_MEMORY_EFFICIENT_ATTENTION"] = "1"
|
18 |
-
os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "expandable_segments:True,garbage_collection_threshold:0.6,max_split_size_mb:512"
|
19 |
|
20 |
from qwen2_vl.modeling_qwen2_vl import Qwen2VLSimplifiedModel
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
# 设置日志
|
23 |
logging.basicConfig(
|
24 |
level=logging.INFO,
|
@@ -440,5 +444,6 @@ if __name__ == "__main__":
|
|
440 |
demo.launch(
|
441 |
server_name="0.0.0.0", # Listen on all network interfaces
|
442 |
server_port=7860, # Use a specific port
|
443 |
-
share=False # Disable public URL sharing
|
|
|
444 |
)
|
|
|
11 |
import logging
|
12 |
import sys
|
13 |
|
14 |
+
from huggingface_hub.utils import HfFolder # 添加这个导入
|
|
|
|
|
|
|
|
|
15 |
|
16 |
from qwen2_vl.modeling_qwen2_vl import Qwen2VLSimplifiedModel
|
17 |
|
18 |
+
# 在代码最开始添加 ZeroGPU 初始化
|
19 |
+
try:
|
20 |
+
from accelerate.utils import ZeroGPU
|
21 |
+
zerogpu = ZeroGPU()
|
22 |
+
zerogpu.init()
|
23 |
+
except ImportError:
|
24 |
+
print("Warning: ZeroGPU not available, falling back to CPU")
|
25 |
+
|
26 |
# 设置日志
|
27 |
logging.basicConfig(
|
28 |
level=logging.INFO,
|
|
|
444 |
demo.launch(
|
445 |
server_name="0.0.0.0", # Listen on all network interfaces
|
446 |
server_port=7860, # Use a specific port
|
447 |
+
share=False, # Disable public URL sharing
|
448 |
+
enable_queue=True # 添加队列支持
|
449 |
)
|