-
Notifications
You must be signed in to change notification settings - Fork 12
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
Decouple the prompt set type (practice, official) from its file name #801
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2432c54
decouple the file name from the prompt type
rogthefrog 59ebe6e
use new prompt set logic
rogthefrog 2f5a14a
decouple prompt set type and locale from file name
rogthefrog c493db2
use new prompt set logic that decouples the prompt set type and local…
rogthefrog 864861a
noop; formatting
rogthefrog c1abf55
change prompt set key for consistency
rogthefrog a44639a
inject the prompt sets instead of using the global prompt set dict, f…
rogthefrog ad7236b
remove prompt_sets from where it doesn't belong conceptually
rogthefrog File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from modelgauge.secret_values import RequiredSecret, SecretDescription | ||
|
||
|
||
class ModellabFileDownloadToken(RequiredSecret): | ||
@classmethod | ||
def description(cls) -> SecretDescription: | ||
return SecretDescription( | ||
scope="modellab_files", | ||
key="token", | ||
instructions="Please ask MLCommons admin for permission.", | ||
) | ||
|
||
|
||
# file name format: | ||
# {prefix}_{version}_{type}(_{locale})_prompt_set_release | ||
PROMPT_SETS = { | ||
"practice": "airr_official_1.0_practice_prompt_set_release", | ||
"official": "airr_official_1.0_heldback_prompt_set_release", | ||
"practice_fr_fr": "airr_official_1.0_practice_fr_fr_prompt_set_release", | ||
} | ||
PROMPT_SET_DOWNLOAD_HOST = "ailuminate.mlcommons.org" | ||
|
||
|
||
def prompt_set_file_base_name(prompt_set: str, prompt_sets: dict = PROMPT_SETS) -> str: | ||
filename = prompt_sets.get(prompt_set, None) | ||
return filename | ||
|
||
|
||
def validate_prompt_set(prompt_set: str, prompt_sets: dict = PROMPT_SETS) -> bool: | ||
filename = prompt_set_file_base_name(prompt_set, prompt_sets) | ||
if not filename: | ||
raise ValueError(f"Invalid prompt set {prompt_set}. Must be one of {prompt_sets.keys()}.") | ||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import pytest | ||
from modelgauge.prompt_sets import ( | ||
PROMPT_SETS, | ||
prompt_set_file_base_name, | ||
validate_prompt_set, | ||
) # usort: skip | ||
|
||
|
||
def test_file_base_name(): | ||
assert prompt_set_file_base_name("bad") is None | ||
assert prompt_set_file_base_name("practice") == PROMPT_SETS["practice"] | ||
assert prompt_set_file_base_name("practice", PROMPT_SETS) == PROMPT_SETS["practice"] | ||
|
||
|
||
def test_validate_prompt_set(): | ||
for s in PROMPT_SETS.keys(): | ||
assert validate_prompt_set(s, PROMPT_SETS) | ||
with pytest.raises(ValueError): | ||
validate_prompt_set("should raise") |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 this the set of locales that we can run in modelbench?
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.
LOCALES should be runnable in modelbench. PUBLISHED_LOCALES is there to avoid hardcoded exceptions deeper in the code, e.g. the funky exceptions we had to put in to run French practice tests.