-
Notifications
You must be signed in to change notification settings - Fork 214
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
change opt treatment and device policy to enum values #374
Changes from 8 commits
9534693
dc1458a
b9f8668
84892db
80b9824
802e232
2214ed1
6369183
d874afc
c9fe738
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -484,12 +484,14 @@ | |
"# If I use autoreload I got a pickling error\n", | ||
"\n", | ||
"# The following command zips the workspace and python requirements to be transfered to collaborator nodes\n", | ||
"from openfl.utilities.enum_types import DevicePolicy, OptTreatment\n", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please split this import into separate lines |
||
"\n", | ||
"fl_experiment.start(model_provider=MI, \n", | ||
" task_keeper=TI,\n", | ||
" data_loader=fed_dataset,\n", | ||
" rounds_to_train=2,\n", | ||
" opt_treatment='CONTINUE_GLOBAL',\n", | ||
" device_assignment_policy='CUDA_PREFERRED')\n" | ||
" opt_treatment=OptTreatment.CONTINUE_GLOBAL,\n", | ||
" device_assignment_policy=DevicePolicy.CUDA_PREFERRED)\n" | ||
] | ||
}, | ||
{ | ||
|
@@ -584,7 +586,7 @@ | |
"source": [ | ||
"MI = ModelInterface(model=best_model, optimizer=optimizer_adam, framework_plugin=framework_adapter)\n", | ||
"fl_experiment.start(model_provider=MI, task_keeper=TI, data_loader=fed_dataset, rounds_to_train=4, \\\n", | ||
" opt_treatment='CONTINUE_GLOBAL')" | ||
" opt_treatment=OptTreatment.CONTINUE_GLOBAL)" | ||
] | ||
}, | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
from openfl.interface.cli_helper import WORKSPACE | ||
from openfl.transport import AggregatorGRPCClient | ||
from openfl.transport import AggregatorGRPCServer | ||
from openfl.utilities.enum_types import OptTreatment | ||
from openfl.utilities.utils import getfqdn_env | ||
|
||
SETTINGS = 'settings' | ||
|
@@ -458,6 +459,16 @@ def get_collaborator(self, collaborator_name, root_certificate=None, private_key | |
|
||
defaults[SETTINGS]['compression_pipeline'] = self.get_tensor_pipe() | ||
defaults[SETTINGS]['task_config'] = self.config.get('tasks', {}) | ||
|
||
opt_treatment = defaults[SETTINGS]['opt_treatment'] | ||
if isinstance(opt_treatment, str) and hasattr(OptTreatment, opt_treatment): | ||
defaults[SETTINGS]['opt_treatment'] = OptTreatment[opt_treatment].value | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe better to save string here to easeir review plan.yaml. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes I and @igor-davidyuk discussed about it and thought of using value instead of name |
||
elif isinstance(opt_treatment, int) and OptTreatment(opt_treatment): | ||
pass | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't we parse integer value here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if opt_treatment is already an integer (from lime 463), then it's already parsed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need this check then? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So both integer and string values are appropriate here if there are multiple collaborators. In both of these conditions, it shouldn't raise an exception but for all other cases it should. |
||
else: | ||
self.logger.error(f'Unknown opt_treatment: {opt_treatment}.') | ||
raise NotImplementedError(f'Unknown opt_treatment: {opt_treatment}.') | ||
|
||
if client is not None: | ||
defaults[SETTINGS]['client'] = client | ||
else: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please clear the notebook metadata