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

feat!: clarify eval strategy arguments #85

Merged
merged 5 commits into from
Feb 10, 2023
Merged

Conversation

ThibaultFy
Copy link
Member

@ThibaultFy ThibaultFy commented Feb 6, 2023

Signed-off-by: ThibaultFy 50656860+ThibaultFy@users.noreply.github.com

Related issue

https://app.asana.com/0/1203124674173179/1203493303699138/f
# followed by the number of the issue

Summary

Notes

Please check if the PR fulfills these requirements

  • If the feature has an impact on the user experience, the changelog has been updated
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • The commit message follows the conventional commit specification

@ThibaultFy ThibaultFy changed the title feat!: simplify eval strategy arguments feat!: clarify eval strategy arguments Feb 7, 2023
@ThibaultFy ThibaultFy marked this pull request as ready for review February 7, 2023 08:56
@ThibaultFy ThibaultFy requested a review from a team as a code owner February 7, 2023 08:56
if not isinstance(rounds, (list, int)):
raise TypeError(f"rounds must be of type list of ints or an int, {type(rounds)} found")
if eval_frequency is None and eval_rounds is None:
raise ValueError("At least one of eval_frequency or eval_rounds must be define")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
raise ValueError("At least one of eval_frequency or eval_rounds must be define")
raise ValueError("At least one of eval_frequency or eval_rounds must be defined")

Comment on lines 184 to 185
elif not all(isinstance(r, int) for r in self._eval_rounds):
raise TypeError(f"eval_rounds must be of type list of ints, {type(self._eval_rounds)} found")
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: isn't type(self._eval_rounds) always going to be list? Maybe we could have a more helpful error message:

Suggested change
elif not all(isinstance(r, int) for r in self._eval_rounds):
raise TypeError(f"eval_rounds must be of type list of ints, {type(self._eval_rounds)} found")
elif not all(isinstance(r, int) for r in self._eval_rounds):
raise TypeError(f"eval_rounds must be of type list of ints, {next(type(x) for x in self._eval_rounds if not isinstance(x, int))} found")

(by the way, maybe we could test for collections.abc.Iterable rather than just list)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the catch, I agree :)
I print all the list in case there is more than one element with the wrong type :) .

Signed-off-by: ThibaultFy <50656860+ThibaultFy@users.noreply.github.com>
Signed-off-by: ThibaultFy <50656860+ThibaultFy@users.noreply.github.com>
Signed-off-by: ThibaultFy <50656860+ThibaultFy@users.noreply.github.com>
Signed-off-by: ThibaultFy <50656860+ThibaultFy@users.noreply.github.com>
Signed-off-by: ThibaultFy <50656860+ThibaultFy@users.noreply.github.com>
@ThibaultFy ThibaultFy merged commit 2cf8fbc into main Feb 10, 2023
@ThibaultFy ThibaultFy deleted the clarify-eval-strat branch February 10, 2023 17:06
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