forked from microsoft/Olive
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐌 SNPE env and example fix (microsoft#860)
## Describe your changes There are a few issues for current SNPE examples: 1. The libxx.so under customized `python3.6` need to be put visible for system for SNPE cmd running - put `str(Path(f"{snpe_root}/python36-env/lib"))` under `LD_LIBRARY_PATH` can fix. 2. SNPE evaluation extent the logits wrongly, - fixed in this PR. 3. We did not support tensorflow model evaluation. - update examples without input model evaluation. 4. Wrong metrics config for inception examples 5. Importing issue for vgg, tell that in README.md to let user update it manually as a workaround. 6. Python3.6 seems a bit outdated for latest SNPE updates. The vgg example failed to be run. Updated the python env to 3.8 can fix. ## 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. ## (Optional) Issue link
- Loading branch information
Showing
11 changed files
with
163 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/usr/bin/env bash | ||
# ------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
# -------------------------------------------------------------------------- | ||
set -eux | ||
|
||
# This script creates a python 3.6 environment in $SNPE_ROOT/olive-pyenv | ||
# and installs the required packages for SNPE-v2.18.0.240101 | ||
|
||
# Usage: ./create_python_env.sh -v/--version <python_version> | ||
while [[ "$#" -gt 0 ]]; do | ||
key="$1" | ||
case $key in | ||
-v|--version) | ||
PY_VERSION="$2" | ||
shift | ||
shift | ||
;; | ||
*) | ||
echo "Unknown option: $key" | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
PY_ENV_NAME=olive-pyenv | ||
FILES_DIR=$SNPE_ROOT/python-env-setup | ||
rm -rf "$FILES_DIR" | ||
mkdir "$FILES_DIR" | ||
|
||
# Install conda if not already installed | ||
if ! command -v conda; then | ||
# Install conda | ||
curl -fsSL -o "$FILES_DIR"/install_conda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh | ||
sh "$FILES_DIR"/install_conda.sh -b -p "$FILES_DIR"/miniconda | ||
CONDA=$FILES_DIR/miniconda/bin/conda | ||
else | ||
CONDA=conda | ||
fi | ||
|
||
# Create python environment | ||
$CONDA create -y -p "$FILES_DIR"/$PY_ENV_NAME python="$PY_VERSION" | ||
|
||
# Install snpe requirements | ||
"$FILES_DIR"/$PY_ENV_NAME/bin/python -m pip install --upgrade pip | ||
if [ "$PY_VERSION" == "3.6" ]; then | ||
"$FILES_DIR"/$PY_ENV_NAME/bin/python -m pip install onnx==1.11.0 onnx-simplifier packaging tensorflow==1.15.0 pyyaml | ||
elif [ "$PY_VERSION" == "3.8" ]; then | ||
"$FILES_DIR"/$PY_ENV_NAME/bin/python -m pip install onnx onnx-simplifier packaging tensorflow pyyaml | ||
else | ||
echo "Unsupported python version: $PY_VERSION, only 3.6 and 3.8 are supported" | ||
exit 1 | ||
fi | ||
|
||
|
||
rm -rf "${SNPE_ROOT:?}"/$PY_ENV_NAME | ||
mv "$FILES_DIR"/$PY_ENV_NAME "$SNPE_ROOT"/$PY_ENV_NAME | ||
|
||
# Remove all unnecessary files | ||
rm -rf "$FILES_DIR" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters