AttributeError: module 'torch' has no attribute 'asarray'

Hello,

I’m trying to use docker environment with TX2.

I builded PyTorch and torchvision as below guide:
(Wheel file is builded on JetPack 4.6 / CUDA 10.2 / Python3.8)

The verification is OK with our environment.
But some function has a problem as below :

root@tx2:/home/test/YOLOv8-TensorRT# python3 infer-det.py --engine yolov8s.engine --imgs data --show --out-dir outputs --device cuda:0
/usr/local/lib/python3.8/dist-packages/torch/package/_directory_reader.py:17: UserWarning: Failed to initialize NumPy: module compiled against API version 0x10 but this version of numpy is 0xf . Check the section C-API incompatibility at the Troubleshooting ImportError section at Troubleshooting — NumPy v2.1.dev0 Manual for indications on how to solve this problem . (Triggered internally at /home/nvidia/work/pytorch/torch/csrc/utils/tensor_numpy.cpp:68.)
_dtype_to_storage = {data_type(0).dtype: data_type for data_type in _storages}
Traceback (most recent call last):
File “infer-det.py”, line 86, in
main(args)
File “infer-det.py”, line 34, in main
dwdh = torch.asarray(dwdh * 2, dtype=torch.float32, device=device)
AttributeError: module ‘torch’ has no attribute ‘asarray’
root@tx2:/home/test/YOLOv8-TensorRT#

How can I fix it?

There is no update from you for a period, assuming this is not an issue any more.
Hence we are closing this topic. If need further support, please open a new one.
Thanks

Hi,

Could you check what PyTorch version is required by the YOLOv8 sample first?
Thanks.