tensorflow-federated

TFF: How define tff.simulation.ClientData.from_clients_and_fn Function?

拥有回忆 提交于 2021-02-05 08:31:27
问题 In the federated learning context, One such classmethod that should work would be tff.simulation.ClientData.from_clients_and_fn. Here, if I pass a list of client_ids and a function which returns the appropriate dataset when given a client id, you will have your hands on a fully functional ClientData. I think here, an approach for defining the function I may use is to construct a Python dict which maps client IDs to tf.data.Dataset objects--you could then define a function which takes a client

TFF: How define tff.simulation.ClientData.from_clients_and_fn Function?

十年热恋 提交于 2021-02-05 08:29:05
问题 In the federated learning context, One such classmethod that should work would be tff.simulation.ClientData.from_clients_and_fn. Here, if I pass a list of client_ids and a function which returns the appropriate dataset when given a client id, you will have your hands on a fully functional ClientData. I think here, an approach for defining the function I may use is to construct a Python dict which maps client IDs to tf.data.Dataset objects--you could then define a function which takes a client

Collecting the weights returned by clients without aggregating them

社会主义新天地 提交于 2021-01-28 11:28:47
问题 I would like to know the easiest way to create a model, broadcast it with tensorflow federated, run a cycle and collect the weights returned by clients without aggregating them with the fedavg. 回答1: TFF provides the tff.federated_collect intrinsic for this purpose; it materializes a stream of client data at the server. One easy way to wire this into the guts of a mostly-existing federated procedure would be to fork simple_fedavg, which I think is a reasonable starting point for working with

How to initialize the model with certain weights?

让人想犯罪 __ 提交于 2021-01-28 11:22:27
问题 I am using the example "stateful_clients" in tensorflow-federated examples. I want to use my pretrained model weights to initialize the model. I use the function model.load_weights(init_weight) . But it seems that it doesn't work. The validation accuracy in the first round is still low. How can I solve the problem? def tff_model_fn(): """Constructs a fully initialized model for use in federated averaging.""" keras_model = get_five_layers_cnn([28, 28, 1]) keras_model.load_weights(init_weight)

Expected a callable, found non-callable tensorflow_federated.python.learning.model_utils.EnhancedTrainableModel

寵の児 提交于 2021-01-28 08:38:47
问题 Unable to use TFF's build_federated_averaging_process(). Followed the tutorial from the TFF federated documentation. Here's my model code: X_train = <valuex> Y_train = <valuey> def model_fn(): model = tf.keras.models.Sequential([ tf.keras.layers.Conv1D(32,dtype="float64",kernel_size=3,padding='same',activation=tf.nn.relu,input_shape=(X_train.shape[1], X_train.shape[2])), tf.keras.layers.MaxPooling1D(pool_size=3), tf.keras.layers.Conv1D(64,kernel_size=3,padding='same',activation=tf.nn.relu),

TensorFlow Federated: How can I write an Input Spec for a model with more than one input

泄露秘密 提交于 2020-12-12 11:05:00
问题 I'm trying to make an image captioning model using the federated learning library provided by tensorflow, but I'm stuck at this error Input 0 of layer dense is incompatible with the layer: : expected min_ndim=2, found ndim=1. this is my input_spec: input_spec=collections.OrderedDict(x=(tf.TensorSpec(shape=(2048,), dtype=tf.float32), tf.TensorSpec(shape=(34,), dtype=tf.int32)), y=tf.TensorSpec(shape=(None), dtype=tf.int32)) The model takes image features as the first input and a list of

TensorFlow Federated: How can I write an Input Spec for a model with more than one input

廉价感情. 提交于 2020-12-12 11:04:28
问题 I'm trying to make an image captioning model using the federated learning library provided by tensorflow, but I'm stuck at this error Input 0 of layer dense is incompatible with the layer: : expected min_ndim=2, found ndim=1. this is my input_spec: input_spec=collections.OrderedDict(x=(tf.TensorSpec(shape=(2048,), dtype=tf.float32), tf.TensorSpec(shape=(34,), dtype=tf.int32)), y=tf.TensorSpec(shape=(None), dtype=tf.int32)) The model takes image features as the first input and a list of

Is Tensorflow Federated-Learning only for simulating federated learning on one machine?

我只是一个虾纸丫 提交于 2020-12-06 04:17:22
问题 I read multiple guides on https://www.tensorflow.org/federated/federated_learning e.g. the image classification or text generation example. From what I have read I can not see how to use tensorflow federated-learning (tff) for a real world application: datasets on multiple hardware clients. It all looks like its meant only for simulating federated learning. I want to use tff on multiple machines and not simulate it on only one. I would appreciate it when someone knows if it's even possible

Is Tensorflow Federated-Learning only for simulating federated learning on one machine?

て烟熏妆下的殇ゞ 提交于 2020-12-06 04:16:08
问题 I read multiple guides on https://www.tensorflow.org/federated/federated_learning e.g. the image classification or text generation example. From what I have read I can not see how to use tensorflow federated-learning (tff) for a real world application: datasets on multiple hardware clients. It all looks like its meant only for simulating federated learning. I want to use tff on multiple machines and not simulate it on only one. I would appreciate it when someone knows if it's even possible