p2pfl.learning.frameworks.tensorflow.keras_dataset moduleΒΆ

Keras dataset export strategy.

class p2pfl.learning.frameworks.tensorflow.keras_dataset.KerasExportStrategy[source]ΒΆ

Bases: DataExportStrategy

Export strategy for TensorFlow/Keras datasets.

static export(data, batch_size=None, columns=None, label_cols=None, **kwargs)[source]ΒΆ

Export the data as a TensorFlow Dataset.

Parameters:
  • data (Dataset) – The Hugging Face Dataset to export. Transforms should already be applied to the dataset via set_transform.

  • batch_size (Optional[int]) – The batch size for the TensorFlow Dataset.

  • seed – The seed for the TensorFlow Dataset.

  • columns (Optional[List[str]]) – The columns to include in the TensorFlow Dataset.

  • label_cols (Optional[List[str]]) – The columns to use as labels.

  • **kwargs – Additional keyword arguments.

Return type:

DatasetV2

Returns:

A TensorFlow Dataset.