- 
                Notifications
    You must be signed in to change notification settings 
- Fork 70
Bug fix for: Only require model_id once to save a modelreq #361
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Vinay Vinod <[email protected]>
Signed-off-by: Vinay Vinod <[email protected]>
Signed-off-by: Vinay Vinod <[email protected]>
Signed-off-by: Vinay Vinod <[email protected]>
Signed-off-by: Vinay Vinod <[email protected]>
Signed-off-by: Vinay Vinod <[email protected]>
| Codecov ReportAll modified and coverable lines are covered by tests ✅ 
 Additional details and impacted files@@           Coverage Diff           @@
##             main     #361   +/-   ##
=======================================
  Coverage   91.47%   91.47%           
=======================================
  Files          41       41           
  Lines        4365     4365           
=======================================
  Hits         3993     3993           
  Misses        372      372           ☔ View full report in Codecov by Sentry. | 
|  | ||
|  | ||
| @pytest.fixture | ||
| def mock_opensearch_client(): | 
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 might not want to mock Opensearch client. Tests we are running are integration tests. Hence, mocking might not be useful.
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.
Seems like I am wrong. In this case, we can just mock the client.
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.
@Vinay-Vinod Thanks for raising the PR. Could you please make sure if this PR addresses all these:
What solution would you like?
I would like to EITHER 1/ only provide the model_id when I instantiate the SentenceTransformerModel and it gets used in all class methods where applicable, rather than randomly defaulting back to "distilbert-tas-b" OR 2/ use save_as_pt as a static method and never instantiate the class at all. Also it would be nice if I could specify the output location of make_model_config_json.
- only provide the model_id when I instantiate the SentenceTransformerModel and it gets used in all class methods where applicable, rather than randomly defaulting back to "distilbert-tas-b"
- In save_as_ptmethod, if no other model id is given as function parameter, it will use the model id which was initialized with SentenceTransformerModel class. If still a model is given as a parameter then insave_as_ptmethod we'll use that model id. Please let me know if you have any confusion.
- it would be nice if I could specify the output location of make_model_config_json --> Can we take care of this one too? Or are you planning to raise another PR for this?
Description
In this pull request, I implemented a bug fix in opensearch_py_ml/ml_models/sentencetransformermodel.py to ensure that model_id is only required once for saving a model. Comprehensive tests were added in tests/ml_commons/test_ml_commons_client.py and tests/ml_models/test_sentencetransformermodel_pytest.py to validate the functionality.
Issues Resolved
#323
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.