-
Notifications
You must be signed in to change notification settings - Fork 95
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
客户端数量设置问题 #42
Comments
|
您好,返回的错误为KeyError可能是因为本地数据集仍然太小,导致本地通过train_holdout和local_test划分出的验证集和测试集为空,例如大小为3的数据集,划出0.2的数据作为其他用途,将划分出空数据。当test函数在空数据集上测试时,将返回空字典,造成keyerror。一种较快的解决方式为,确保最少数据集train_holdout0.5>=1 |
你好,我还想请问我是否可以获得不进行模型传输的客户端的模型参数,我将如何调用以得到所有客户端每轮训练后的模型参数 |
你好,默认的实现为用户本地训练后不保存训练好的模型,以防止过多的内存\显存占用;若要不传输就访问,则需要在打包发送之前在本地保存训练好的模型self.local_model=model,然后服务器可以通过self.clients[i].local_model来访问 |
请问能设置每个客户端上本地数据的数据量吗 |
你好,要设置具体数量的话,可能需要手动自己写一个Partitioner,这里我提供了一个例子: import flgo.benchmark.mnist_classification
import flgo.benchmark.partition as fbp
import numpy as np
# 1. Define the partitioner
class MyIIDPartitioner(fbp.BasicPartitioner):
def __init__(self, samples_per_client=[15000, 15000, 15000, 15000]):
self.samples_per_client = samples_per_client
self.num_clients = len(samples_per_client)
def __call__(self, data):
# 1.1 shuffle the indices of samples
d_idxs = np.random.permutation(len(data))
# 1.2 Divide all the indices into num_clients shards
local_datas = np.split(d_idxs, np.cumsum(self.samples_per_client))[:-1]
local_datas = [di.tolist() for di in local_datas]
return local_datas
# 2. Specify the Partitioner in task configuration
task_config = {
'benchmark': flgo.benchmark.mnist_classification,
'partitioner':{
'name':MyIIDPartitioner,
'para':{
'samples_per_client':[5000, 14000, 19000, 22000]
}
}
}
task = 'my_test_partitioner'
# 3. Test it now
flgo.gen_task(task_config, task)
import flgo.algorithm.fedavg as fedavg
runner = flgo.init(task, fedavg)
runner.run() |
你好,当客户端shu'lian数量设置到800时就会出现报错,请问怎么解决
The text was updated successfully, but these errors were encountered: