Skip to content
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

Construct FL course when server does not have data #236

Merged
merged 3 commits into from
Jul 21, 2022

Conversation

xieyxclack
Copy link
Collaborator

As the title says. When the server does not have data:

  • if some data is available as data representative (e.g., in simulation the client data), these data can be used to extract the input shape for building models at the server;
  • Otherwise, the users can specify model.input_shape to tell what's the input shape (a tuple) to get the model if necessary;
  • fix Support run FL courses when the server doesn't have data #208

When the server does not have data in simulation, users can set data.type=''. (Please see the examples in scripts/run_distributed_lr.sh)

Please @rayrayraykk check get_shape_from_data in federatescope/core/auxiliaries/model_builder.py, thx!

@xieyxclack xieyxclack added the enhancement New feature or request label Jul 14, 2022
@xieyxclack xieyxclack requested review from rayrayraykk and yxdyc July 14, 2022 12:45
Copy link
Collaborator

@rayrayraykk rayrayraykk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but please see the inline comments, thanks.

else:
raise ValueError('Data {} not found.'.format(config.data.type))

if config.federate.mode.lower() == 'standalone':
return data, modified_config
else:
# Invalid data_idx
if config.distribute.data_idx not in data.keys():
if config.distribute.data_idx == -1:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When data.type is None or "" while distribute.data_idx is given, we should assert in configs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When date.type is None or "", the distribute.data_idx does not work. IMO, we can provide a WARNING but not an assertion here.

@@ -49,7 +49,12 @@ def extend_fl_setting_cfg(cfg):
cfg.distribute.client_port = 50050
cfg.distribute.role = 'client'
cfg.distribute.data_file = 'data'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The data-related keyword distribute.data_file in distributed mode seems to be the same meaning as data.root.

Copy link
Collaborator Author

@xieyxclack xieyxclack Jul 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data.root is a file directory and distribute.data_file includes the filename here

if model_config.type.lower() in ['vmfnet', 'hmfnet']:
return data['train'].n_col if model_config.type.lower(
) == 'vmfnet' else data['train'].n_row
elif model_config.type.lower() in [
Copy link
Collaborator

@rayrayraykk rayrayraykk Jul 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For graph-level tasks, data is {train/val/test: DataLoader}.
For testing: python federatedscope/main.py --cfg federatedscope/gfl/baseline/fedavg_gnn_minibatch_on_multi_task.yaml

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have fixed this issue, thx!

@rayrayraykk rayrayraykk linked an issue Jul 19, 2022 that may be closed by this pull request
@xieyxclack
Copy link
Collaborator Author

I have rebased the thread to the master and resolved the conflicts. @rayrayraykk @yxdyc

Copy link
Collaborator

@yxdyc yxdyc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Job. LGTM.

@yxdyc yxdyc merged commit bc6eb8b into alibaba:master Jul 21, 2022
@xieyxclack xieyxclack deleted the data_shape branch August 15, 2022 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when load toy data in distributed mode Support run FL courses when the server doesn't have data
3 participants