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

More SUT options in CLI #548

Merged
merged 2 commits into from
Oct 2, 2024
Merged

More SUT options in CLI #548

merged 2 commits into from
Oct 2, 2024

Conversation

bkorycki
Copy link
Contributor

@bkorycki bkorycki commented Oct 2, 2024

run-sut and run-csv-items CLI commands now accept --temp, --max_tokens, --top-p, and --top-k.

@bkorycki bkorycki requested a review from a team as a code owner October 2, 2024 00:34
Copy link

github-actions bot commented Oct 2, 2024

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

elif annotators:
if max_tokens is not None or temp is not None or top_p is not None or top_k is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice catch.

self._validate_file()

def __iter__(self) -> Iterable[PromptWithContext]:
with open(self.path, newline="") as f:
csvreader = csv.DictReader(f)
for row in csvreader:
yield PromptWithContext(
prompt=TextPrompt(text=row["Text"]),
prompt=TextPrompt(text=row["Text"], options=self.sut_options),
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems a little weird to me to have to set this for each prompt given that it's stable across the run, but I guess that's the object model we have for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed

@@ -66,6 +68,33 @@ def test_run_sut_demos(sut):
assert re.search(r"Native response:", result.output)


@patch("modelgauge.suts.demo_01_yes_no_sut.DemoYesNoSUT.translate_text_prompt")
def test_run_sut_with_options(mock_translate_text_prompt):
Copy link
Contributor

Choose a reason for hiding this comment

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

Good stuff. These CLI tests are kind of a pain to write, but I'm glad to see it.

@bkorycki bkorycki merged commit f844c8d into main Oct 2, 2024
4 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants