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

ArtificialFederatedDataset.from_slices can only handle 1 level of nested tuples #85

Open
grananqvist opened this issue Jul 3, 2024 · 0 comments
Labels
Beginner issue Has a straight-forward solution, good for new contributors

Comments

@grananqvist
Copy link
Member

grananqvist commented Jul 3, 2024

e.g. you might require your raw data to be of format [(Input1, input2, …), (output1, output2, …)] (2 levels of lists/tuples/dict), but ArtificialFederatedDataset.from_slices can only handle 1 level of nested tuples.

This does not work:

import numpy as np
from pfl.data.federated_dataset import ArtificialFederatedDataset
x = np.zeros(6,1)
fd = ArtificialFederatedDataset.from_slices(
data=[(x.copy(), x.copy()), x.copy()],
data_sampler=lambda length: np.random.choice(len(x), length),
sample_dataset_len=lambda: 2)
d = next(fd)

expected return dataset d with d.raw_data shape

[((2,1),(2,1)), (2,1)]
@grananqvist grananqvist added the Beginner issue Has a straight-forward solution, good for new contributors label Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Beginner issue Has a straight-forward solution, good for new contributors
Projects
None yet
Development

No branches or pull requests

1 participant