Questions tagged [tensorflow-federated]

Federated Learning is a machine learning setting where the goal is to train a high-quality centralized model with training data distributed over a large number of clients each with unreliable and relatively slow network connections. https://research.google/pubs/pub49232/

tensorflow-federated
Filter by
Sorted by
Tagged with
6 votes
3 answers
4k views

How to create federated dataset from a CSV file?

I have selected this dataset: https://www.kaggle.com/karangadiya/fifa19 Now, I would like to convert this CSV file into the federated dataset to fit in the model. Tensorflow provided tutorials on ...
Mahedi Hasan Jisan's user avatar
3 votes
1 answer
332 views

Is there a way for TFF clients to have internal states?

The code in the TFF tutorials and in the research projects I see generally only keep track of server states. I’d like there to be internal client states (for instance, additional client internal ...
Charlie Hou's user avatar
1 vote
1 answer
2k views

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

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 ...
Eliza's user avatar
  • 584
4 votes
1 answer
572 views

Implement data generator in federated training

(I have posted the question on https://github.com/tensorflow/federated/issues/793 and maybe also here!) I have customized my own data and model to federated interfaces and the training converged. But ...
miaoz18's user avatar
  • 41
3 votes
1 answer
1k views

Model performance not improving during federated learning training

I have followed this emnist tutorial to create an image classification experiment (7 classes) with the aim of training a classifier on 3 silos of data with the TFF framework. Before training begins, ...
cian's user avatar
  • 51
2 votes
1 answer
694 views

TFF loading a pre-trained Keras model

My goal is to load a base model from a .hdf5 file (it's a Keras model), and continue to train it with federated learning. Here is how I initialize the base model for FL: def model_fn(): model = ...
JVS's user avatar
  • 25
2 votes
1 answer
1k views

Federated learning : convert my own image dataset into tff simulation Clientdata

here is the code of my federated learning test from __future__ import absolute_import, division, print_function import os import collections import warnings from six.moves import range import numpy ...
Eliza's user avatar
  • 584
2 votes
1 answer
321 views

What is the recommended way to mix TensorFlow and TensorFlow Federated code?

TensorFlow (TF) and TensorFlow Federated (TFF) are different layers of functionality that are designed to play well together (as the names implie). Still, they are different things designed to solve ...
Stefano Mazzocchi's user avatar
2 votes
1 answer
288 views

TFF: train_test_client_split to partition each client data

I am building a federated learning model. I have written the code below, but I keep getting the error, which is also not true please let me know how to use the function train_test_client_split ...
Eden's user avatar
  • 325
2 votes
1 answer
458 views

TypeError when importing tensorflow_federated

I've been trying to import TensorFlow_federated but have stumbled across an error. After extensively searching the Internet I am yet to find anyone who has encountered the same: import collections ...
Sully Marshall's user avatar
1 vote
2 answers
398 views

how to print local outputs in tensorflow federated?

I want to print local outputs of clients in the tensorflow federated tutorial https://www.tensorflow.org/federated/tutorials/federated_learning_for_image_classification. What should I do?
ester's user avatar
  • 11
1 vote
1 answer
678 views

How to initialize the model with certain weights?

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(...
Stone_leaves's user avatar
1 vote
2 answers
2k views

Tensorflow Federated tutorial in Google Colab giving errors in the initialization code snippet

Here is the cell that needs to be run before starting the tutorial. #@test {"skip": true} # tensorflow_federated_nightly also bring in tf_nightly, which # can causes a duplicate tensorboard ...
Bakasur279's user avatar
1 vote
1 answer
2k views

'tensorflow_federated.python.simulation' has no attribute 'FromTensorSlicesClientData' when using tff-nightly

I was using tff.simulation.FromTensorSlicesClientData(client_train_dataset) to create client's data with the stable version of tff, and it was working fine. I had to switch to tff-nightly, and now ...
leosole's user avatar
  • 331
8 votes
2 answers
3k views

Create a custom federated data set in TensorFlow Federated

I'd like to adapt the recurrent autoencoder from this blog post to work in a federated environment. I've modified the model slightly to conform with the example shown in the TFF image classification ...
Adam Hodgson's user avatar
5 votes
1 answer
1k views

Tensorflow Federated | tff.learning.from_keras_model() with a model with DenseFeature layer and multiple inputs

I am trying to federate a keras model which has multiple inputs. These some of these inputs are categorical and some of them are numerical, so I have some DenseFeature layers to embed the values. The ...
Alex 's user avatar
  • 245
4 votes
1 answer
343 views

Build Custom Federated averaging process with ValueError: Layer sequential expects 1 inputs, but it received 3 input tensors

i am trying to load a dataset from csv and perform some federated learning on the available data. i manage to load a federated dataset from a given csv file and load both the train and the test data. ...
Mixalis Navridis's user avatar
4 votes
3 answers
1k views

How to save model in tensorflow federated

How to save the model in the blow code if you want to run the code, please visit https://github.com/tensorflow/federated and download federated_learning_for_image_classification.ipynb. I will ...
Vector's user avatar
  • 43
4 votes
1 answer
643 views

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

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 ...
ovae's user avatar
  • 149
3 votes
1 answer
211 views

TensorFlow Federated Compression: How to implement a stateful encoder to be used in in TFF's build_federated_averaging_process?

In Tensorflow Federated (TFF), you can pass to the tff.learning.build_federated_averaging_process a broadcast_process and an aggregation_process, which can embed customized encoders e.g. to apply ...
Alessio Mora's user avatar
2 votes
1 answer
1k views

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

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: : ...
Ahmad's user avatar
  • 61
2 votes
1 answer
750 views

Use different metrics in tf.keras.metrics for mutli-classification model

I am using the TensorFlow federated framework for a multiclassification problem. I am following the tutorials and most of them use the metric (tf.keras.metrics.SparseCategoricalAccuracy) to measure ...
Alwani's user avatar
  • 125
2 votes
1 answer
450 views

AttributeError: 'MapDataset' object has no attribute 'client_ids' in tensorflow_federated TFF

I'm trying to test a compression technique in federated learning with non-IID using this API tff.simulation.datasets.build_single_label_dataset(), following these posts: TensorFlow Federated: How to ...
user18969005's user avatar
2 votes
0 answers
161 views

In FedAvg what is the client optimizer?

In federated averaging, does the client optimizer have to be 'SGD' only? In this paper ADAPTIVE FEDERATED OPTIMIZATION it states "One such method is FEDAVG (McMahan et al., 2017), in which ...
Dushi Fdz's user avatar
  • 151
2 votes
1 answer
712 views

splitting the data into training and testing in federated learning

I am new in federated learning I am currently experimenting with a model by following the official TFF documentation. But I am stuck with an issue and hope I find some explanation here. I am using my ...
Alwani's user avatar
  • 125
2 votes
2 answers
1k views

Is there a reasonable way to create tff clients datat sets?

I am wondering if there are any reasonable ways to generate clients data sets for federated learning simulation using tff core code? In the tutorial for the federated core, it uses the MNIST database ...
Baymax's user avatar
  • 41
2 votes
1 answer
745 views

MSE error different during training and evaluation in tensorflow federated

I am implementing a regression model in tensorflow federated. I started with a simple model used in this tutorial for keras: https://www.tensorflow.org/tutorials/keras/regression I changed the model ...
kosmo16's user avatar
  • 176
2 votes
1 answer
320 views

How do I create an FL algorithm that uses the weights of a few clients?

Based on this link I am trying to write a new way of FL algorithm. I train all clients and send the model parameters of all clients to the server, and the server will weight average only the model ...
JunePyo's user avatar
  • 69
2 votes
1 answer
217 views

Operations performed on the communications between the server and clients

Part of federated learning research is based on operations performed on the communications between the server and clients such as dropping part of the updates (drop some gradients describing a model) ...
Schneider's user avatar
1 vote
1 answer
529 views

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

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 ...
sri3's user avatar
  • 35
1 vote
1 answer
500 views

How to create your own federated dataset and do learning over multiple devices with TensorflowFederated?

I am trying to use TFF to implement federated learning. I have spun up 3 EC2 instances and set up the TFF in a conda environment. I am trying to figure out how to create a federated dataset with some ...
sri3's user avatar
  • 35
1 vote
2 answers
609 views

ResNet model in Tensorflow Federated

I tried to customize the model in "Image classification" tutorial in Tensorflow Federated. (It originally used a sequential model) I use Keras ResNet50 but when it began to train, there is always an ...
Miao Zhang's user avatar
1 vote
1 answer
660 views

Federated Averaging (fedavg) with resnet 18 that has batch_normalization makes the same prediction after first round, but in no other rounds

I was trying to implement tensorflow-federated simple fedavg with cifar10 dataset and resnet18. Also this is the pytorch implementation. Just like trainable ones, I have aggregated non-trainable ...
ozgur's user avatar
  • 137
1 vote
1 answer
581 views

Tensorflow Federated object is not subscriptable

I have this run_one_round function like this: def run_one_round(server_state, federated_dataset): """Orchestration logic for one round of computation. Args: server_state: ...
Fanto's user avatar
  • 367
1 vote
1 answer
3k views

AttributeError: 'MapDataset' object has no attribute 'preprocess' in tensorflow_federated tff

I'm testing this tutorial with non-IID distribution for federated learning: https://www.tensorflow.org/federated/tutorials/tff_for_federated_learning_research_compression In this posted question ...
user18969005's user avatar
1 vote
2 answers
2k views

TypeError: 'type' object is not subscriptable when importing tensorflow_federated as tff

I'm working in colab notebook, and the importing of tff (import tensorflow_federated as tff) was working for months, but suddenly, now when I try to import tff as usual I faced this problem.. !pip ...
user18969005's user avatar
1 vote
0 answers
96 views

how to define create_tf_dataset_from_all_clients() function

I am trying to make a centralized dataset from a federated one. Data contains path, client_id and label So first I create a clientdata object using a function that accepts the client's id def ...
ana's user avatar
  • 58
1 vote
1 answer
570 views

'Error While Encoding with Hub.KerasLayer' while using TFF

An error is being generated while training a federated model that uses hub.KerasLayer. The details of error and stack trace is given below. The complete code is available of gist https://gist.github....
aksingh2411's user avatar
1 vote
1 answer
279 views

Collecting the weights returned by clients without aggregating them

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.
Cisc's user avatar
  • 33
0 votes
1 answer
150 views

TFF: accuracy is not increasing while simulating random samples of users

By simulating a tff code with random choice of clients in each round, I find that the accuracy increases to 0.9 then relapses to 0.5 and then from 0.8 to 0.6 and so on, it is not increasing. have you ...
Eliza's user avatar
  • 584
0 votes
1 answer
1k views

Epochs vs Rounds in federated learning

I am applying federated averaging on my federated learning model. After running the model for thousands rounds the model still did not converged. How can I increase the number of epochs in training, ...
Eden's user avatar
  • 325
0 votes
1 answer
411 views

tensorflow federated learning checkpoint

I am studying a federated_learning_for_image_classification.ipynb with tensorflow federated API. In the example, I could check each simulated clients train Accuracy, Loss and Total accuracy, Total ...
Sangwoo Nam's user avatar
0 votes
0 answers
152 views

Problem when evaluating a model in tensorflow federated. Accuracy stucked at 0.1 only on evaluation

I have a model implemented in tensorflow federated, trained to solve a classification problem on the cifar10 dataset. The dataset is made with the TestClientData. The model is a MobileNetV2 from the ...
Christian Fachola's user avatar