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

[Do NOT Squash] Merge retiarii dev branch to master #3155

Merged
merged 23 commits into from
Dec 16, 2020
Merged

Conversation

liuzhe-lz
Copy link
Contributor

No description provided.

liuzhe-lz and others added 2 commits December 5, 2020 12:08
* First commit for WS in Retiarii

* Refactor ENAS trainer

* Fix DARTS trainer

* Fix ENAS trainer

* Fix issues in DARTS and Proxyless

* Fix ProxylessNAS and Random trainer

* Refactor mask
@liuzhe-lz liuzhe-lz requested a review from qfyin December 9, 2020 02:38
@liuzhe-lz
Copy link
Contributor Author

Must review:
@liuzhe-lz @QuanluZhang @ultmaster @qfyin

@liuzhe-lz liuzhe-lz marked this pull request as draft December 9, 2020 02:42
@QuanluZhang QuanluZhang changed the title Merge retiarii dev branch to master [Do NOT Squash] Merge retiarii dev branch to master Dec 11, 2020
@QuanluZhang QuanluZhang requested a review from hzhua December 11, 2020 02:39
@liuzhe-lz liuzhe-lz marked this pull request as ready for review December 11, 2020 03:00
Merge master commit history into dev-retiarii
from .graph import MetricData


_logger = logging.getLogger('nni.msg_dispatcher_base')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why this logger?

Copy link
Contributor

Choose a reason for hiding this comment

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

It should be removed. I added it for debug.

Copy link
Contributor

Choose a reason for hiding this comment

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

To print message to dispatcher log? Any suggestions?

super().__init__(*args)

@staticmethod
def _debug_dump_graph(graph):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why is this a static method of error class?

self.metric: Optional[MetricData] = None
self.intermediate_metrics: List[MetricData] = []

self._last_uid: int = 0 # FIXME: this should be global, not model-wise
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to fix. (my bad)

self.sampler = recorder
new_model = self.apply(model)
self.sampler = sampler_backup
return recorder.recorded_candidates, new_model
Copy link
Contributor Author

@liuzhe-lz liuzhe-lz Dec 13, 2020

Choose a reason for hiding this comment

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

As an user API, I think the return type is too complicated.
I suggest to make this method "static" and accept multiple mutators:

class Mutator:
    # @staticmethod  (optionally)
    def dry_run(mutator: Union[Mutator, Iterable[Mutator]], model: Model):
        ...

Mutator.dry_run([mutator1, mutator2, mutator3], model)
Mutator.dry_run(single_mutator, model)
single_mutator.dry_run(model)  # if "@staticmethod" decorator is not used

"""


class TrainingConfig:
Copy link
Contributor Author

@liuzhe-lz liuzhe-lz Dec 13, 2020

Choose a reason for hiding this comment

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

Is this class still in use?
I copied it from artifact and don't know how it works.

If yes, it need to be documented. Current doc delivers no information.

"""
Graph metrics like loss, accuracy, etc.

# Maybe we can assume this is a single float number for first iteration.
Copy link
Contributor Author

@liuzhe-lz liuzhe-lz Dec 13, 2020

Choose a reason for hiding this comment

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

What's the real format? Float or dict? Or both?

assert isinstance(self.operation, Cell)
return self.graph.model.graphs[self.operation.parameters['cell']]

def update_label(self, label: str) -> None:
Copy link
Contributor Author

@liuzhe-lz liuzhe-lz Dec 13, 2020

Choose a reason for hiding this comment

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

What is label and why it's needed?
What is label in framework's perspective?
What is label in end-user's perspective?

def nodes(self) -> List['Node']:
return [self.input_node, self.output_node] + self.hidden_nodes

def _add_input(self, input_name) -> None:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is for PyTorch converter only. Suggest move into converter package.

assert head[0].graph is self and tail[0].graph is self
return Edge(head, tail, _internal=True)._register()

def del_edge(self, edge: 'Edge') -> None:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please sync the name. Either rename this to remove_edge, or rename Edge.remove to del.

return new_node

# mutation
def add_edge(self, head: Tuple['Node', Optional[int]], tail: Tuple['Node', Optional[int]]) -> 'Edge':
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The type hint is too confusing. I'll deal with it.


def _request_trial_jobs_callback(self, num_trials: int) -> None:
for listener in self._listeners:
listener.on_resource_available(1 * num_trials)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

1 * ?

import os
import sys

from nni.retiarii.integration import RetiariiAdvisor
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 file still necessary?

Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need it any more I think.

@@ -0,0 +1,3 @@
# these should be experiment config in release

framework = 'pytorch'
Copy link
Contributor

Choose a reason for hiding this comment

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

So are we at release now?

@QuanluZhang QuanluZhang merged commit 468917c into master Dec 16, 2020
@liuzhe-lz liuzhe-lz deleted the dev-retiarii branch December 25, 2020 09:53
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.

5 participants