Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
asymmetric embeddings #2123
asymmetric embeddings #2123
Changes from 3 commits
5472f2d
dd539bb
10ffb1f
f4eaa27
276ede8
2a83cce
247a1c7
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 130 in common/src/main/java/org/opensearch/ml/common/input/nlp/TextDocsMLInput.java
Codecov / codecov/patch
common/src/main/java/org/opensearch/ml/common/input/nlp/TextDocsMLInput.java#L129-L130
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.
Why not add a check function here to ensure at least one of the new parameters is not Null? It looks like this check can avoid problems later in loading the asymmetric model.
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.
TextEmbeddingModelConfig
is used for both asymmetric and symmetric models. Symmetric models don't have prefixes. The alternative would be to create a newTextEmbeddingModelConfig
class for asymmetric models. I don't think this would be a cleaner solution, tbh.Check warning on line 115 in common/src/main/java/org/opensearch/ml/common/model/TextEmbeddingModelConfig.java
Codecov / codecov/patch
common/src/main/java/org/opensearch/ml/common/model/TextEmbeddingModelConfig.java#L114-L115
Check warning on line 118 in common/src/main/java/org/opensearch/ml/common/model/TextEmbeddingModelConfig.java
Codecov / codecov/patch
common/src/main/java/org/opensearch/ml/common/model/TextEmbeddingModelConfig.java#L117-L118
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.
We can focus more on the feature itself in this PR. But later when we release this in new version. We should add version check. @b4sjoo Can you help when release new version.
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.
Both
queryPrefix
andpassagePrefix
are optional, so this shouldn't break compatibility. Are you sure there is need for a version check?Check warning on line 189 in common/src/main/java/org/opensearch/ml/common/model/TextEmbeddingModelConfig.java
Codecov / codecov/patch
common/src/main/java/org/opensearch/ml/common/model/TextEmbeddingModelConfig.java#L189
Check warning on line 192 in common/src/main/java/org/opensearch/ml/common/model/TextEmbeddingModelConfig.java
Codecov / codecov/patch
common/src/main/java/org/opensearch/ml/common/model/TextEmbeddingModelConfig.java#L192
Check warning on line 140 in ml-algorithms/src/main/java/org/opensearch/ml/engine/ModelHelper.java
Codecov / codecov/patch
ml-algorithms/src/main/java/org/opensearch/ml/engine/ModelHelper.java#L139-L140
Check warning on line 143 in ml-algorithms/src/main/java/org/opensearch/ml/engine/ModelHelper.java
Codecov / codecov/patch
ml-algorithms/src/main/java/org/opensearch/ml/engine/ModelHelper.java#L142-L143
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.
Will it cause any problem if remove this checking ?
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.
I'm not sure, tbh. I don't understand fully how the
MLAlgoParams
are instantiated and used throughout the code base. I just wanted to be sure the failure case is covered, in case it does happen.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.
This error message seems telling user to input a boolean to define it's query or passage, I think you mean user should input either
query_prefix
orpassage_prefix
?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.
I changed the error message to be clearer. What do you think?
Please note, that the parameter is not
query_prefix
orpassage_prefix
but ratherQUERY
orPARAMETER
. The prefixes are defined on model registration, not usage.Check warning on line 92 in ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/TextEmbeddingModel.java
Codecov / codecov/patch
ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/TextEmbeddingModel.java#L92
Check warning on line 42 in ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java
Codecov / codecov/patch
ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java#L42
Check warning on line 52 in ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java
Codecov / codecov/patch
ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java#L50-L52
Check warning on line 55 in ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java
Codecov / codecov/patch
ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java#L55
Check warning on line 57 in ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java
Codecov / codecov/patch
ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java#L57
Check warning on line 60 in ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java
Codecov / codecov/patch
ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java#L59-L60
Check warning on line 66 in ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java
Codecov / codecov/patch
ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java#L64-L66
Check warning on line 68 in ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java
Codecov / codecov/patch
ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java#L68
Check warning on line 72 in ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java
Codecov / codecov/patch
ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java#L71-L72
Check warning on line 82 in ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java
Codecov / codecov/patch
ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java#L82
Check warning on line 87 in ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java
Codecov / codecov/patch
ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java#L87
Check warning on line 93 in ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java
Codecov / codecov/patch
ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java#L92-L93
Check warning on line 97 in ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java
Codecov / codecov/patch
ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java#L97
Check warning on line 99 in ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java
Codecov / codecov/patch
ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java#L99
Check warning on line 102 in ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java
Codecov / codecov/patch
ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/text_embedding/AsymmetricTextEmbeddingParameters.java#L101-L102