• LuxonisHub
  • Server have some issue?? with WindosPath error

I have task that object detection using OAK-D lite camera with my custom yolov5s model.

yolov5s model train dessert image with 416x416 rgb shape.

I finish model training, then I have some issue convert my model to .blob using hub.luxonis

What is problem???

2025-06-15 07:54:47.350135+00:00] {pod_manager.py:472} INFO - [base] INFO Class names: ['"Baumkuchen', 'Cake', 'Cannele', 'Churros', main.py:95
[2025-06-15 07:54:47.350337+00:00] {pod_manager.py:472} INFO - [base] 'Cookie', 'Croissant', 'Eclair', 'Financier', 'Icecream',
[2025-06-15 07:54:47.350572+00:00] {pod_manager.py:472} INFO - [base] 'Macaron', 'Madeleine', 'Meringue', 'SaltyBread', 'Scone',
[2025-06-15 07:54:47.351069+00:00] {pod_manager.py:472} INFO - [base] 'Tart', 'Tigre"']
[2025-06-15 07:54:48.677255+00:00] {pod_manager.py:472} INFO - [base] INFO Loading model... main.py:118
[2025-06-15 07:54:48.677546+00:00] {pod_manager.py:472} INFO - [base] mkdir -p failed for path /home/non-root/.config/matplotlib: [Errno 13] Permission denied: '/home/non-root'
[2025-06-15 07:54:49.911667+00:00] {pod_manager.py:472} INFO - [base] Matplotlib created a temporary cache directory at /tmp/matplotlib-ppvhz31l because there was an issue with the default path (/home/non-root/.config/matplotlib); it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing.
[2025-06-15 07:54:49.912283+00:00] {pod_manager.py:472} INFO - [base] WARNING /usr/local/lib/python3.11/site-packages/tools/yolo/yolov5 logging.py:92
[2025-06-15 07:54:49.913250+00:00] {pod_manager.py:472} INFO - [base] `torch.load` with `weights_only=False` (the current
[2025-06-15 07:54:49.913655+00:00] {pod_manager.py:472} INFO - [base] default value), which uses the default pickle module
[2025-06-15 07:54:49.914025+00:00] {pod_manager.py:472} INFO - [base] implicitly. It is possible to construct malicious pickle
[2025-06-15 07:54:49.914296+00:00] {pod_manager.py:472} INFO - [base] data which will execute arbitrary code during unpickling
[2025-06-15 07:54:49.914994+00:00] {pod_manager.py:472} INFO - [base] (See
[2025-06-15 07:54:49.915325+00:00] {pod_manager.py:472} INFO - [base] pytorch/pytorchblob/main/SECURITY.md#
[2025-06-15 07:54:49.915768+00:00] {pod_manager.py:472} INFO - [base] untrusted-models for more details). In a future release,
[2025-06-15 07:54:49.915965+00:00] {pod_manager.py:472} INFO - [base] the default value for `weights_only` will be flipped to
[2025-06-15 07:54:49.916363+00:00] {pod_manager.py:472} INFO - [base] `True`. This limits the functions that could be executed
[2025-06-15 07:54:49.916601+00:00] {pod_manager.py:472} INFO - [base] during unpickling. Arbitrary objects will no longer be
[2025-06-15 07:54:49.916933+00:00] {pod_manager.py:472} INFO - [base] allowed to be loaded via this mode unless they are
[2025-06-15 07:54:49.917086+00:00] {pod_manager.py:472} INFO - [base] explicitly allowlisted by the user via
[2025-06-15 07:54:49.917498+00:00] {pod_manager.py:472} INFO - [base] `torch.serialization.add_safe_globals`. We recommend you
[2025-06-15 07:54:49.917804+00:00] {pod_manager.py:472} INFO - [base] start setting `weights_only=True` for any use case where
[2025-06-15 07:54:49.918090+00:00] {pod_manager.py:472} INFO - [base] you don't have full control of the loaded file. Please
[2025-06-15 07:54:49.918367+00:00] {pod_manager.py:472} INFO - [base] open an issue on GitHub for any issues related to this
[2025-06-15 07:54:49.918717+00:00] {pod_manager.py:472} INFO - [base] experimental feature.
[2025-06-15 07:54:49.919039+00:00] {pod_manager.py:472} INFO - [base] ckpt = torch.load(attempt_download(w),
[2025-06-15 07:54:49.951024+00:00] {pod_manager.py:472} INFO - [base] map_location='cpu') # load
[2025-06-15 07:54:49.951380+00:00] {pod_manager.py:472} INFO - [base] ERROR Error creating exporter: cannot instantiate 'WindowsPath' main.py:156
[2025-06-15 07:54:51.959762+00:00] {pod_manager.py:490} INFO - [base] on your system
[2025-06-15 07:54:52.008893+00:00] {pod_manager.py:623} INFO - Pod yolo-export-lucpmo1s has phase Running

Hi,

the problem is PyTorch saves model with WindowsPath (from Windows system). When Hub tries to load on Linux, it cannot understand WindowsPath, so gives error cannot instantiate 'WindowsPath'. This happen often when model is trained on Windows and used on Linux.

There is similar problem here with solution: https://forums.fast.ai/t/cannot-instantiate-windowspath-when-loading-learner/86564/6

You can try workaround like they explain there. Or better, export model to ONNX first (it does not have this problem), then upload to Hub.

Best,
Lovro