Skip to content

Commit

Permalink
Merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
chongshenng committed Jul 25, 2024
2 parents da9518b + fb744a2 commit 66fde74
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
30 changes: 30 additions & 0 deletions datasets/doc/source/tutorial-quickstart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,36 @@
"dataloader = DataLoader(partition_torch, batch_size=64)"
]
},
{
"cell_type": "markdown",
"id": "b93678a5",
"metadata": {},
"source": "The `Dataloader` created this way does not return a `Tuple` when iterating over it but a `Dict` with the names of the columns as keys and features as values. Look below for an example."
},
{
"cell_type": "code",
"execution_count": null,
"id": "5edd3ce2",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Return type when iterating over dataloader: <class 'dict'>\n",
"torch.Size([64, 3, 32, 32])\n",
"torch.Size([64])\n"
]
}
],
"source": [
"for batch in dataloader:\n",
" print(f\"Return type when iterating over a dataloader: {type(batch)}\")\n",
" print(batch[\"img\"].shape)\n",
" print(batch[\"label\"].shape)\n",
" break"
]
},
{
"cell_type": "markdown",
"id": "71531613",
Expand Down
8 changes: 5 additions & 3 deletions datasets/flwr_datasets/federated_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ class FederatedDataset:
no operation is applied.
partitioners : Dict[str, Union[Partitioner, int]]
A dictionary mapping the Dataset split (a `str`) to a `Partitioner` or an `int`
(representing the number of IID partitions that this split should be partitioned
into). One or multiple `Partitioner` objects can be specified in that manner,
but at most, one per split.
(representing the number of IID partitions that this split should be
partitioned into, i.e., using the default partitioner
`IidPartitioner <https://flower.ai/docs/datasets/ref-api/flwr_
datasets.partitioner.IidPartitioner.html>`_). One or multiple `Partitioner`
objects can be specified in that manner, but at most, one per split.
shuffle : bool
Whether to randomize the order of samples. Applied prior to preprocessing
operations, speratelly to each of the present splits in the dataset. It uses
Expand Down

0 comments on commit 66fde74

Please sign in to comment.