sony / model_optimization

Model Compression Toolkit (MCT) is an open source project for neural network model optimization under efficient, constrained hardware. This project provides researchers, developers, and engineers advanced quantization and compression tools for deploying state-of-the-art neural networks.
https://sony.github.io/model_optimization/
Apache License 2.0
331 stars 53 forks source link

yolox importerror FasterRCNNBoxDecode #1252

Closed alexander-sony closed 1 week ago

alexander-sony commented 1 month ago

Issue Type

Bug

Source

pip (model-compression-toolkit)

MCT Version

2.2

OS Platform and Distribution

google colab

Python version

3.10

Describe the issue

running yolox on colab tutorials/notebooks/imx500_notebooks/pytorch/pytorch_yolox-tiny_for_imx500.ipynb

guess that newer (dev) version sony-custom-layers is required

error at
from tutorials.mct_model_garden.models_pytorch.yolox.yolox import YOLOX

--2024-10-22 12:02:43--  https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_tiny.pth
Resolving github.com (github.com)... 20.205.243.166
Connecting to github.com (github.com)|20.205.243.166|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/386811486/cbf58ed8-49c4-401f-9764-93f785c6eade?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20241022%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20241022T120243Z&X-Amz-Expires=300&X-Amz-Signature=e1d4e63ba513e1646dc4bea9fbbd55dfdb739c8c043ca0930281185ca962ec10&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%3Dyolox_tiny.pth&response-content-type=application%2Foctet-stream [following]
--2024-10-22 12:02:43--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/386811486/cbf58ed8-49c4-401f-9764-93f785c6eade?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20241022%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20241022T120243Z&X-Amz-Expires=300&X-Amz-Signature=e1d4e63ba513e1646dc4bea9fbbd55dfdb739c8c043ca0930281185ca962ec10&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%3Dyolox_tiny.pth&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.108.133, 185.199.109.133, 185.199.110.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 40755013 (39M) [application/octet-stream]
Saving to: ‘yolox_tiny.pth’

yolox_tiny.pth      100%[===================>]  38.87M  41.3MB/s    in 0.9s    

2024-10-22 12:02:46 (41.3 MB/s) - ‘yolox_tiny.pth’ saved [40755013/40755013]

/usr/local/lib/python3.10/dist-packages/sony_custom_layers/pytorch/object_detection/nms.py:120: FutureWarning: `torch.library.impl_abstract` was renamed to `torch.library.register_fake`. Please use that instead; we will remove `torch.library.impl_abstract` in a future version of PyTorch.
  @torch.library.impl_abstract(MULTICLASS_NMS_TORCH_OP_QUALNAME)
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
[<ipython-input-4-39a3ff4fff99>](https://localhost:8080/#) in <cell line: 4>()
      2 get_ipython().system('wget -nc https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_tiny.pth')
      3 
----> 4 from tutorials.mct_model_garden.models_pytorch.yolox.yolox import YOLOX
      5 import yaml
      6 

[/content/tutorials/mct_model_garden/models_pytorch/yolox/yolox.py](https://localhost:8080/#) in <module>
     36 from model_compression_toolkit.core.pytorch.pytorch_device_config import get_working_device
     37 from .darknet import CSPDarknet, CSPLayer, BaseConv, DWConv
---> 38 from sony_custom_layers.pytorch import multiclass_nms, FasterRCNNBoxDecode
     39 
     40 

ImportError: cannot import name 'FasterRCNNBoxDecode' from 'sony_custom_layers.pytorch' (/usr/local/lib/python3.10/dist-packages/sony_custom_layers/pytorch/__init__.py)

Expected behaviour

No response

Code to reproduce the issue

see above

Log output

No response

Idan-BenAmi commented 1 week ago

Hi @alexander-sony, Sorry for the delayed reply. Yes, FasterRCNNBoxDecode layer requires a newer version of sony-custom-layers. We will notify you once it's available.

Thank you Idan