-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
50179e2
to
32db613
Compare
substrafl/evaluation_strategy.py
Outdated
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") |
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.
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") |
substrafl/evaluation_strategy.py
Outdated
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") |
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.
Nitpick: isn't type(self._eval_rounds)
always going to be list
? Maybe we could have a more helpful error message:
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
)
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.
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>
a67046f
to
0c58b3b
Compare
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 issueSummary
Notes
Please check if the PR fulfills these requirements