当前位置: 首页 > news >正文

RTX3070的yolo训练模型迁移到NVIDIA JETSON XAVIER NX 上的踩坑经验,时机部署避雷点

NVIDIA JETSON XAVIER NX 的yolo环境部署

首先为了保证yolo的权重模型pt文件可以顺利迁移过去,要保证torch和cuda的版本一致

如何在NX上安装torch?

1.用 jtop工具 实时查看和控制板子状态

安装:

sudo -H pip3 install jetson-stats

使用:

sudo jtop

在这里是为了确保了解自己的板子的cuda和cudnn是否已经装好了

2.安装pytorch

PyTorch for Jetson - Jetson & Embedded Systems / Announcements - NVIDIA Developer Forums

这里选择自己自己架构适合的pytorch版本号

红色部分为安装的步骤流程,蓝色部分为需要注意更改的版本号

以及得注意pytorch和torchvision版本得对齐

验证部分也可以遵循下方的Verification

如何在RTX3070上安装对应的torch版本?

我安装了

# CUDA 10.2
pip install torch==1.12.0+cu102 torchvision==0.13.0+cu102 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu102

问题:一直报错,显示的是cuda和pytorch不兼容,因为我主机系统是cuda12.0,按道理是可以兼容10.02的,

(VBee) iusl@iusl-MS-7D04:~/ultralytics-20240713/ultralytics-main$ python
Python 3.8.20 (default, Oct  3 2024, 15:24:27) 
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> import torchvision
>>> print(torch.cuda.is_available())
True
>>> a = torch.Tensor(5,3)
>>> a=a.cuda()
/home/iusl/anaconda3/envs/VBee/lib/python3.8/site-packages/torch/cuda/__init__.py:146: UserWarning: 
NVIDIA GeForce RTX 3070 with CUDA capability sm_86 is not compatible with the current PyTorch installation.
The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_70.
If you want to use the NVIDIA GeForce RTX 3070 GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/warnings.warn(incompatible_device_warn.format(device_name, capability, " ".join(arch_list), device_name))
>>> print(a)
Traceback (most recent call last):File "<stdin>", line 1, in <module>File "/home/iusl/anaconda3/envs/VBee/lib/python3.8/site-packages/torch/_tensor.py", line 338, in __repr__return torch._tensor_str._str(self, tensor_contents=tensor_contents)File "/home/iusl/anaconda3/envs/VBee/lib/python3.8/site-packages/torch/_tensor_str.py", line 481, in _strreturn _str_intern(self, tensor_contents=tensor_contents)File "/home/iusl/anaconda3/envs/VBee/lib/python3.8/site-packages/torch/_tensor_str.py", line 447, in _str_interntensor_str = _tensor_str(self, indent)File "/home/iusl/anaconda3/envs/VBee/lib/python3.8/site-packages/torch/_tensor_str.py", line 270, in _tensor_strformatter = _Formatter(get_summarized_data(self) if summarize else self)File "/home/iusl/anaconda3/envs/VBee/lib/python3.8/site-packages/torch/_tensor_str.py", line 103, in __init__nonzero_finite_vals = torch.masked_select(tensor_view, torch.isfinite(tensor_view) & tensor_view.ne(0))
RuntimeError: CUDA error: no kernel image is available for execution on the device
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

问题分析:

PyTorch提示当前安装的版本仅支持CUDA架构sm_37、sm_50、sm_60和sm_70,而你的显卡RTX 3070的CUDA架构是sm_86,不在支持列表中。因此,尽管可以检测到显卡,但无法正确使用其计算能力。

NVIDIA CUDA架构sm_86是为RTX 30系列(如RTX 3070、3080等)显卡设计的。因此,要支持sm_86架构,你需要使用与CUDA 11.x或更高版本兼容的PyTorch。

总结:

因为我的torch安装的是

torch==1.12.0+cu102

也就是低于cuda11.x,这里的坑点在于,之前我的印象都是cuda都向下兼容,但是sm_86不支持cuda11以下的pytorch

所以更改为安装这个版本的pytorch

pip install torch==1.12.0+cu113 torchvision==0.13.0+cu113 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu113

http://www.lryc.cn/news/462326.html

相关文章:

  • 带你学习如何编写一篇API详设文档以及给新人提点建议
  • 【Python爬虫实战】正则:多字符匹配、开头与结尾定位、分组技术详解
  • DOIP协议介绍-1
  • 探索Python中的多线程与多进程
  • paypal php 实现详细攻略
  • 深入理解Dubbo原理鱼实现,提升职场竞争力
  • 自动化测试与敏捷开发的重要性
  • 气膜:冰雪产业的创新解决方案—轻空间
  • 期货配资网/分仓多元化/配资系统服务商
  • 「漏洞复现」百易云资产管理运营系统 ufile.api.php SQL注入漏洞
  • Vue 3 和 Vue Router 使用 createWebHistory 配置
  • Nginx:rewrite指令之flag标志
  • C#从零开始学习(如何构建应用)
  • FCoE简介
  • 论文笔记:Template-Based Named Entity Recognition Using BART
  • 【Nestjs】从入门到精通(依赖注入)
  • C语言函数
  • FLINK SQLTable API 的基本概念及常用API
  • Docker daemon.json配置参数及格式帮助信息
  • 十月编程语言排行榜~
  • 十三、行为型(策略模式)
  • Vue环境安装以及配置
  • Redis 数据类型hash(哈希)
  • 单一执行和循环执行的例行性工作
  • 单细胞分析 | Cicero+Signac 寻找顺式共可及网络
  • 人工智能创造出大量新型蛋白质
  • Palo Alto Networks Expedition 未授权SQL注入漏洞复现(CVE-2024-9465)
  • c 语言 sprintf
  • stm32单片机个人学习笔记10(TIM编码器接口)
  • 如何在Android中存储数据?