Skip to content

Conversation

@Vinay-Vinod
Copy link
Contributor

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

  • 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.

@codecov
Copy link

codecov bot commented Dec 19, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (31ee5dc) 91.47% compared to head (56ecfc6) 91.47%.

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.
📢 Have feedback on the report? Share it here.



@pytest.fixture
def mock_opensearch_client():
Copy link
Contributor

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.

Copy link
Contributor

@rawwar rawwar Dec 21, 2023

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.

Copy link
Collaborator

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.
  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"
  2. In save_as_pt method, 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 in save_as_pt method we'll use that model id. Please let me know if you have any confusion.
  3. 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants