-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
当你要在本地机器或训练机器上准备 DomainPostTrain 环境时,使用本页。
requirements.txt 默认面向 CUDA 12.6 GPU 训练,并包含 PyTorch CUDA wheel index:
--extra-index-url https://download.pytorch.org/whl/cu126
如果你的 CUDA runtime、Python ABI、驱动栈或操作系统不同,请先安装匹配的 PyTorch,再安装其余非 torch 依赖。
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt验证:
python -m compileall pipeline scripts serve_inference.pypy -3.10 -m venv .venv
& .\.venv\Scripts\python.exe -m pip install --upgrade pip
& .\.venv\Scripts\python.exe -m pip install -r requirements.txt验证:
& .\.venv\Scripts\python.exe -m compileall pipeline scripts serve_inference.pyONNX 导出不属于默认训练路径。只有运行 scripts/model_artifacts/export_onnx.py 时才需要安装:
python -m pip install -r requirements-onnx.txtONNX GPU 导出可能需要与目标机器匹配的 ONNX Runtime CUDA wheel。
推荐顺序:
- 先安装与机器匹配的
torch、torchvision、torchaudiowheels。 - 再从
requirements.txt安装其余包,必要时排除 torch 包。 - 运行
python -m compileall pipeline scripts serve_inference.py。 - 确认 ML 依赖可用后再运行 smoke test。
python -c "import torch; print(torch.__version__)"
python -c "import transformers, datasets, peft, trl; print('training deps ok')"
python -c "import flask; print('service deps ok')"如果任一 import 失败,请在当前激活环境中安装缺失包。常见问题见 故障排查。
如需检查 GPU、CUDA 和训练依赖状态,运行 python scripts/diagnostics/check_training_environment.py,并参考 操作手册。
Use this page when setting up a local or training-machine environment for DomainPostTrain.
requirements.txt targets CUDA 12.6 GPU training and includes a PyTorch CUDA wheel index:
--extra-index-url https://download.pytorch.org/whl/cu126
If your CUDA runtime, Python ABI, driver stack, or operating system differs, install a matching PyTorch build first, then install the remaining non-torch dependencies.
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txtVerify:
python -m compileall pipeline scripts serve_inference.pypy -3.10 -m venv .venv
& .\.venv\Scripts\python.exe -m pip install --upgrade pip
& .\.venv\Scripts\python.exe -m pip install -r requirements.txtVerify:
& .\.venv\Scripts\python.exe -m compileall pipeline scripts serve_inference.pyONNX export is not part of the default path. Install it only when running scripts/model_artifacts/export_onnx.py:
python -m pip install -r requirements-onnx.txtONNX GPU export can require ONNX Runtime CUDA runtime wheels that match the target machine.
Recommended order:
- Install the matching
torch,torchvision, andtorchaudiowheels for the machine. - Install the remaining packages from
requirements.txt, excluding torch packages if necessary. - Run
python -m compileall pipeline scripts serve_inference.py. - Run the smoke test only after the ML dependencies are available.
python -c "import torch; print(torch.__version__)"
python -c "import transformers, datasets, peft, trl; print('training deps ok')"
python -c "import flask; print('service deps ok')"If any import fails, install the missing package in the active environment. See Troubleshooting for common dependency failures.
For GPU and package diagnostics, run python scripts/diagnostics/check_training_environment.py and use Operations Runbook.