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

Support saving search space in experiment load&save command #2886

Merged
merged 28 commits into from
Sep 21, 2020

Conversation

SparkSnail
Copy link
Contributor

No description provided.

SparkSnail added 23 commits May 29, 2020 17:02
@SparkSnail SparkSnail changed the title Save search space in experiment save Support saving search space in experiment load&save command Sep 11, 2020
target_path = os.path.join(os.getcwd(), target_path)
print_normal('Expand search space path to %s' % target_path)
nnictl_exp_config['searchSpacePath'] = target_path
# if the path alerady has a search space file, use the original one, otherwise use archived one
Copy link
Contributor

Choose a reason for hiding this comment

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

already

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated.

print_error('Archive file does not contain search space file!')
exit(1)
else:
for file in os.listdir(archive_search_space_dir):
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need a dir?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For storage data and classify. There are a few folders in archive folder, including 'code', 'nnictl', 'experiment', 'searchSpace', the search space file's name is random, put this file into 'searchSpace' folder for identify.

source_path = os.path.join(archive_search_space_dir, file)
os.makedirs(os.path.dirname(target_path), exist_ok=True)
shutil.copyfile(source_path, target_path)
break
Copy link
Contributor

Choose a reason for hiding this comment

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

Throw error when no file is found?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there is already a judgement in lint 955, don't need to throw error here anymore.

@scarlett2018 scarlett2018 mentioned this pull request Sep 11, 2020
79 tasks
@@ -159,6 +159,8 @@ def parse_args():
parser_load_experiment.add_argument('--codeDir', '-c', required=True, help='the path of codeDir for loaded experiment, \
this path will also put the code in the loaded experiment package')
parser_load_experiment.add_argument('--logDir', '-l', required=False, help='the path of logDir for loaded experiment')
parser_load_experiment.add_argument('--searchSpacePath', '-s', required=True, help='the path of search space file for \
Copy link
Contributor

@chicm-ms chicm-ms Sep 13, 2020

Choose a reason for hiding this comment

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

Some experiments do not have search space.
Even for the experiment with search space, can we just load search space file to codeDir by default? If there is an naming conflict loading search space into codeDir, then we report error and ask use to specify --searchSpacePath.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated.

search_space_path = nni_config.get_config('experimentConfig').get('searchSpacePath')
if search_space_path:
if not os.path.exists(search_space_path):
print_error('search space %s does not exist!' % search_space_path)
Copy link
Contributor

Choose a reason for hiding this comment

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

warning might be better?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated.

@SparkSnail SparkSnail merged commit 6e967f5 into microsoft:master Sep 21, 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