@echo off rem 训练控制台一键启动(Windows):双击本文件 → 自动打开 http://localhost:8100 ,在网页上点「开始训练」。 rem 需要:带 torch 的 Python(与训练同一个环境)和 Git for Windows(提供 Git Bash)。 rem Python 选择顺序:环境变量 PYTHON → 当前 PATH 里的 python。判据是能 import torch(不是 where python: rem WindowsApps 里的假 python 也能被 where 找到,旧写法会"看起来正常、到训练那步才炸",审查 N-10)。 rem 关闭本窗口只关控制台;已开始的训练继续跑,重新双击即可接着看、可停止。 chcp 65001 >nul cd /d "%~dp0\.." if "%PYTHON%"=="" set "PYTHON=python" rem 2026-10-18 第六轮:Python 按 UTF-8 读写文件(Windows 默认 GBK 读中文 json 会报错) set "PYTHONUTF8=1" "%PYTHON%" -c "import torch" >nul 2>nul if errorlevel 1 ( echo 当前 Python(%PYTHON%)不能 import torch。 echo 请先在 Anaconda Prompt / 终端里激活训练环境后运行 ml\console.bat,或设置环境变量 PYTHON 为训练环境的 python.exe 完整路径。 pause & exit /b 1 ) "%PYTHON%" -m ml.monitor --open %* pause