Skip to content

Commit

Permalink
[Automating Model Tracing and Uploading] PR 1 Model Auto-tracing & Up…
Browse files Browse the repository at this point in the history
…loading (#209)

* Initiate PR #1 Model Auto-tracing & Uploading

Signed-off-by: Thanawan Atchariyachanvanit <latchari@amazon.com>

* Improve update_changelog_md.py & sentencetransformermodel.py scraping

Signed-off-by: Thanawan Atchariyachanvanit <latchari@amazon.com>

* Change default to N/A

Signed-off-by: Thanawan Atchariyachanvanit <latchari@amazon.com>

* Update update_models_upload_history_md.py

Signed-off-by: Thanawan Atchariyachanvanit <latchari@amazon.com>

* Update delete_model_uploader_branch.yml

Signed-off-by: Thanawan Atchariyachanvanit <latchari@amazon.com>

* Correct linting & Update CHANGELOG.md

Signed-off-by: Thanawan Atchariyachanvanit <latchari@amazon.com>

* Revert "Correct demo_ml_commons_integration.ipynb (#208)"

This reverts commit 664e447.

Signed-off-by: Thanawan Atchariyachanvanit <latchari@amazon.com>

* Update CHANGELOG.md

Signed-off-by: Thanawan Atchariyachanvanit <latchari@amazon.com>

* Small fix

Signed-off-by: Thanawan Atchariyachanvanit <latchari@amazon.com>

* Add model_type

Signed-off-by: Thanawan Atchariyachanvanit <latchari@amazon.com>

* Removed a modified file from pull request

Signed-off-by: Thanawan Atchariyachanvanit <latchari@amazon.com>

* Removed a modified file from pull request

Signed-off-by: Thanawan Atchariyachanvanit <latchari@amazon.com>

* Update model_autotracing.py

Signed-off-by: Thanawan Atchariyachanvanit <latchari@amazon.com>

* Update model_autotracing.py

Signed-off-by: Thanawan Atchariyachanvanit <latchari@amazon.com>

* Update model_autotracing.py

Signed-off-by: Thanawan Atchariyachanvanit <latchari@amazon.com>

---------

Signed-off-by: Thanawan Atchariyachanvanit <latchari@amazon.com>
  • Loading branch information
thanawan-atc committed Aug 19, 2023
1 parent 9b558c7 commit 20223e6
Show file tree
Hide file tree
Showing 14 changed files with 1,585 additions and 15 deletions.
40 changes: 33 additions & 7 deletions .ci/run-repository.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Called by entry point `run-test` use this script to add your repository specific test commands
# Called by entry point `run-test` use this script to add your repository specific task commands
# Once called opensearch is up and running and the following parameters are available to this script

# OPENSEARCH_VERSION -- version e.g Major.Minor.Patch(-Prelease)
Expand All @@ -16,7 +16,7 @@ set -e
echo -e "\033[34;1mINFO:\033[0m URL ${opensearch_url}\033[0m"
echo -e "\033[34;1mINFO:\033[0m EXTERNAL OS URL ${external_opensearch_url}\033[0m"
echo -e "\033[34;1mINFO:\033[0m VERSION ${OPENSEARCH_VERSION}\033[0m"
echo -e "\033[34;1mINFO:\033[0m IS_DOC: ${IS_DOC}\033[0m"
echo -e "\033[34;1mINFO:\033[0m TASK_TYPE: ${TASK_TYPE}\033[0m"
echo -e "\033[34;1mINFO:\033[0m TEST_SUITE ${TEST_SUITE}\033[0m"
echo -e "\033[34;1mINFO:\033[0m PYTHON_VERSION ${PYTHON_VERSION}\033[0m"
echo -e "\033[34;1mINFO:\033[0m PYTHON_CONNECTION_CLASS ${PYTHON_CONNECTION_CLASS}\033[0m"
Expand All @@ -33,7 +33,8 @@ docker build \
echo -e "\033[1m>>>>> Run [opensearch-project/opensearch-py-ml container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"


if [[ "$IS_DOC" == "false" ]]; then
if [[ "$TASK_TYPE" == "test" ]]; then
# Set up OpenSearch cluster & Run integration and unit tests (Invoked by integration.yml workflow)
docker run \
--network=${network_name} \
--env "STACK_VERSION=${STACK_VERSION}" \
Expand All @@ -45,10 +46,11 @@ if [[ "$IS_DOC" == "false" ]]; then
--name opensearch-py-ml-test-runner \
opensearch-project/opensearch-py-ml \
nox -s "test-${PYTHON_VERSION}(pandas_version='${PANDAS_VERSION}')"

docker cp opensearch-py-ml-test-runner:/code/opensearch-py-ml/junit/ ./junit/

docker rm opensearch-py-ml-test-runner
else
elif [[ "$TASK_TYPE" == "doc" ]]; then
# Set up OpenSearch cluster & Run docs (Invoked by build_deploy_doc.yml workflow)
docker run \
--network=${network_name} \
--env "STACK_VERSION=${STACK_VERSION}" \
Expand All @@ -60,7 +62,31 @@ else
--name opensearch-py-ml-doc-runner \
opensearch-project/opensearch-py-ml \
nox -s docs

docker cp opensearch-py-ml-doc-runner:/code/opensearch-py-ml/docs/build/ ./docs/

docker rm opensearch-py-ml-doc-runner
fi
elif [[ "$TASK_TYPE" == "trace" ]]; then
# Set up OpenSearch cluster & Run model autotracing (Invoked by model_uploader.yml workflow)
echo -e "\033[34;1mINFO:\033[0m MODEL_ID: ${MODEL_ID}\033[0m"
echo -e "\033[34;1mINFO:\033[0m MODEL_VERSION: ${MODEL_VERSION}\033[0m"
echo -e "\033[34;1mINFO:\033[0m TRACING_FORMAT: ${TRACING_FORMAT}\033[0m"
echo -e "\033[34;1mINFO:\033[0m EMBEDDING_DIMENSION: ${EMBEDDING_DIMENSION:-N/A}\033[0m"
echo -e "\033[34;1mINFO:\033[0m POOLING_MODE: ${POOLING_MODE:-N/A}\033[0m"
echo -e "\033[34;1mINFO:\033[0m MODEL_DESCRIPTION: ${MODEL_DESCRIPTION:-N/A}\033[0m"

docker run \
--network=${network_name} \
--env "STACK_VERSION=${STACK_VERSION}" \
--env "OPENSEARCH_URL=${opensearch_url}" \
--env "OPENSEARCH_VERSION=${OPENSEARCH_VERSION}" \
--env "TEST_SUITE=${TEST_SUITE}" \
--env "PYTHON_CONNECTION_CLASS=${PYTHON_CONNECTION_CLASS}" \
--env "TEST_TYPE=server" \
--name opensearch-py-ml-trace-runner \
opensearch-project/opensearch-py-ml \
nox -s trace -- ${MODEL_ID} ${MODEL_VERSION} ${TRACING_FORMAT} -ed ${EMBEDDING_DIMENSION} -pm ${POOLING_MODE} -md ${MODEL_DESCRIPTION:+"$MODEL_DESCRIPTION"}

docker cp opensearch-py-ml-trace-runner:/code/opensearch-py-ml/upload/ ./upload/
docker cp opensearch-py-ml-trace-runner:/code/opensearch-py-ml/trace_output/ ./trace_output/
docker rm opensearch-py-ml-trace-runner
fi
2 changes: 1 addition & 1 deletion .ci/run-tests
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export PYTHON_CONNECTION_CLASS="${PYTHON_CONNECTION_CLASS:=Urllib3HttpConnection
export CLUSTER="${1:-opensearch}"
export SECURE_INTEGRATION="${2:-true}"
export OPENSEARCH_VERSION="${3:-latest}"
export IS_DOC="${4:-false}"
export TASK_TYPE="${4:-test}"
if [[ "$SECURE_INTEGRATION" == "true" ]]; then
export OPENSEARCH_URL_EXTENSION="https"
else
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_deploy_doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Integ ${{ matrix.cluster }} secured=${{ matrix.secured }} version=${{matrix.entry.opensearch_version}}
run: "./.ci/run-tests ${{ matrix.cluster }} ${{ matrix.secured }} ${{ matrix.entry.opensearch_version }} true"
run: "./.ci/run-tests ${{ matrix.cluster }} ${{ matrix.secured }} ${{ matrix.entry.opensearch_version }} doc"
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/delete_model_uploader_branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Delete merged branch for model-uploader & model-listing-uploader
on:
pull_request:
types:
- closed

jobs:
delete-branch:
runs-on: ubuntu-latest
if: startsWith(github.event.pull_request.head.ref,'model-uploader/') || startsWith(github.event.pull_request.head.ref,'model-listing-uploader/')
steps:
# Compared to backport.yml, this GitHub action will delete branch
# of a PR that is closed, but not merged as well.
- name: Delete closed PR branch
uses: dawidd6/action-delete-branch@v3
with:
GITHUB_TOKEN: ${{github.token}}
numbers: ${{github.event.pull_request.number}}
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Integ ${{ matrix.cluster }} secured=${{ matrix.secured }} version=${{matrix.entry.opensearch_version}}
run: "./.ci/run-tests ${{ matrix.cluster }} ${{ matrix.secured }} ${{ matrix.entry.opensearch_version }}"
run: "./.ci/run-tests ${{ matrix.cluster }} ${{ matrix.secured }} ${{ matrix.entry.opensearch_version }} test"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
Expand Down
Loading

0 comments on commit 20223e6

Please sign in to comment.