Github开源生信云平台 DEMO
Scikit-learnTensorflowPyTorchTheanoKeras
安装cudnn9-cuda-12
cudnn9-cuda-12
sudo apt-get -o Acquire::http::Proxy="http://10.110.1.11:7890" -o Acquire::https::Proxy="http://10.110.1.11:7890" install cudnn9-cuda-12
python - <<PY > from ultralytics import YOLO > > model = YOLO("models/best.pt") # COCO 预训练权重作为起点 > model.train( > data="out/datasets/TST2/data.yaml", > epochs=30, > imgsz=480, > batch=8, > device="gpu", > single_cls=True, > project="$PWD/runs", # ← 绝对路径,见上方说明 > name="tst", > exist_ok=True, > workers=0, > verbose=True, > ) > print("TRAIN_OK") > PY New https://pypi.org/project/ultralytics/8.4.191 available Update with 'pip install -U ultralytics' /ssd1/wy/conda/lib/python3.10/site-packages/torch/cuda/__init__.py:228: UserWarning: CUDA initialization: The NVIDIA driver on your system is too old (found version 12080). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver. (Triggered internally at /__w/pytorch/pytorch/c10/cuda/CUDAFunctions.cpp:119.) return torch._C._cuda_getDeviceCount() > 0 Ultralytics 8.4.190 Python-3.10.13 torch-2.14.1+cu130 Traceback (most recent call last): File "<stdin>", line 4, in <module> File "/ssd1/wy/conda/lib/python3.10/site-packages/ultralytics/engine/model.py", line 888, in train self.trainer = (trainer or self._smart_load("trainer"))(overrides=args, _callbacks=self.callbacks) File "/ssd1/wy/conda/lib/python3.10/site-packages/ultralytics/models/yolo/detect/train.py", line 62, in __init__ super().__init__(cfg, overrides, _callbacks) File "/ssd1/wy/conda/lib/python3.10/site-packages/ultralytics/engine/trainer.py", line 153, in __init__ self.device = select_device(self.args.device) File "/ssd1/wy/conda/lib/python3.10/site-packages/ultralytics/utils/torch_utils.py", line 337, in select_device raise ValueError( ValueError: Invalid CUDA 'device=gpu' requested. Use 'device=cpu' or pass valid CUDA device(s) if available, i.e. 'device=0' or 'device=0,1,2,3' for Multi-GPU. torch.cuda.is_available(): False torch.cuda.device_count(): 1 os.environ['CUDA_VISIBLE_DEVICES']: None
当前 PyTorch 使用 CUDA 13.0(torch-2.14.1+cu130),但系统的 NVIDIA 驱动版本过旧,无法满足当前 PyTorch 的 CUDA 运行要求,因此 Ultralytics 无法启用 GPU 训练
依次查看当前 Python 环境中 torch、torchvision、ultralytics 这三个包是否已安装,以及它们的详细信息
python -m pip show torch torchvision ultralytics
Name: torch Version: 2.14.1 Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration Home-page: Author: Author-email: PyTorch Team <packages@pytorch.org> License: Location: /ssd1/wy/conda/lib/python3.10/site-packages Requires: cuda-bindings, cuda-toolkit, filelock, fsspec, jinja2, networkx, nvidia-cudnn-cu13, nvidia-cusparselt-cu13, nvidia-nccl-cu13, nvidia-nvshmem-cu13, setuptools, sympy, triton, typing-extensions Required-by: torchvision, ultralytics, ultralytics-thop --- Name: torchvision Version: 0.29.1 Summary: image and video datasets and models for torch deep learning Home-page: https://github.com/pytorch/vision Author: PyTorch Core Team Author-email: soumith@pytorch.org License: BSD Location: /ssd1/wy/conda/lib/python3.10/site-packages Requires: numpy, pillow, torch Required-by: ultralytics --- Name: ultralytics Version: 8.4.190 Summary: Ultralytics YOLO for SOTA object detection, instance segmentation, semantic segmentation, depth estimation, classification, pose estimation, oriented object detection, and multi-object tracking. Home-page: Author: Author-email: Glenn Jocher <glenn.jocher@ultralytics.com>, Jing Qiu <jing.qiu@ultralytics.com> License: AGPL-3.0 Location: /ssd1/wy/conda/lib/python3.10/site-packages Requires: matplotlib, numpy, nvidia-ml-py, opencv-python, pillow, polars, psutil, pyyaml, requests, torch, torchvision, ultralytics-thop Required-by:
python -m pip install torch==2.9.1 torchvision==0.24.1 --index-url https://download.pytorch.org/whl/cu126
验证 GPU 是否可用
python - <<'PY' import torch print("PyTorch:", torch.__version__) print("PyTorch CUDA:", torch.version.cuda) print("CUDA available:", torch.cuda.is_available()) print("GPU count:", torch.cuda.device_count()) if torch.cuda.is_available(): print("GPU:", torch.cuda.get_device_name(0)) x = torch.randn(1024, 1024, device="cuda") print("GPU computation:", (x @ x).shape) PY
李宏毅《机器学习》-logistic regression