-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create bash library to handle install/run/test of python backen…
…ds (#2286) * feat: create bash library to handle install/run/test of python backends Signed-off-by: Chris Jowett <421501+cryptk@users.noreply.github.com> * chore: minor cleanup Signed-off-by: Chris Jowett <421501+cryptk@users.noreply.github.com> * fix: remove incorrect LIMIT_TARGETS from parler-tts Signed-off-by: Chris Jowett <421501+cryptk@users.noreply.github.com> * fix: update runUnitests to handle running tests from a custom test file Signed-off-by: Chris Jowett <421501+cryptk@users.noreply.github.com> * chore: document runUnittests Signed-off-by: Chris Jowett <421501+cryptk@users.noreply.github.com> --------- Signed-off-by: Chris Jowett <421501+cryptk@users.noreply.github.com>
- Loading branch information
Showing
106 changed files
with
425 additions
and
1,606 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,4 @@ backend_pb2_grpc.py backend_pb2.py: | |
|
||
.PHONY: clean | ||
clean: protogen-clean | ||
rm -rf venv | ||
rm -rf venv __pycache__ |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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 |
---|---|---|
@@ -1,34 +1,6 @@ | ||
#!/bin/bash | ||
set -ex | ||
set -e | ||
|
||
BUILD_ISOLATION_FLAG="" | ||
source $(dirname $0)/../common/libbackend.sh | ||
|
||
MY_DIR="$(dirname -- "${BASH_SOURCE[0]}")" | ||
|
||
uv venv ${MY_DIR}/venv | ||
source ${MY_DIR}/venv/bin/activate | ||
|
||
if [ -f "requirements-install.txt" ]; then | ||
# If we have a requirements-install.txt, it means that a package does not properly declare it's build time | ||
# dependencies per PEP-517, so we have to set up the proper build environment ourselves, and then install | ||
# the package without build isolation | ||
BUILD_ISOLATION_FLAG="--no-build-isolation" | ||
uv pip install --requirement ${MY_DIR}/requirements-install.txt | ||
fi | ||
uv pip install ${BUILD_ISOLATION_FLAG} --requirement ${MY_DIR}/requirements.txt | ||
|
||
if [ -f "requirements-${BUILD_TYPE}.txt" ]; then | ||
uv pip install ${BUILD_ISOLATION_FLAG} --requirement ${MY_DIR}/requirements-${BUILD_TYPE}.txt | ||
fi | ||
|
||
if [ -d "/opt/intel" ]; then | ||
# Intel GPU: If the directory exists, we assume we are using the Intel image | ||
# https://github.com/intel/intel-extension-for-pytorch/issues/538 | ||
if [ -f "requirements-intel.txt" ]; then | ||
uv pip install ${BUILD_ISOLATION_FLAG} --index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/ --requirement ${MY_DIR}/requirements-intel.txt | ||
fi | ||
fi | ||
|
||
if [ "$PIP_CACHE_PURGE" = true ] ; then | ||
pip cache purge | ||
fi | ||
installRequirements |
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 |
---|---|---|
@@ -1,10 +1,4 @@ | ||
#!/bin/bash | ||
source $(dirname $0)/../common/libbackend.sh | ||
|
||
## | ||
## A bash script wrapper that runs the autogptq server | ||
|
||
MY_DIR="$(dirname -- "${BASH_SOURCE[0]}")" | ||
|
||
source $MY_DIR/venv/bin/activate | ||
|
||
python $MY_DIR/autogptq.py $@ | ||
startBackend $@ |
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 |
---|---|---|
@@ -1,16 +1,6 @@ | ||
#!/bin/bash | ||
## | ||
## A bash script wrapper that runs python unittests | ||
set -e | ||
|
||
MY_DIR="$(dirname -- "${BASH_SOURCE[0]}")" | ||
source $(dirname $0)/../common/libbackend.sh | ||
|
||
source $MY_DIR/venv/bin/activate | ||
|
||
if [ -f "${MY_DIR}/test.py" ]; then | ||
pushd ${MY_DIR} | ||
python -m unittest test.py | ||
popd | ||
else | ||
echo "ERROR: No tests defined for backend!" | ||
exit 1 | ||
fi | ||
runUnittests |
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 |
---|---|---|
|
@@ -26,4 +26,4 @@ backend_pb2_grpc.py backend_pb2.py: | |
|
||
.PHONY: clean | ||
clean: protogen-clean | ||
rm -rf venv | ||
rm -rf venv __pycache__ |
File renamed without changes.
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 |
---|---|---|
@@ -1,34 +1,6 @@ | ||
#!/bin/bash | ||
set -ex | ||
set -e | ||
|
||
BUILD_ISOLATION_FLAG="" | ||
source $(dirname $0)/../common/libbackend.sh | ||
|
||
MY_DIR="$(dirname -- "${BASH_SOURCE[0]}")" | ||
|
||
uv venv ${MY_DIR}/venv | ||
source ${MY_DIR}/venv/bin/activate | ||
|
||
if [ -f "requirements-install.txt" ]; then | ||
# If we have a requirements-install.txt, it means that a package does not properly declare it's build time | ||
# dependencies per PEP-517, so we have to set up the proper build environment ourselves, and then install | ||
# the package without build isolation | ||
BUILD_ISOLATION_FLAG="--no-build-isolation" | ||
uv pip install --requirement ${MY_DIR}/requirements-install.txt | ||
fi | ||
uv pip install ${BUILD_ISOLATION_FLAG} --requirement ${MY_DIR}/requirements.txt | ||
|
||
if [ -f "requirements-${BUILD_TYPE}.txt" ]; then | ||
uv pip install ${BUILD_ISOLATION_FLAG} --requirement ${MY_DIR}/requirements-${BUILD_TYPE}.txt | ||
fi | ||
|
||
if [ -d "/opt/intel" ]; then | ||
# Intel GPU: If the directory exists, we assume we are using the Intel image | ||
# https://github.com/intel/intel-extension-for-pytorch/issues/538 | ||
if [ -f "requirements-intel.txt" ]; then | ||
uv pip install ${BUILD_ISOLATION_FLAG} --index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/ --requirement ${MY_DIR}/requirements-intel.txt | ||
fi | ||
fi | ||
|
||
if [ "$PIP_CACHE_PURGE" = true ] ; then | ||
pip cache purge | ||
fi | ||
installRequirements |
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 |
---|---|---|
@@ -1,10 +1,4 @@ | ||
#!/bin/bash | ||
source $(dirname $0)/../common/libbackend.sh | ||
|
||
## | ||
## A bash script wrapper that runs the ttsbark server | ||
|
||
MY_DIR="$(dirname -- "${BASH_SOURCE[0]}")" | ||
|
||
source $MY_DIR/venv/bin/activate | ||
|
||
python $MY_DIR/ttsbark.py $@ | ||
startBackend $@ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,6 @@ | ||
#!/bin/bash | ||
## | ||
## A bash script wrapper that runs python unittests | ||
set -e | ||
|
||
MY_DIR="$(dirname -- "${BASH_SOURCE[0]}")" | ||
source $(dirname $0)/../common/libbackend.sh | ||
|
||
source $MY_DIR/venv/bin/activate | ||
|
||
if [ -f "${MY_DIR}/test.py" ]; then | ||
pushd ${MY_DIR} | ||
python -m unittest test.py | ||
popd | ||
else | ||
echo "ERROR: No tests defined for backend!" | ||
exit 1 | ||
fi | ||
runUnittests |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.