Spaces:
Running
on
Zero
Running
on
Zero
nihuajian
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -21,14 +21,14 @@ def load_model():
|
|
21 |
'openbmb/MiniCPM-o-2_6',
|
22 |
trust_remote_code=True,
|
23 |
attn_implementation='sdpa',
|
24 |
-
torch_dtype=torch.
|
25 |
init_vision=True,
|
26 |
init_audio=False,
|
27 |
init_tts=False
|
28 |
)
|
29 |
-
model = model.eval()
|
30 |
tokenizer = AutoTokenizer.from_pretrained('openbmb/MiniCPM-o-2_6', trust_remote_code=True)
|
31 |
-
print("模型加载完成")
|
32 |
return model, tokenizer
|
33 |
|
34 |
def clean_markdown_output(text):
|
@@ -292,7 +292,7 @@ def create_interface():
|
|
292 |
### 🔧 技术支持
|
293 |
- 模型: MiniCPM-o-2.6
|
294 |
- 框架: Gradio + Transformers
|
295 |
-
-
|
296 |
""")
|
297 |
|
298 |
return interface
|
@@ -314,4 +314,4 @@ if __name__ == "__main__":
|
|
314 |
share=False, # 在Hugging Face上部署时设为False
|
315 |
show_error=True, # 显示详细错误信息
|
316 |
quiet=False # 显示启动信息
|
317 |
-
)
|
|
|
21 |
'openbmb/MiniCPM-o-2_6',
|
22 |
trust_remote_code=True,
|
23 |
attn_implementation='sdpa',
|
24 |
+
torch_dtype=torch.float32, # CPU推理使用float32
|
25 |
init_vision=True,
|
26 |
init_audio=False,
|
27 |
init_tts=False
|
28 |
)
|
29 |
+
model = model.eval() # 移除.cuda(),使用CPU
|
30 |
tokenizer = AutoTokenizer.from_pretrained('openbmb/MiniCPM-o-2_6', trust_remote_code=True)
|
31 |
+
print("模型加载完成 (CPU模式)")
|
32 |
return model, tokenizer
|
33 |
|
34 |
def clean_markdown_output(text):
|
|
|
292 |
### 🔧 技术支持
|
293 |
- 模型: MiniCPM-o-2.6
|
294 |
- 框架: Gradio + Transformers
|
295 |
+
- 推理: CPU模式
|
296 |
""")
|
297 |
|
298 |
return interface
|
|
|
314 |
share=False, # 在Hugging Face上部署时设为False
|
315 |
show_error=True, # 显示详细错误信息
|
316 |
quiet=False # 显示启动信息
|
317 |
+
)
|