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

validate step size #1587

Merged
merged 1 commit into from
Nov 3, 2023
Merged

validate step size #1587

merged 1 commit into from
Nov 3, 2023

Conversation

ylwu-amzn
Copy link
Collaborator

@ylwu-amzn ylwu-amzn commented Nov 3, 2023

Description

Validate step size
This is to address comments from this PR #1586

Issues Resolved

[List any issues this PR will resolve]

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Copy link

codecov bot commented Nov 3, 2023

Codecov Report

Merging #1587 (d418c37) into 2.11 (073b372) will decrease coverage by 0.06%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##               2.11    #1587      +/-   ##
============================================
- Coverage     80.00%   79.94%   -0.06%     
+ Complexity     2461     2460       -1     
============================================
  Files           197      197              
  Lines          9825     9829       +4     
  Branches        991      992       +1     
============================================
- Hits           7860     7858       -2     
- Misses         1497     1500       +3     
- Partials        468      471       +3     
Flag Coverage Δ
ml-commons 79.94% <100.00%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...ine/algorithms/remote/RemoteConnectorExecutor.java 90.47% <100.00%> (+1.00%) ⬆️

... and 4 files with indirect coverage changes

@ylwu-amzn ylwu-amzn merged commit 5da2d91 into opensearch-project:2.11 Nov 3, 2023
7 of 9 checks passed
Comment on lines +49 to +54
int stepSize = Integer.parseInt(parameters.get("input_docs_processed_step_size"));
// We need to check the parameter on runtime as parameter can be passed into predict request
if (stepSize <= 0) {
throw new IllegalArgumentException("Invalid parameter: input_docs_processed_step_size. It must be positive integer.");
}
processedDocs += stepSize;

Choose a reason for hiding this comment

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

  1. parseInt can throw exception as well - can we handle that too?
  2. I understand it is param for one type of connector, but should it be more generalized and property of connector?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  1. It should ok to not handle, it will throw exception and will not crash the service. User should always follow our blueprint, sample blueprint https://github.com/opensearch-project/ml-commons/blob/2.x/docs/remote_inference_blueprints/bedrock_connector_anthropic_claude_blueprint.md. We will publish a new blueprint for multi-modal one soon.
  2. Parameters map is one property of connector. This step size is just one parameter in it.

Choose a reason for hiding this comment

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

Parameters map is one property of connector. This step size is just one parameter in it.

I don’t see input_docs_processed_step_size in blueprint - probably I still didn’t understand this clearly. Shouldn't this be generalized param we extract?

17:15
Wouldn’t it be different param we need to check for different connector? The code currently is in RemoteConnectorExecutor.java (generic)

b4sjoo pushed a commit to b4sjoo/ml-commons that referenced this pull request Nov 17, 2023
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
b4sjoo added a commit that referenced this pull request Nov 17, 2023
* Merge update model API and model level throttling/quota (#1624)

* Update Model API (#1350)

* Update Model API POC

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Using GetRequest to get model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Finalize model update API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compileTest

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add Unit Test Cases for Update Model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Tune back test coverage thereshold

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add more unit tests on Update model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add unit test for TransportUpdateModelAction class

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix a test error

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change exception thrown to failure response

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Move the function judgement to the outter block

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Check if model is undeployed before update model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add more unit test for update model API

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix unit test due to blocking java 11 CI workflow

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling auto bumping model version during registering to a new model group and address reviewers' other concern

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Autobump new model groups' latest version when register to a new model

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change the REST API method from POST to PUT

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change the update REST API endpoint

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix java compile when merging

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix model/connector update API to address security concern (#1595)

* Fix model/connector update API to address appsec concern

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile and build failure

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Improve unit test coverage

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix spotless

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Merge update connector feature flag to remote inference feature flag

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix compile

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix exception status

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Keep fixing exception status

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Spotless fix

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Add UT on parsing exception

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* return parsing exception 400 for parsing errors (#1603)

add more ut in restupdateconnector

Signed-off-by: Xun Zhang <xunzh@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* throttling and quota feature on single node cluster

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix java compile when merging

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Enabling in-place update on multi-node

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Fix confidential rotation in update internal connector

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Signed-off-by: Xun Zhang <xunzh@amazon.com>
Co-authored-by: Xun Zhang <xunzh@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* merge conflict

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* Change rate limiter token capacity setting (#1635)

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* support step size for embedding model which outputs less embeddings (#1586)

* support step size for embedding model which outputs less embeddings

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* tune parameter name

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fine tune processed doc to always respect step size

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* validate step size (#1587)

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

* backport to 2.11 (#1639)

Signed-off-by: xinyual <xinyual@amazon.com>
Signed-off-by: Sicheng Song <sicheng.song@outlook.com>

---------

Signed-off-by: Sicheng Song <sicheng.song@outlook.com>
Signed-off-by: Xun Zhang <xunzh@amazon.com>
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: xinyual <xinyual@amazon.com>
Co-authored-by: Xun Zhang <xunzh@amazon.com>
Co-authored-by: Yaliang Wu <ylwu@amazon.com>
Co-authored-by: xinyual <74362153+xinyual@users.noreply.github.com>
@opensearch-trigger-bot
Copy link
Contributor

The backport to main failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-main main
# Navigate to the new working tree
cd .worktrees/backport-main
# Create a new branch
git switch --create backport/backport-1587-to-main
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 5da2d91cb8b54c37281c15a5f7ee0d533c1cc1a0
# Push it to GitHub
git push --set-upstream origin backport/backport-1587-to-main
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-main

Then, create a pull request where the base branch is main and the compare/head branch is backport/backport-1587-to-main.

rbhavna pushed a commit to rbhavna/ml-commons that referenced this pull request Dec 1, 2023
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
@rbhavna rbhavna mentioned this pull request Dec 1, 2023
5 tasks
rbhavna pushed a commit to rbhavna/ml-commons that referenced this pull request Dec 1, 2023
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
rbhavna pushed a commit to rbhavna/ml-commons that referenced this pull request Dec 1, 2023
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
rbhavna pushed a commit to rbhavna/ml-commons that referenced this pull request Dec 1, 2023
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
ylwu-amzn added a commit that referenced this pull request Dec 1, 2023
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
rbhavna pushed a commit to rbhavna/ml-commons that referenced this pull request Dec 1, 2023
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
@rbhavna rbhavna mentioned this pull request Dec 1, 2023
5 tasks
dhrubo-os pushed a commit that referenced this pull request Dec 1, 2023
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
austintlee pushed a commit to austintlee/ml-commons that referenced this pull request Feb 29, 2024
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants