# [NVIDIA Jetson AGX Orin Developer 運行Transformer模型(上篇)](/4i9l0gUyTt-tNkvXK5lM2w) ## :question: 目標 :::success 學習如何成功驅動AGX orin並在上面執行Transformer AI模型 ::: ## :feet: Step :::success **[UniAD]**(https://github.com/OpenDriveLab/UniAD/blob/main/docs/INSTALL.md)的Transformer模型的運行 ::: 1. 載cudatoolkit `conda install cudatoolkit=11.3.1 -c conda-forge` ![image](https://hackmd.io/_uploads/SJUiv1JK6.png) ![image](https://hackmd.io/_uploads/Bk8cDyyF6.png) 2. 安裝mim(**可以選擇是否要裝**) `pip install -U openmim` 3. 進入[mmcv官網](https://mmcv.readthedocs.io/zh-cn/latest/get_started/installation.html) 選擇自己的Torch對應版本 ![image](https://hackmd.io/_uploads/SkRbcVZYp.png) 4. 進入上面顯示的網址: ``` https://download.openmmlab.com/mmcv/dist/cu113/torch1.11/index.html ``` 5. 選擇對應的python版本,本篇採用mmcv-full **1.4.8** cp38 ![image](https://hackmd.io/_uploads/S1VjqEbKa.png) 6. 安裝mmcv-full,將上面的版本用下方指令安裝(記得版本要改成自己所選的) ``` pip install mmcv-full==1.4.8 -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.11/index.html ``` ![image](https://hackmd.io/_uploads/ByAmi4ZKa.png) 7. 進入[mmdet官網](https://mmdetection.readthedocs.io/zh-cn/v2.24.0/get_started.html) 查看與mmcv適配的mmdet版本 8. 選擇與mmcv適配的mmdet版本,本篇採用2.19.0 ![image](https://hackmd.io/_uploads/Sk2j3Ebt6.png) 9. 回到cmd下輸入下方指令安裝mmdet `pip install mmdet==2.19.0` ![image](https://hackmd.io/_uploads/SkAxTEWY6.png) 9. 根據下表選擇mmsegmentation版本([表網址](https://blog.csdn.net/csuzhaoqinghui/article/details/130984373)) ![image](https://hackmd.io/_uploads/H1xN04-Ka.png) 10. 本篇選擇mmseg 0.20.0版本 ![image](https://hackmd.io/_uploads/BkmUkSWtT.png) 11. 回到cmd下輸入下方指令安裝mmseg `pip install mmsegmentation==0.20.0` ![image](https://hackmd.io/_uploads/BkYAAE-Kp.png) 13. 根據上表選擇對應的mmdet3d版本,本篇選擇**v1.0.0rc1**版本 14. 回到cmd下輸入下方指令安裝mmdet3d,**若已裝過要重裝者請參考該**[網址](https://blog.csdn.net/xinxiang7/article/details/119025732) 15. (遭遇錯誤) 1.找不到llvmlite ``` Failed to build llvmlite ERROR: Could not build wheels for llvmlite, which is required to install pyproject.toml-based projects ``` ![image](https://hackmd.io/_uploads/SJ5F3_QFp.png) ![image](https://hackmd.io/_uploads/r12xQIWKT.png) 2.裝上llvmdev後的第二個錯誤(有關版本) 可以參考這個[網址](https://llvmlite.readthedocs.io/en/latest/) ![image](https://hackmd.io/_uploads/B16S3_mYT.png) 解法:改安裝llvmdev==10.0.0版本 `conda install -c numba llvmdev==10.0.0` ![image](https://hackmd.io/_uploads/rytfndQYT.png) 成功安裝mmdet3d ![image](https://hackmd.io/_uploads/H1MC2uXKa.png) 16. 下載驗證用權重檔案,進入該[網址](https://github.com/open-mmlab/mmdetection3d/tree/1.0/configs/second),下載下圖所選的model ![image](https://hackmd.io/_uploads/BJYSezVFa.png) 17. 驗證mmdet3d,輸入以下指令 ``` python demo/pcd_demo.py demo/data/kitti/kitti_000008.bin configs/second/hv_second_secfpn_6x8_80e_kitti-3d-car.py checkpoints/hv_second_secfpn_6x8_80e_kitti-3d-car_20200620_230238-393f000c.pth --show ``` 18. 遇到錯誤 return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined] ![image](https://hackmd.io/_uploads/BJi4cNEFa.png) 解法:將functional.py:568的程式碼修改,改法如下 ``` return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined] ``` 改為 ``` return _VF.meshgrid(tensors, **kwargs,indexing = 'ij') # type: ignore[attr-defined] ``` ![image](https://hackmd.io/_uploads/B1eXnNVKp.png) > functional.py 檔案位置如下 /home/ai/anaconda3/envs/uniad/lib/python3.8/site-packages/torch/functional.py 19. 遇到錯誤2 ![image](https://hackmd.io/_uploads/BJC7JB4Ya.png) 解法: `pip install open3d` 20. 成功出現下方視覺化雲點圖代表成功 ![image](https://hackmd.io/_uploads/BkE2yrEFT.png) 21. ## :feet: Previous :::success [NVIDIA Jetson AGX Orin 開箱及tool安裝步驟](https://hackmd.io/@ht_ypbWySduBg0IliGLExw/SJ0_VA3uT) ::: ## :feet: NEXT :::success [安裝並運行Transformer模型(Uniad)下篇](https://hackmd.io/@ht_ypbWySduBg0IliGLExw/H1CFF64Ka) ::: 參考資料 https://blog.csdn.net/condom10010/article/details/128139401