Skip to content
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

Simplify config registration #2142

Merged
merged 8 commits into from
Dec 20, 2023
Merged

Conversation

yifanmai
Copy link
Collaborator

  • Ensure that config registration is only performed at entry points
  • Ensure that custom config registration does not get overwritten by default model registration
  • Removed some unused / unnecessary helper methods
  • Cleaned up comments and documentation

@yifanmai yifanmai changed the title Yifanmai/fix simplify register config Simplify config registration Dec 13, 2023
Comment on lines +62 to +65
# Can't send release_dates in ModelMetadata bacause dates cannot be round-tripped to and from JSON easily.
# TODO(#2158): Either fix this or delete get_general_info.
all_models = [dataclasses.replace(model_metadata, release_date=None) for model_metadata in ALL_MODELS_METADATA]
return GeneralInfo(version=VERSION, example_queries=example_queries, all_models=all_models)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually a pre-existing issue that wasn't caught in the test before because the test forgot to register models, so ALL_MODELS_METADATA was empty.

@yifanmai yifanmai requested a review from ruixin31 December 15, 2023 22:07
Copy link
Contributor

@ruixin31 ruixin31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Left some comments

@@ -248,6 +251,9 @@ def main():
args = parser.parse_args()
validate_args(args)

register_configs_from_package()
register_configs_from_directory(args.local_path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any doc that says local-path controls model registration? Current doc says it's for ServerService

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's some pending doc changes in pull request #2065. But in general we need to overhaul a lot of docs to reflect this new user journey. I made a note of this in issue #2167.

@@ -248,6 +251,9 @@ def main():
args = parser.parse_args()
validate_args(args)

register_configs_from_package()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was a bit confused by the name package until I saw the function definition as I thought it takes in a package name. Would it be better to name it as register_configs_from_helm_package or register_builtin_configs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Changed to register_builtin_configs_from_helm_package.

@@ -58,7 +59,10 @@ def __init__(self, base_path: str = "prod_env", root_mode=False, mongo_uri: str
self.toxicity_classifier_client: Optional[ToxicityClassifierClient] = None

def get_general_info(self) -> GeneralInfo:
return GeneralInfo(version=VERSION, example_queries=example_queries, all_models=ALL_MODELS_METADATA)
# Can't send release_dates in ModelMetadata bacause dates cannot be round-tripped to and from JSON easily.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it get serialized as a string?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not easily - the type of release_date is not string, so mypy typechecking will complain.

@yifanmai yifanmai merged commit e8dd921 into main Dec 20, 2023
6 checks passed
@yifanmai yifanmai deleted the yifanmai/fix-simplify-register-config branch December 20, 2023 01:11
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.

2 participants