-
Notifications
You must be signed in to change notification settings - Fork 138
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
Fixes #2317 predict api not working with asymmetric models #2318
Fixes #2317 predict api not working with asymmetric models #2318
Conversation
… models Signed-off-by: br3no <breno@veltefaria.de>
It would be nice to add an integration test for this, but I couldn't find one for the text embeddings I could easily extend. |
May be we can get some idea from here? |
common/src/main/java/org/opensearch/ml/common/input/nlp/TextDocsMLInput.java
Show resolved
Hide resolved
Signed-off-by: br3no <breno@veltefaria.de>
@dhrubo-os this was a very good hint. Testing in the multi-node cluster setup I ran into some very unexpected class not found errors. It turns out all ml-commons/common/src/main/java/org/opensearch/ml/common/MLCommonsClassLoader.java Line 87 in 3cc2fca
This is very obscure and I can't say why the errors only appeared in a multi-node setting. But now it works. Let me know if there is anything else open still. |
Thanks for looking into this. Approved. |
@ylwu-amzn mind having a look? Only one review required to merge this... @dhrubo-os, or maybe there is someone else available? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this!
* Fixes #2317 predict api not working with asymmetric models Signed-off-by: br3no <breno@veltefaria.de> * Adding unit test code path for the parsing of the parameter. Signed-off-by: br3no <breno@veltefaria.de> * Removing involuntary import of guava Signed-off-by: br3no <breno@veltefaria.de> * Refactor package of AsymmetricTextEmbeddingParameters The MLCommonsClassLoader expects all MLAlgoParameters to be in the "org.opensearch.ml.common.input.parameter" package. Signed-off-by: br3no <breno@veltefaria.de> * fixing unit test after package refactoring Signed-off-by: br3no <breno@veltefaria.de> --------- Signed-off-by: br3no <breno@veltefaria.de> (cherry picked from commit 8425a65)
…2359) * Fixes #2317 predict api not working with asymmetric models Signed-off-by: br3no <breno@veltefaria.de> * Adding unit test code path for the parsing of the parameter. Signed-off-by: br3no <breno@veltefaria.de> * Removing involuntary import of guava Signed-off-by: br3no <breno@veltefaria.de> * Refactor package of AsymmetricTextEmbeddingParameters The MLCommonsClassLoader expects all MLAlgoParameters to be in the "org.opensearch.ml.common.input.parameter" package. Signed-off-by: br3no <breno@veltefaria.de> * fixing unit test after package refactoring Signed-off-by: br3no <breno@veltefaria.de> --------- Signed-off-by: br3no <breno@veltefaria.de> (cherry picked from commit 8425a65) Co-authored-by: Breno Faria <breno@veltefaria.de>
… models (opensearch-project#2318) (opensearch-project#2359) * Fixes opensearch-project#2317 predict api not working with asymmetric models Signed-off-by: br3no <breno@veltefaria.de> * Adding unit test code path for the parsing of the parameter. Signed-off-by: br3no <breno@veltefaria.de> * Removing involuntary import of guava Signed-off-by: br3no <breno@veltefaria.de> * Refactor package of AsymmetricTextEmbeddingParameters The MLCommonsClassLoader expects all MLAlgoParameters to be in the "org.opensearch.ml.common.input.parameter" package. Signed-off-by: br3no <breno@veltefaria.de> * fixing unit test after package refactoring Signed-off-by: br3no <breno@veltefaria.de> --------- Signed-off-by: br3no <breno@veltefaria.de> (cherry picked from commit 8425a65) Co-authored-by: Breno Faria <breno@veltefaria.de>
Description
When using the
_predict
API for text embeddings, the instantiation of theMLInput
object happens via the MLCommonsClassLoader here:ml-commons/common/src/main/java/org/opensearch/ml/common/input/MLInput.java
Line 214 in 79b9dfd
The reflection logic ends up calling the constructor of
TextDocsMLInput
, which does not parse any parameters that might be contained in theXContentParser
, though. This causes the error reported in #2317. This PR adds a case to the parsing logic to make sure the parameters are parsed. It replicates the behavior of theMLInput
parse
method:ml-commons/common/src/main/java/org/opensearch/ml/common/input/MLInput.java
Line 239 in 79b9dfd
Issues Resolved
#2317
Check List
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.