Skip to content

Commit ea352ff

Browse files
committed
Auto Generate benchmark
1 parent 5416732 commit ea352ff

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

flgo/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .utils.fflow import init, gen_task, gen_task_by_para, gen_benchmark_from_file,tune, run_in_parallel, multi_init_and_run
1+
from .utils.fflow import init, gen_task, gen_task_from_para, gen_benchmark_from_file,tune, run_in_parallel, multi_init_and_run
22

33
communicator = None
44

flgo/utils/fflow.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,13 @@ def gen_benchmark_from_file(benchmark:str, config_file:str, target_path='.',data
184184
if task_type == 'classification':
185185
temp_path = os.path.join(flgo.benchmark.path, 'toolkits', 'cv', 'classification', 'temp')
186186
shutil.copytree(temp_path, bmk_path)
187+
else:
188+
raise NotImplementedError('FLGo currently only support automatically generate cv.classification task. More other types are comming soon...')
187189
shutil.copyfile(config_file, os.path.join(bmk_path, 'config.py'))
188190
bmk_module = '.'.join(os.path.relpath(bmk_path, os.getcwd()).split(os.path.sep))
189191
return bmk_module
190192

191-
def gen_task_by_para(benchmark, bmk_para:dict={}, Partitioner=None, par_para:dict={}, task_path: str='', rawdata_path:str='', seed:int=0):
193+
def gen_task_from_para(benchmark, bmk_para:dict={}, Partitioner=None, par_para:dict={}, task_path: str= '', rawdata_path:str= '', seed:int=0):
192194
r"""
193195
Generate a federated task according to the parameters of this function. The formats and meanings of the inputs are listed as below:
194196
@@ -207,9 +209,9 @@ def gen_task_by_para(benchmark, bmk_para:dict={}, Partitioner=None, par_para:dic
207209
>>> import flgo.benchmark.mnist_classification as mnist
208210
>>> from flgo.benchmark.toolkits.partition import IIDPartitioner
209211
>>> # GENERATE TASK BY PASSING THE MODULE OF BENCHMARK AND THE CLASS OF THE PARTITIOENR
210-
>>> flgo.gen_task_by_para(benchmark=mnist, Partitioner = IIDPartitioner, par_para={'num_clients':100}, task_path='./mnist_gen_by_para1')
212+
>>> flgo.gen_task_from_para(benchmark=mnist, Partitioner = IIDPartitioner, par_para={'num_clients':100}, task_path='./mnist_gen_by_para1')
211213
>>> # GENERATE THE SAME TASK BY PASSING THE STRING
212-
>>> flgo.gen_task_by_para(benchmark='flgo.benchmark.mnist_classification', Partitioner='IIDPartitioner', par_para={'num_clients':100}, task_path='./mnist_gen_by_para2')
214+
>>> flgo.gen_task_from_para(benchmark='flgo.benchmark.mnist_classification', Partitioner='IIDPartitioner', par_para={'num_clients':100}, task_path='./mnist_gen_by_para2')
213215
```
214216
"""
215217
random.seed(3 + seed)

0 commit comments

Comments
 (0)