Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

[Retiarii] refactor based on the new launch approach #3185

Merged
merged 80 commits into from
Dec 14, 2020

Conversation

QuanluZhang
Copy link
Contributor

@QuanluZhang QuanluZhang commented Dec 11, 2020

  • make example code executable with the new launch approach
  • use decorator instead of with statement
  • small refactor of code gen on the new launch approach
  • refactor of strategy interface: merge trainer into base model
  • support darts example with the new launch approach (classic mode)
  • refactor the implementation of LayerChoice/InputChoice
  • LayerChoice/InputChoice backward compatibility
  • refactor strategy to support trial concurrency
  • unify launch style of classic mode and weight sharing for LayerChoice/InputChoice
  • fix pylint
  • support loop in graph ir (graph_gen)
  • support remote training service

@QuanluZhang QuanluZhang marked this pull request as ready for review December 11, 2020 11:21
@@ -52,7 +52,7 @@ def __init__(self, experiment_id: str):

def connect(self) -> BufferedIOBase:
conn, _ = self._socket.accept()
self.file = conn.makefile('w+b')
self.file = conn.makefile('rwb')
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#3183 @liuzhe-lz can answer this question

while True:
time.sleep(10)
status = self.get_status()
if status in ['ERROR', 'STOPPED', 'NO_MORE_TRIAL']:
Copy link
Contributor

Choose a reason for hiding this comment

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

What if the experiment is done?

if _records is not None:
assert name not in _records, '{} already in _records'.format(name)
_records[name] = value
__all__ = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this nn.__all__ plus a few others?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, ours, for example placeholder

BatchNorm2d = wrap_module(nn.BatchNorm2d)
ReLU = wrap_module(nn.ReLU)
Dropout = wrap_module(nn.Dropout)
Linear = wrap_module(nn.Linear)
MaxPool2d = wrap_module(nn.MaxPool2d)
AvgPool2d = wrap_module(nn.AvgPool2d)
Identity = wrap_module(nn.Identity)
AdaptiveAvgPool2d = wrap_module(nn.AdaptiveAvgPool2d)'''

Identity = wrap_module(nn.Identity)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we refactor it into a for loop?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think this way is more clear and easy to maintain

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because not all the modules are included, for example, loss modules. and different versions of pytorch have different members in nn.module. I will handle different versions later

@@ -463,6 +466,9 @@ def convert_module(script_module, module, module_name, ir_model):

ir_graph._register()

if id(module) not in modules_arg:
raise RuntimeError(f'{original_type_name} arguments are not recorded, \
you may forget to decorate this class with @register_module()')
Copy link
Contributor

Choose a reason for hiding this comment

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

you might have forgotten

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@QuanluZhang QuanluZhang merged commit 192a807 into microsoft:dev-retiarii Dec 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants