List of attack clients
Hi
I have tried to add list of attack id but I got type mismatch error.
(fs) PS C:\temp\FederatedScope-backdoor-bench> python federatedscope/main.py --cfg scripts/backdoor_scripts/attack_config/backdoor_fedavg_convnet2_on_femnist.yaml
Namespace(cfg_file='scripts/backdoor_scripts/attack_config/backdoor_fedavg_convnet2_on_femnist.yaml', client_cfg_file=None, opts=[])
Traceback (most recent call last):
File "C:\temp\FederatedScope-backdoor-bench\federatedscope\main.py", line 29, in
Thanks
Duaa
You could change https://github.com/alibaba/FederatedScope/blob/f691611e86eac75d8a869392eaa2608e44713908/federatedscope/core/configs/cfg_attack.py#L14 to
cfg.attack.attacker_id = [-1]
to avoid ValueError .
You could change
https://github.com/alibaba/FederatedScope/blob/f691611e86eac75d8a869392eaa2608e44713908/federatedscope/core/configs/cfg_attack.py#L14
to
cfg.attack.attacker_id = [-1]to avoid
ValueError.
Thanks for your reply. However, I need to simulate multi-client attack so that I have to list all the attack clients' id in a list (e.g. [1, 2, 3, 4, 5]).
You could change https://github.com/alibaba/FederatedScope/blob/f691611e86eac75d8a869392eaa2608e44713908/federatedscope/core/configs/cfg_attack.py#L14
to
cfg.attack.attacker_id = [-1]to avoid
ValueError.Thanks for your reply. However, I need to simulate multi-client attack so that I have to list all the attack clients' id in a list (e.g. [1, 2, 3, 4, 5]).
Yes, you should change the type of cfg.attack.attacker_id from int to list to avoid ValueError: Type mismatch (<class 'int'> vs. <class 'list'>) with values (-1 vs. [1, 2, 3, 4, 5]) for config key: attack.attacker_id.
cfg.attack.attacker_id = [-1]
Hi I did it but still got same error.
Do you have any idea?
Thanks
cfg.attack.attacker_id = [-1]
Hi I did it but still got same error.
Do you have any idea?
Thanks
Try to re-install FS with editable mode via pip install -e .
@rayrayraykk Hi I re-installed it. But still I got a sequence of error messages starting from poisoning_data.py and server_attacker.py and then fed_runner.py . I tried to fix by converting commands to read from a list but it doesn't work it seems FS has not been configured to read from a list of id attacker.
@rayrayraykk Hi I re-installed it. But still I got a sequence of error messages starting from poisoning_data.py and server_attacker.py and then fed_runner.py . I tried to fix by converting commands to read from a list but it doesn't work it seems FS has not been configured to read from a list of id attacker.
try: change '==' to 'in' in line https://github.com/alibaba/FederatedScope/blob/dd5f87bb47bbb1c95302214aeed5d7185692b7ee/federatedscope/attack/auxiliary/poisoning_data.py#L284 since ctx.attack.attacker_id is now a list type not the original int type.
Please double check other files that use attacker_id.
@rayrayraykk Hi I re-installed it. But still I got a sequence of error messages starting from poisoning_data.py and server_attacker.py and then fed_runner.py . I tried to fix by converting commands to read from a list but it doesn't work it seems FS has not been configured to read from a list of id attacker.
try: change '==' to 'in' in line
https://github.com/alibaba/FederatedScope/blob/dd5f87bb47bbb1c95302214aeed5d7185692b7ee/federatedscope/attack/auxiliary/poisoning_data.py#L284
since ctx.attack.attacker_id is now a list type not the original int type. Please double check other files that use attacker_id.
Yes, I did already.
And then got this error
File "c:\temp\federatedscope-backdoor-bench\federatedscope\attack\worker_as_attacker\server_attacker.py", line 68, in broadcast_model_para
self._cfg.attack.attacker_id - 1)
TypeError: unsupported operand type(s) for -: 'list' and 'int'
I fixed it with
[x - 1 for x in self._cfg.attack.attacker_id])
Then
File "c:\temp\federatedscope-backdoor-bench\federatedscope\attack\worker_as_attacker\server_attacker.py", line 75, in broadcast_model_para 'starting the poisoning round: {:d}, the attacker ID: {:d}' TypeError: unsupported format string passed to list.__format_
And then
File "c:\temp\federatedscope-backdoor-bench\federatedscope\core\fed_runner.py", line 273, in _handle_msg self.client[each_receiver].msg_handlers[msg.msg_type](msg) TypeError: unhashable type: 'list'
`