Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create an esp-ppq installation where quantize_custom_torch_model.py works properly. (AIV-740) #190

Open
3 tasks done
nicklasb opened this issue Jan 5, 2025 · 3 comments

Comments

@nicklasb
Copy link

nicklasb commented Jan 5, 2025

Checklist

  • Checked the issue tracker for similar issues to ensure this is not a duplicate
  • Read the documentation to confirm the issue is not addressed there and your configuration is set correctly
  • Tested with the latest version to ensure the issue hasn't been fixed

How often does this bug occurs?

always

Expected behavior

Installing ESP-PPQ following the "pip install git+https://github.com/espressif/esp-ppq.git" instructions makes it possible to quantize my model using quantize_custom_torch_model.py (albeit providing my own model instead of mobilenet etc.).

Actual behavior (suspected bug)

ESP-PPQ depends on older versions of torch that ends up conflicting with torchvision.

Error logs or terminal output

You can end up in several situations, but this seems most relevant, as old torch (2.2.2) is forced:

  File "...\Projects\esp-dl\tools\quantization\quantize_custom_torch_model.py", line 6, in <module>
    import torchvision
  File "...\Projects\esp-dl\.venv\Lib\site-packages\torchvision\__init__.py", line 10, in <module>
    from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils  # usort:skip
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\Projects\esp-dl\.venv\Lib\site-packages\torchvision\_meta_registrations.py", line 163, in <module>
    @torch.library.register_fake("torchvision::nms")
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'torch.library' has no attribute 'register_fake'

Steps to reproduce the behavior

  • Follow the esp-ppq installation on esp-dl
  • Quantize a model.

Project release version

latest

System architecture

Intel/AMD 64-bit (modern PC, older Mac)

Operating system

Windows

Operating system version

Windows 11

Shell

PowerShell

Additional context

No response

@github-actions github-actions bot changed the title Cannot create an esp-ppq installation where quantize_custom_torch_model.py works properly. Cannot create an esp-ppq installation where quantize_custom_torch_model.py works properly. (AIV-740) Jan 5, 2025
@sun-xiangyu
Copy link
Collaborator

Please install torch>=2.4.0 first and then reinstall esp-ppq.

@nicklasb
Copy link
Author

Thank you, but I am afraid that esp-ppq causes torch 2.2.2 to reinstall and then it fails again.
However, upgrading Torch and then leave esp-ppq untouched as is, works.
I suppose this must imply that threre is a problem with dependencies?

@sun-xiangyu
Copy link
Collaborator

Hi @nicklasb,
Thanks for your feedback, which version is your python? I will check it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants