-
Notifications
You must be signed in to change notification settings - Fork 45
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: add num_records as a parameter to evaluate method #39
Conversation
@@ -27,6 +27,8 @@ def get_dataset(config: DataConfig) -> ray.data.Dataset: | |||
data_loader_config = _get_data_loader_config(data_source, config) | |||
data_loader = _get_data_loader(config.dataset_mime_type) | |||
data = data_loader.load_dataset(data_loader_config).materialize() | |||
if num_records: # pragma: no branch | |||
data = data.random_sample(num_records/data.count(), seed=1234) |
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.
- please define this seed as a constant
- Update docstring too
@@ -107,6 +106,7 @@ def evaluate( | |||
dataset_config: Optional[DataConfig] = None, | |||
prompt_template: Optional[str] = None, | |||
save: bool = False, | |||
num_records=100, |
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.
we decided to have algorithm specific default num_records, right? 100 is too low a number for default. Did we check with science team on this?
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.
I didn't have defaults from then, and didn't want to wait - I need this test.
But, now that we have it, I will update it.
self, | ||
model: ModelRunner, | ||
model: ModelRunner = None, |
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.
why is None
as a default for this needed? That is an invalid use case for this eval algo.
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.
I think this happened by an automatic refactor. Will update. Good catch.
Created this issue in Ray repository |
@@ -27,6 +27,8 @@ def get_dataset(config: DataConfig) -> ray.data.Dataset: | |||
data_loader_config = _get_data_loader_config(data_source, config) | |||
data_loader = _get_data_loader(config.dataset_mime_type) | |||
data = data_loader.load_dataset(data_loader_config).materialize() | |||
if num_records: # pragma: no branch |
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.
add a check for -1
63be5de
to
dbc20eb
Compare
""" | ||
with timed_block(f"Loading dataset {config.dataset_name}", logger): | ||
data_source = get_data_source(config.dataset_uri) | ||
data_loader_config = _get_data_loader_config(data_source, config) | ||
data_loader = _get_data_loader(config.dataset_mime_type) | ||
data = data_loader.load_dataset(data_loader_config).materialize() | ||
count = data.count() | ||
util.require(count > 0, "Data has to have atleast one record") |
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.
typo: atleast -> at least
self, | ||
model: ModelRunner, | ||
dataset_config: Optional[DataConfig] = None, | ||
prompt_template: Optional[str] = None, | ||
save: bool = False, | ||
num_records=100, |
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.
Note: Merged SemanticRobustness sum accuracy, could you please include this in that too?
6dd5099
Description of changes:
Add num_records as a parameter to evaluate method.
However, a concerning finding of this PR is that Ray's
random_sample
produces non-deterministic results even after setting seed parameter.Update:
The sampling is now deterministic. We are using
Dataset.from_pandas(Dataset.to_pandas().sample())
to use pandas's sampling ability to get a deterministic sampling. This is a temporary workaround till Ray's issue is fixed.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.