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

Ks/refactor scoring endpoint #204

Merged
merged 12 commits into from
Nov 22, 2023
Merged

Ks/refactor scoring endpoint #204

merged 12 commits into from
Nov 22, 2023

Conversation

shehadak
Copy link
Collaborator

This PR separates the functionality of the language submission endpoint into two separate methods: run_score, which calls the core scoring endpoint on every model/benchmark pair provided, and get_models_and_benchmarks which provides a list of model/benchmark pairs for scoring given a list of new models and new benchmarks. Previously, both functionalities were included in the run_score method. However, motivated by the need to run scoring jobs on multiple nodes in an HPC instead of in a single job, this PR enables scripts to separately identify the list of model/benchmark pairs and run calls to the core scoring endpoint.

This PR is complementary to brain-score/core#40

A note on backward compatibility: While this PR modifies run_scoring into two separate methods, the default functionality is still the same. In particular, if a user does not specify --fn=get_models_and_benchmarks, the run_scoring method will be called, which is the expected functionality prior to this PR.

A note on pyproject.toml: The commit aa21570 is for debugging purposes and will be reverted before merging.

brainscore_language/submission/endpoints.py Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
@shehadak shehadak force-pushed the ks/refactor_scoring_endpoint branch 2 times, most recently from f0098de to 46bf7fd Compare November 11, 2023 05:36
@@ -41,11 +51,20 @@ def send_email_to_submitter(uid: int, domain: str, pr_number: str,

if __name__ == '__main__':
parser = make_argparser()
parser.add_argument('--fn', type=str, nargs='?', default='run_scoring',
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 a reason to add this here instead of including it directly in make_argparser()?

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, especially since the same functionality will apply to other domains. I moved to make_argparser in Core 12fcfbc and removed it from Language in 6cfd50c.

Comment on lines 36 to 43
def resolve_models_benchmarks(args_dict: Dict[str, Union[str, List]]):
benchmarks, models = retrieve_models_and_benchmarks(args_dict)

run_scoring_endpoint(domain="language", jenkins_id=args_dict["jenkins_id"],
models=models, benchmarks=benchmarks, user_id=args_dict["user_id"],
model_type="artificialsubject", public=args_dict["public"],
competition=args_dict["competition"])

model_ids = resolve_models(domain="language", models=models)
benchmark_ids = resolve_benchmarks(domain="language", benchmarks=benchmarks)
print("BS_NEW_MODELS=" + " ".join(model_ids))
print("BS_NEW_BENCHMARKS=" + " ".join(benchmark_ids))
return model_ids, benchmark_ids
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest moving resolve_models_benchmarks() to core

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree. I moved it to Core in 6eb46a4 and removed it from Language in d05eaf2.

@shehadak shehadak merged commit 78766a6 into main Nov 22, 2023
3 checks passed
@shehadak shehadak deleted the ks/refactor_scoring_endpoint branch November 28, 2023 13:27
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