feat: 添加 Windows 兼容性支持,优化设备选择逻辑
- start_system.py: 跨平台进程管理 - Windows 使用 CREATE_NEW_PROCESS_GROUP 和 terminate() - Unix 使用 setsid 和 killpg - 自动检测并启用 Windows ANSI 颜色支持 - 设备选择逻辑优化: - macOS: 优先使用 MPS,回退到 CPU - Windows/Linux: 强制使用 CPU(无 CUDA 依赖) - 影响文件: - api/prediction_service.py - auto_trade_polymarket.py - training/config.py
This commit is contained in:
1 parent
8cdfb2a8e2
commit
233f0c5d10
4 files changed
+95
-30
No files matched your search
@@ -175,9 +175,13 @@ class PolymarketBTCTrader:
|
||||
headers={'Accept-Encoding': 'identity'}
|
||||
)
|
||||
|
||||
# 设备
|
||||
self.device = torch.device('mps' if torch.backends.mps.is_available() else
|
||||
'cuda' if torch.cuda.is_available() else 'cpu')
|
||||
# 设备选择:macOS 用 MPS,Windows/Linux 用 CPU
|
||||
import platform
|
||||
if platform.system() == 'Darwin': # macOS
|
||||
self.device = torch.device('mps' if torch.backends.mps.is_available() else 'cpu')
|
||||
else: # Windows / Linux
|
||||
self.device = torch.device('cpu')
|
||||
print(f"使用设备: {self.device}")
|
||||
|
||||
# 加载模型
|
||||
self.model = None
|
||||
|
||||
Reference in new issue
Block a user