Unverified Commit 4146c715 authored by QuanluZhang's avatar QuanluZhang Committed by GitHub
Browse files

[Retiarii] refactor of NAS doc and make python engine default (#3785)


Co-authored-by: default avatarScarlett Li <39592018+scarlett2018@users.noreply.github.com>
Co-authored-by: default avatarkvartet <48014605+kvartet@users.noreply.github.com>
parent 0247be5e
...@@ -202,7 +202,7 @@ class Classification(Lightning): ...@@ -202,7 +202,7 @@ class Classification(Lightning):
If the ``lightning_module`` has a predefined val_dataloaders method this will be skipped. If the ``lightning_module`` has a predefined val_dataloaders method this will be skipped.
trainer_kwargs : dict trainer_kwargs : dict
Optional keyword arguments passed to trainer. See Optional keyword arguments passed to trainer. See
`Lightning documentation <https://pytorch-lightning.readthedocs.io/en/stable/trainer.html>`__ for details. `Lightning documentation <https://pytorch-lightning.readthedocs.io/en/stable/common/trainer.html>`__ for details.
""" """
def __init__(self, criterion: nn.Module = nn.CrossEntropyLoss, def __init__(self, criterion: nn.Module = nn.CrossEntropyLoss,
...@@ -250,7 +250,7 @@ class Regression(Lightning): ...@@ -250,7 +250,7 @@ class Regression(Lightning):
If the ``lightning_module`` has a predefined val_dataloaders method this will be skipped. If the ``lightning_module`` has a predefined val_dataloaders method this will be skipped.
trainer_kwargs : dict trainer_kwargs : dict
Optional keyword arguments passed to trainer. See Optional keyword arguments passed to trainer. See
`Lightning documentation <https://pytorch-lightning.readthedocs.io/en/stable/trainer.html>`__ for details. `Lightning documentation <https://pytorch-lightning.readthedocs.io/en/stable/common/trainer.html>`__ for details.
""" """
def __init__(self, criterion: nn.Module = nn.MSELoss, def __init__(self, criterion: nn.Module = nn.MSELoss,
......
...@@ -56,14 +56,14 @@ class RetiariiExeConfig(ConfigBase): ...@@ -56,14 +56,14 @@ class RetiariiExeConfig(ConfigBase):
experiment_working_directory: PathLike = '~/nni-experiments' experiment_working_directory: PathLike = '~/nni-experiments'
# remove configuration of tuner/assessor/advisor # remove configuration of tuner/assessor/advisor
training_service: TrainingServiceConfig training_service: TrainingServiceConfig
execution_engine: str = 'base' execution_engine: str = 'py'
def __init__(self, training_service_platform: Optional[str] = None, **kwargs): def __init__(self, training_service_platform: Optional[str] = None, **kwargs):
super().__init__(**kwargs) super().__init__(**kwargs)
if training_service_platform is not None: if training_service_platform is not None:
assert 'training_service' not in kwargs assert 'training_service' not in kwargs
self.training_service = util.training_service_config_factory(platform = training_service_platform) self.training_service = util.training_service_config_factory(platform = training_service_platform)
self.__dict__['trial_command'] = 'python3 -m nni.retiarii.trial_entry base' self.__dict__['trial_command'] = 'python3 -m nni.retiarii.trial_entry py'
def __setattr__(self, key, value): def __setattr__(self, key, value):
fixed_attrs = {'search_space': '', fixed_attrs = {'search_space': '',
...@@ -314,7 +314,7 @@ class RetiariiExperiment(Experiment): ...@@ -314,7 +314,7 @@ class RetiariiExperiment(Experiment):
self._dispatcher_thread = None self._dispatcher_thread = None
_logger.info('Experiment stopped') _logger.info('Experiment stopped')
def export_top_models(self, top_k: int = 1, optimize_mode: str = 'maximize', formatter: str = 'code') -> Any: def export_top_models(self, top_k: int = 1, optimize_mode: str = 'maximize', formatter: str = 'dict') -> Any:
""" """
Export several top performing models. Export several top performing models.
......
...@@ -139,6 +139,7 @@ def serialize(cls, *args, **kwargs): ...@@ -139,6 +139,7 @@ def serialize(cls, *args, **kwargs):
To create an serializable instance inline without decorator. For example, To create an serializable instance inline without decorator. For example,
.. code-block:: python .. code-block:: python
self.op = serialize(MyCustomOp, hidden_units=128) self.op = serialize(MyCustomOp, hidden_units=128)
""" """
return serialize_cls(cls)(*args, **kwargs) return serialize_cls(cls)(*args, **kwargs)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment