FederatedAI / FATE

An Industrial Grade Federated Learning Framework
Apache License 2.0
5.71k stars 1.55k forks source link

list' object has no attribute 'state_dict #5691

Closed lidefan888 closed 3 months ago

lidefan888 commented 3 months ago

我是fate2.1.1版本,在dockers deskktop中运行, https://github.com/FederatedAI/FATE/blob/master/doc/2.0/fate/homo_quick_start.md 跟着上面的homo_quick_start使用pipeline时出现list' object has no attribute 'state_dict的错误, 以下是fate board中的错误报告 list' object has no attribute 'state_dict' Traceback (most recent call last): File "/data/projects/fate/fate/python/fate/components/entrypoint/cli/component/execute_cli.py", line 147, in execute_component_from_config component.execute(ctx, role, execution_io.get_kwargs()) File "/data/projects/fate/fate/python/fate/components/core/component_desc/_component.py", line 101, in execute return self.callback(ctx, role, kwargs) File "/data/projects/fate/fate/python/fate/components/components/homo_nn.py", line 80, in train runner.train(output_dir=output_dir) File "/data/projects/fate/fate/python/fate/components/components/nn/runner/homo_default_runner.py", line 278, in train trainer.train() File "/data/projects/fate/fate/python/fate/ml/nn/trainer/trainer_base.py", line 1186, in train self.on_federation(sub_ctx, aggregator=self.aggregator, agg_iter_idx=i) File "/data/projects/fate/fate/python/fate/ml/nn/homo/fedavg.py", line 111, in on_federation aggregator.model_aggregation(ctx) File "/data/projects/fate/fate/python/fate/ml/aggregator/aggregator_wrapper.py", line 164, in model_aggregation self._aggregator.model_aggregation(ctx) File "/data/projects/fate/fate/python/fate/ml/aggregator/base.py", line 258, in model_aggregation self.model_aggregator.secure_aggregate(ctx, ranks=ranks) File "/data/projects/fate/fate/python/fate/arch/protocol/secure_aggregation/_secure_aggregation.py", line 135, in secure_aggregate torch.save(aggregated.state_dict(), 'aggregated_model.pth') AttributeError: 'list' object has no attribute 'state_dict'

mgqa34 commented 3 months ago

https://github.com/FederatedAI/FATE/blob/v2.1.1/python/fate/arch/protocol/secure_aggregation/_secure_aggregation.py 代码里面并没有报错的135行,torch.save(aggregated.state_dict(), 'aggregated_model.pth'),这个是你这边自己添加的调试代码?