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

Enable more partitioners specification in more types #2403

Merged
merged 8 commits into from
Oct 12, 2023

Conversation

adam-narozniak
Copy link
Member

@adam-narozniak adam-narozniak commented Sep 21, 2023

Enable specifying partitioners as type Dict[str, Union[Paritioner, int]]

How the library is currently used to create 10 partitions:

fds = FederatedDataset(dataset="mnist", partitioners={"train": 10})

Here are the new ways of specifying partitioners. All of the examples accomplish the same goal:

Dictionary-based object creation with Partitioner(s)

fds = FederatedDataset(dataset="mnist", partitioners={"train": IidPartitioner(num_partitions=10)})

Dictionary-based object creation with ints

fds = FederatedDataset(dataset="mnist", partitioners={"train":10})

Another use case is.
Dictionary-based object creation with mixed types

fds = FederatedDataset(
  dataset="mnist", 
  partitioners={
    "train":10,
    "valid": IidPartitioner(num_partitions=100)
  }
)

datasets/flwr_datasets/federated_dataset.py Outdated Show resolved Hide resolved
datasets/flwr_datasets/federated_dataset_test.py Outdated Show resolved Hide resolved
datasets/flwr_datasets/utils.py Outdated Show resolved Hide resolved
Copy link
Member

@danieljanes danieljanes left a comment

Choose a reason for hiding this comment

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

Lgtm!

@danieljanes danieljanes merged commit 3d75c12 into main Oct 12, 2023
29 checks passed
@danieljanes danieljanes deleted the fds-extend-partitioner-types branch October 12, 2023 11:26
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