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

add more pooling method and refactor #672

Merged
merged 2 commits into from
Jan 9, 2023

Conversation

ylwu-amzn
Copy link
Collaborator

Signed-off-by: Yaliang Wu [email protected]

Description

  1. Add more pooling method
  2. Refactor to align with DJL code: change poolingMethod to poolingMode, use string in translator.

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.

@ylwu-amzn ylwu-amzn requested a review from a team January 9, 2023 18:16
rbhavna
rbhavna previously approved these changes Jan 9, 2023
Comment on lines +214 to +218
if (!"mean".equals(poolingMode)
&& !"max".equals(poolingMode)
&& !"cls".equals(poolingMode)
&& !"mean_sqrt_len".equals(poolingMode)
&& !"weightedmean".equals(poolingMode)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about using !EnumSet.allOf(PoolingMethod.class).contains(poolingMode);?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is to keep consistent with DJL code. When DJL team release this translator in future, we will delete this class and use DJL text embedding translator class which doesn't have PoolingMethod enum.

jngz-es
jngz-es previously approved these changes Jan 9, 2023
@ylwu-amzn ylwu-amzn dismissed stale reviews from jngz-es and rbhavna via 25a0d07 January 9, 2023 19:51
@codecov-commenter
Copy link

Codecov Report

Merging #672 (25a0d07) into 2.x (0b643dd) will decrease coverage by 0.24%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##                2.x     #672      +/-   ##
============================================
- Coverage     83.46%   83.22%   -0.25%     
+ Complexity      996      992       -4     
============================================
  Files            93       93              
  Lines          3660     3660              
  Branches        342      342              
============================================
- Hits           3055     3046       -9     
- Misses          460      467       +7     
- Partials        145      147       +2     
Flag Coverage Δ
ml-commons 83.22% <ø> (-0.25%) ⬇️

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

Impacted Files Coverage Δ
...ain/java/org/opensearch/ml/model/MLModelCache.java 86.36% <ø> (ø)
...arch/ml/cluster/MLCommonsClusterEventListener.java 76.19% <0.00%> (-14.29%) ⬇️
.../cluster/MLCommonsClusterManagerEventListener.java 65.62% <0.00%> (-12.50%) ⬇️
...n/java/org/opensearch/ml/model/MLModelManager.java 77.65% <0.00%> (-0.55%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@ylwu-amzn ylwu-amzn merged commit d7f3c86 into opensearch-project:2.x Jan 9, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 9, 2023
* add more pooling method and refactor

Signed-off-by: Yaliang Wu <[email protected]>

* rename poolingMethod to poolingMode

Signed-off-by: Yaliang Wu <[email protected]>

Signed-off-by: Yaliang Wu <[email protected]>
(cherry picked from commit d7f3c86)
ylwu-amzn added a commit that referenced this pull request Jan 9, 2023
* add more pooling method and refactor

Signed-off-by: Yaliang Wu <[email protected]>

* rename poolingMethod to poolingMode

Signed-off-by: Yaliang Wu <[email protected]>

Signed-off-by: Yaliang Wu <[email protected]>
(cherry picked from commit d7f3c86)

Co-authored-by: Yaliang Wu <[email protected]>
@b4sjoo b4sjoo added the enhancement New feature or request label Jan 10, 2023
ylwu-amzn added a commit to ylwu-amzn/ml-commons that referenced this pull request Feb 17, 2023
* add more pooling method and refactor

Signed-off-by: Yaliang Wu <[email protected]>

* rename poolingMethod to poolingMode

Signed-off-by: Yaliang Wu <[email protected]>

Signed-off-by: Yaliang Wu <[email protected]>
ylwu-amzn added a commit to ylwu-amzn/ml-commons that referenced this pull request Mar 2, 2023
* add more pooling method and refactor

Signed-off-by: Yaliang Wu <[email protected]>

* rename poolingMethod to poolingMode

Signed-off-by: Yaliang Wu <[email protected]>

Signed-off-by: Yaliang Wu <[email protected]>
ylwu-amzn added a commit that referenced this pull request Mar 2, 2023
* add more pooling method and refactor



* rename poolingMethod to poolingMode

Signed-off-by: Yaliang Wu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.5 enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants