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: add num_records as a parameter to evaluate method #39

Merged
merged 3 commits into from
Oct 17, 2023

Conversation

keerthanvasist
Copy link
Member

@keerthanvasist keerthanvasist commented Oct 17, 2023

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.

@@ -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)
Copy link
Contributor

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,
Copy link
Contributor

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?

Copy link
Member Author

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,
Copy link
Contributor

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.

Copy link
Member Author

@keerthanvasist keerthanvasist Oct 17, 2023

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.

@keerthanvasist
Copy link
Member Author

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
Copy link
Member

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

"""
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")
Copy link
Member

Choose a reason for hiding this comment

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

typo: atleast -> at least

pinaraws
pinaraws previously approved these changes Oct 17, 2023
self,
model: ModelRunner,
dataset_config: Optional[DataConfig] = None,
prompt_template: Optional[str] = None,
save: bool = False,
num_records=100,
Copy link
Contributor

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?

pinaraws
pinaraws previously approved these changes Oct 17, 2023
malhotra18
malhotra18 previously approved these changes Oct 17, 2023
xiaoyi-cheng
xiaoyi-cheng previously approved these changes Oct 17, 2023
pinaraws
pinaraws previously approved these changes Oct 17, 2023
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.

4 participants