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

config refactor stage 1 - ExperimentConfig and LocalConfig #4313

Merged
merged 5 commits into from
Nov 19, 2021

Conversation

liuzhe-lz
Copy link
Contributor

@liuzhe-lz liuzhe-lz commented Nov 15, 2021

Description

Port ExperimentConfig to the new base class.

Now the canonicalize and validation logic is shorter, and should be far more readable.

Checklist

  • test case
  • doc

How to test

Should be tested together with other configure refactor PRs.

@liuzhe-lz liuzhe-lz mentioned this pull request Nov 17, 2021
86 tasks
raise ValueError('ExperimentConfig: search_space and search_space_file must be set one')

if self.search_space_file is not None:
self.search_space = yaml.safe_load(open(self.search_space_file))
Copy link
Contributor

Choose a reason for hiding this comment

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

does the file need close()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well I'm pretty sure it won't cause problem to open a file read-only and let GC to close it, but you are right it's better to use with.

from ..training_service import TrainingServiceConfig # avoid circular import

# import all custom config classes so they can be found in TrainingServiceConfig.__subclasses__()
custom_ts_config_path = nni.runtime.config.get_config_file('training_services.json')
Copy link
Contributor

Choose a reason for hiding this comment

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

What is content of training_service.json file? Does the file has path validation?

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 a config file for custom training services, similar to the config file for registered algorithms.
The availability is guaranteed by the config module.

def _canonicalize(self, parents):
super()._canonicalize(parents)
self.gpu_indices = canonical_gpu_indices(self.gpu_indices)
self.nni_manager_ip = None
Copy link
Contributor

Choose a reason for hiding this comment

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

do we have nni_manager_ip in the training service config before?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nni_manager_ip, trial_command, trial_gpu_number, etc were only in the top level config and not in training service configs.
But it was decided several releases ago, according to discussion, that training service config should contain all things needed by training service. And then these fields in top level config will work as "shortcuts" for convenience and for compatibility.

@liuzhe-lz liuzhe-lz merged commit afdac5f into microsoft:dev-config Nov 19, 2021
@liuzhe-lz liuzhe-lz deleted the dev-config-1 branch December 1, 2021 06:13
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.

3 participants