I am building a federated dataset from a single csv file. I have followed this earlier question How to create federated dataset from a CSV file? While running tff.simulation.datasets.ClientData.from_clients_and_fn:
train_data = tff.simulation.datasets.ClientData.from_clients_and_fn(
client_ids=train_client_ids,
create_tf_dataset_for_client_fn=create_tf_dataset_for_client_fn
)
test_data = tff.simulation.datasets.ClientData.from_clients_and_fn(
client_ids=test_client_ids,
create_tf_dataset_for_client_fn=create_tf_dataset_for_client_fn
)
I am getting error: AttributeError: type object 'ClientData' has no attribute 'from_clients_and_fn'
CodePudding user response:
from_clients_and_fn
has been changed in the updated documentation as can be seen here: https://www.tensorflow.org/federated/api_docs/python/tff/simulation/datasets/ClientData
The solution is to change for both train_data
and test_data
:
from_clients_and_fn
tofrom_clients_and_tf_fn
- The parameter
create_tf_dataset_for_client_fn
toserializable_dataset_fn