-
Notifications
You must be signed in to change notification settings - Fork 263
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
Conversation
yifanmai
commented
Dec 13, 2023
- 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
# 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) |
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.
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.
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.
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) |
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 there any doc that says local-path
controls model registration? Current doc says it's for ServerService
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.
src/helm/benchmark/run.py
Outdated
@@ -248,6 +251,9 @@ def main(): | |||
args = parser.parse_args() | |||
validate_args(args) | |||
|
|||
register_configs_from_package() |
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 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
?
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.
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. |
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 it get serialized as a string?
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.
Not easily - the type of release_date
is not string, so mypy typechecking will complain.