-
Notifications
You must be signed in to change notification settings - Fork 140
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
Update training validation to be handled per algo type #2462
base: 2.x
Are you sure you want to change the base?
Conversation
Signed-off-by: AnnTian Shao <[email protected]>
This PR is a follow up to another PR #2378. Can I get help with adding the |
Signed-off-by: AnnTian Shao <[email protected]>
c415044
to
9887948
Compare
@@ -182,4 +182,30 @@ protected void validateCompressionConflicts(CompressionLevel originalCompression | |||
throw validationException; | |||
} | |||
} | |||
|
|||
protected void validateMDivisibleByVectorDimension( |
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.
Can we generalize this? M is specific to PQ so shouldnt go in abstract class.
.getParameters() | ||
.get(METHOD_ENCODER_PARAMETER); | ||
|
||
if (knnMethodContext.getMethodComponentContext().getParameters().containsKey(METHOD_PARAMETER_NLIST) |
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.
Is it possible to move specifics into the HNSW and IVF method classes?
|
||
TrainingConfigValidationOutput.TrainingConfigValidationOutputBuilder builder = TrainingConfigValidationOutput.builder(); | ||
|
||
// validate ENCODER_PARAMETER_PQ_M is divisible by vector dimension |
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.
Flat encoder doesnt have M parameter. Only PQ does. So you can just noop on this
|
||
TrainingConfigValidationOutput.TrainingConfigValidationOutputBuilder builder = TrainingConfigValidationOutput.builder(); | ||
|
||
// validate ENCODER_PARAMETER_PQ_M is divisible by vector dimension |
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.
PQ_M is only valid for PQ encoders. You can noop on this.
Signed-off-by: AnnTian Shao <[email protected]>
06ecaf9
to
697953f
Compare
.getParameters() | ||
.get(METHOD_ENCODER_PARAMETER); | ||
|
||
if (knnMethodContext.getMethodComponentContext().getParameters().containsKey(METHOD_PARAMETER_NLIST) |
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.
Can we delegate this to the encoder?
.getParameters() | ||
.get(METHOD_ENCODER_PARAMETER); | ||
|
||
if (knnMethodContext.getMethodComponentContext().getParameters().containsKey(METHOD_PARAMETER_NLIST) |
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.
Same as above
@@ -61,4 +63,10 @@ public CompressionLevel calculateCompressionLevel( | |||
// TODO: Hard code for now | |||
return CompressionLevel.x2; | |||
} | |||
|
|||
@Override | |||
public TrainingConfigValidationOutput validateEncoderConfig(TrainingConfigValidationInput trainingConfigValidationInput) { |
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.
Can you move this to default in Encoder.java? Like https://github.com/opensearch-project/k-NN/blob/main/src/main/java/org/opensearch/knn/index/engine/Encoder.java#L20
|
||
TrainingConfigValidationOutput.TrainingConfigValidationOutputBuilder builder = TrainingConfigValidationOutput.builder(); | ||
|
||
// validate ENCODER_PARAMETER_PQ_M is divisible by vector dimension |
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 dont need this for QFrameEncoder - this should just noop
bac5484
to
1e26bd2
Compare
Signed-off-by: AnnTian Shao <[email protected]>
1e26bd2
to
2cc1523
Compare
Description
This PR is a follow up to another PR #2378. In the other PR we added more detailed error messages to validate training parameters, and this PR builds on those changes by updating the validation to be handled per algo type.
Related Issues
Resolves #2268
Check List
--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.