# [NVIDIA Jetson AGX Orin Developer 運行Transformer模型(下篇)](/otAjXaZnQOaUDcE80UKOLQ) ## :question: 目標 :::success 學習如何成功驅動AGX orin並在上面執行Transformer AI模型 ::: ## :feet: previous :::success [安裝並運行Transformer模型(Uniad)上篇](https://hackmd.io/QSyaTdhWQPmy7xRWJXPw6Q) ::: ## :feet: Step :::success **[UniAD]**(https://github.com/OpenDriveLab/UniAD/blob/main/docs/INSTALL.md)的Transformer模型的運行 ::: 1. 根據[UniAD Github](https://github.com/OpenDriveLab/UniAD/blob/main/docs/INSTALL.md) 上的安裝手冊下載權重檔 ![image](https://hackmd.io/_uploads/ryfpj6EKp.png) >注意: 可以跳過前面gcc mmdet相關的安裝,直接下載權重檔,因為前篇我們已安裝過 2. 相關設定和資料集準備可以到我的[Github](https://github.com/Alex-fishred/Uniad_Orin)下載 3. 打開vscode設定 launch.json,設定如下 ![image](https://hackmd.io/_uploads/HkHwx1_FT.png) 4. 打vscode開始運行test.py >注意:因為我有設定好vscode的launch.json所以可以直接在test.py按下F5 >此外,test.py已經被我改過,所以可以到我的[github](https://github.com/Alex-fishred/Uniad_Orin)下載修正過的版本 1. 遭遇錯誤(一) No module named 'IPython' 解法:pip install IPython 2. 遭遇錯誤(二) 'DiceLoss is already registered in models' ![image](https://hackmd.io/_uploads/rk4k7C4t6.png) 解法:將`@LOSSES.register_module()` 替換成 `@LOSSES.register_module(force=True)` ![image](https://hackmd.io/_uploads/HJFYSRNta.png) 3. 遭遇錯誤(三) expected str, bytes or os.PathLike object, not _io.BufferedReader ![image](https://hackmd.io/_uploads/rkBxcCEF6.png) 解法: 修改mmdetection3d/mmdet3d/datasets/裡的custom_3d.py的load_annotations的path 將 ``` self.data_infos = self.load_annotations(open(local_path, 'rb')) ``` 改為 ``` self.data_infos = self.load_annotations(self.ann_file) ``` ![image](https://hackmd.io/_uploads/rk7qkYBF6.png) 4. 遭遇錯誤(四)Unexpected keyword arguments: `compute_on_step` 解法:經查驗為torchmetrics **版本**問題(太新版不支援compute_on_step) 所以將torchmetrics-**1.3.0**降成torchmetrics-**0.11.4**版本 ![image](https://hackmd.io/_uploads/SyDbxJdFp.png) 5. 將結果可視化 1. 開啟vscode設定 launch.json,設定如下 ![image](https://hackmd.io/_uploads/rke0xJ_t6.png) 2. 執行run.py,該檔案位置在/media/ai/alexSSD/uniad/tools/analysis_tools/visualize/run.py 6. 大功告成 ![image](https://hackmd.io/_uploads/BkAL-J_KT.png) 7. tool 版本紀錄 ![image](https://hackmd.io/_uploads/r1E4yguKp.png) ![image](https://hackmd.io/_uploads/HJGrJlOYa.png) ![image](https://hackmd.io/_uploads/BJELJlOY6.png) ![image](https://hackmd.io/_uploads/ByPvJg_tp.png) ![image](https://hackmd.io/_uploads/HJddyeOY6.png) ![image](https://hackmd.io/_uploads/rJRtkxdYp.png) ![image](https://hackmd.io/_uploads/rJYoyxdtT.png) ![image](https://hackmd.io/_uploads/Bkqn1gOYT.png) ## :feet: NEXT :::success 下一章將介紹如何加速模型推理速度 [在NVIDIA Jetson AGX Orin 上透過tensorrt運行Transformer模型](https://hackmd.io/@ht_ypbWySduBg0IliGLExw/rkkdoXGja) ::: 參考: https://blog.csdn.net/XCCCCZ/article/details/134313976 https://blog.csdn.net/condom10010/article/details/128139401