'fedprox tensorflow federated (TypeError: cannot unpack non-iterable LearningProcessOutput object)
iterative_process = tff.learning.algorithms.build_unweighted_fed_prox(
model_fn,
proximal_strength= 0.5,
client_optimizer_fn=lambda: tf.keras.optimizers.SGD(learning_rate=0.01),
server_optimizer_fn=lambda: tf.keras.optimizers.SGD(learning_rate=1.0))
state, metrics = iterative_process.next(state, federated_train_data)
print('round 1, metrics={}'.format(metrics))
On executing the round 1, it throws (TypeError: cannot unpack non-iterable LearningProcessOutput object).
It was working fine when we use Fedavg, but not with fedprox
Solution 1:[1]
iterative_process.next returns LearningProcessOutput which is not iterable, as the error says.
You can replace it by
output = iterative_process.next(...)
state = output.state
metrics = output.metrics
or just use the output directly.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jakub Konecny |
