处理PyTorch依赖问题的系统化方案:
诊断阶段:
- (of a computer) run
python -c "import torch; print(torch.__version__)"
确认当前版本 - probe
requirements.txt
中指定的版本范围
Solution:
- 新建隔离环境:
conda create -n uno_clean python=3.10
- GPU相关安装:
NVIDIA用户:pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu118
AMD用户:需从ROCm仓库安装对应版本 - Verify the installation:
python -c "import torch; print(torch.cuda.is_available())"
应返回True
Emergency Response Program:若仍失败,可尝试通过Docker使用官方预配置环境:docker pull xlabsresearch/uno:latest
This answer comes from the articleUNO: Support for single-subject and multi-subject customized image generation tools (suitable for e-commerce graphics)The