microsoft / nni

An open source AutoML toolkit for automate machine learning lifecycle, including feature engineering, neural architecture search, model compression and hyper-parameter tuning.
https://nni.readthedocs.io
MIT License
13.95k stars 1.81k forks source link

Automatic Operator Conversion Enhancement #4981

Open Louis-J opened 2 years ago

Louis-J commented 2 years ago

What would you like to be added:

automatic operator conversion in compression.pytorch.speedup

Why is this needed:

nni needs to call these functions to understand the model.

problems when doing it manually:

  1. The arguments can only be fetched as a argument list
  2. The function uses a lot of star(*) syntax (Keyword-Only Arguments, PEP 3102), both positional argument and keyword-only argument, but the argument list cannot be used to distinguish positional argument and keyword-only argument
  3. The function is overloaded, and the number of parameters in multiple versions of the same function may be the same, so it is difficult to distinguish overloaded situations only by the number.
  4. Because it is a build-in, inspect.getfullargspec and other methods in inspect module cannot be used to get reflection information.
  5. There are more than 2000 functions including the overloaded functions, which is hard to be operated by manual adaptation.

Without this feature, how does current nni work

manual adaptation and conversion

Components that may involve changes:

only jit_translate.py in common/compression/pytorch/speedup/

Brief description of your proposal if any:

  1. Automatic conversion
  1. Unresolved issues
scarlett2018 commented 1 year ago

@Louis-J /@ultmaster - had this work completed in 2.9?