diaoenmao / HeteroFL-Computation-and-Communication-Efficient-Federated-Learning-for-Heterogeneous-Clients

[ICLR 2021] HeteroFL: Computation and Communication Efficient Federated Learning for Heterogeneous Clients
MIT License
154 stars 33 forks source link

predictions with smaller rates #8

Closed hoangdzung closed 2 years ago

hoangdzung commented 2 years ago

Hi. I'm trying to get the predictions with the smaller rates. Let's say I have selected_user_idx is the list of user indexes I wanna test. Then I do as follow:

local_parameters, _ = federation.distribute(selected_user_idx)
for i, user in enumerate(selected_user_idx):
    test_model = eval('models.{}(model_rate=cfg["model_rate"][user], track=True).to(cfg["device"]).format(cfg['model_name']))
    test_model.load_state_dict(local_parameters[i], strict=False)

Then I use test_model followed by stats, test functions to get the results. However, for the model whose model_rate is not the global_model_rate, it always predicts 1.

Do you have any idea how it goes wrong or some ideas to implement it correctly? Thank you.

diaoenmao commented 2 years ago

I think my work does not support predicting with smaller models as our goal here is to predict with the global model while training small models on weak devices.