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

Unify io_config public method and public attribute #1091

Merged
merged 22 commits into from
Apr 18, 2024
Merged

Conversation

guotuofeng
Copy link
Collaborator

@guotuofeng guotuofeng commented Apr 18, 2024

Describe your changes

  • Unify io_config public method and public attribute
  • Fix qnn bug which is not tested never.

Checklist before requesting a review

  • Add unit tests for this change.
  • Make sure all tests can pass.
  • Update documents if necessary.
  • Lint and apply fixes to your code by running lintrunner -a
  • Is this a user-facing change? If yes, give a description of this change to be included in the release notes.
  • Is this PR including examples changes? If yes, please remember to update example documentation in a follow-up PR.

(Optional) Issue link

olive/passes/snpe/quantization.py Fixed Show fixed Hide fixed
olive/passes/snpe/quantization.py Fixed Show fixed Hide fixed
olive/passes/qnn/conversion.py Fixed Show fixed Hide fixed
olive/passes/qnn/conversion.py Fixed Show fixed Hide fixed
olive/passes/qnn/conversion.py Fixed Show fixed Hide fixed
olive/evaluator/olive_evaluator.py Fixed Show fixed Hide fixed
olive/evaluator/olive_evaluator.py Fixed Show fixed Hide fixed
olive/passes/snpe/snpe_to_onnx.py Fixed Show fixed Hide fixed
olive/model/handler/qnn.py Outdated Show resolved Hide resolved
olive/common/utils.py Outdated Show resolved Hide resolved
def io_config(self) -> Dict[str, Any]:
assert self._io_config, "SNPEModelHandler: io_config is not set"

keys = {"input_names", "input_shapes", "output_names", "output_shapes"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason we need this?

@guotuofeng guotuofeng merged commit 2682c8d into main Apr 18, 2024
35 checks passed
@guotuofeng guotuofeng deleted the myguo/io_config branch April 18, 2024 23:43
jambayk added a commit that referenced this pull request Apr 26, 2024
…ecution_provider (#1116)

## Describe your changes
This fixes some bugs introduced by some recent PRs:
- #1091
- made `model.io_config` a property which calls `get_hf_model_io_config`
if the conditions meet.
- However, this function fails if the model is not supported. Now it
doesn't fail and logs when unsupported.
- `PytorchModelHandler.to_json` uses `_io_config` for `"io_config"` so
that the serialized model is the same as the one that was initialized.
- #1072
- execution_provider is optional for non-onnx pass but `to_json` still
has the key. Which doesn't match the signature for
https://github.com/microsoft/Olive/blob/91c4c20e324fbc47dcbbea20bf89035ec94fa4a6/olive/passes/olive_pass.py#L459
   - Only add when not None
- Also removed `pass_accelerator_type` and `pass_execution_provider`
from the aml_pass_runner command line inputs. These values are already
present in `pass_config.json`
 
## Checklist before requesting a review
- [ ] Add unit tests for this change.
- [ ] Make sure all tests can pass.
- [ ] Update documents if necessary.
- [ ] Lint and apply fixes to your code by running `lintrunner -a`
- [ ] Is this a user-facing change? If yes, give a description of this
change to be included in the release notes.
- [ ] Is this PR including examples changes? If yes, please remember to
update [example
documentation](https://github.com/microsoft/Olive/blob/main/docs/source/examples.md)
in a follow-up PR.

## (Optional) Issue link
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

Successfully merging this pull request may close these issues.

None yet

5 participants