Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LearningProcess Compatibility Error #4174

Open
SaiSharanyaY opened this issue Oct 10, 2023 · 2 comments
Open

LearningProcess Compatibility Error #4174

SaiSharanyaY opened this issue Oct 10, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@SaiSharanyaY
Copy link

SaiSharanyaY commented Oct 10, 2023

Code Snip

svhn_iterative_process = tff.learning.algorithms.build_weighted_fed_avg(
    modelsvhn_fn,
    client_optimizer_fn=lambda: tf.keras.optimizers.SGD(learning_rate=0.02),
    server_optimizer_fn=lambda: tf.keras.optimizers.SGD(learning_rate=1))
svhnstate = svhn_iterative_process.initialize()
svhnstate_with_model = svhn_iterative_process.get_model_weights(svhnstate)
svhn_evaluation = tff.learning.algorithms.build_fed_eval(modelsvhn_fn)
federated_train_data_svhn =make_federated_data_svhn(svhn_data, clientlist)
overallLosssvhn = svhn_evaluation(svhnstate_with_model, federated_train_data_svhn)

Query
This is the iterative procedure I am following, for overall evaluation I am facing an error of LearningProcess is not compatible for the overallLosssvhn, Is there any way to solve it or convert it into a model ? [.model is not compatible]

@SaiSharanyaY SaiSharanyaY added the bug Something isn't working label Oct 10, 2023
@JDRanpariya
Copy link

As found in one issue, svhn_iterative_process.initialize() doesn't have a .model attribute. So instead model weight was obtained using svhn_iterative_process.get_model_weights(state) but while using it in overallLosssvhn it's throwing an error saying LearningProcess can't be passed whereas we are providing model weights using .get_model_weights.

@zcharles8
Copy link
Collaborator

Can you post a full stack trace? Additionally, as @JDRanpariya mentions, you can't pass the state of the learning process into your federated evaluation, it just expects the model weights. The setup they describe, ie. something like

weights = svhn_iterative_process.get_model_weights(state)
svhn_evaluation(weights, federated_train_data_svhn)

makes sense, but if this is causing you errors please post the full logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants