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

Add native support for v2 config #3315

Closed
wants to merge 16 commits into from

Conversation

liuzhe-lz
Copy link
Contributor

@liuzhe-lz liuzhe-lz commented Jan 18, 2021

Recreated as PR #3466

@liuzhe-lz liuzhe-lz changed the title Add native v2 config support to local Add native support for v2 config Jan 20, 2021
@J-shang J-shang mentioned this pull request Jan 25, 2021
94 tasks
@J-shang J-shang closed this Jan 27, 2021
@J-shang J-shang reopened this Jan 27, 2021
@J-shang J-shang requested review from J-shang and SparkSnail February 1, 2021 02:48
@liuzhe-lz liuzhe-lz marked this pull request as ready for review February 3, 2021 02:25
_drop_field(v1, 'versionCheck')
_move_field(v1, v2, 'logLevel', 'log_level')
_drop_field(v1, 'logCollection')
_drop_field(v1, 'useAnnotation') # FIXME
Copy link
Contributor

@J-shang J-shang Feb 21, 2021

Choose a reason for hiding this comment

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

We don’t support multiThread and useAnnotation in this version? And do we still support these by nnictl?

Copy link
Contributor Author

@liuzhe-lz liuzhe-lz Feb 23, 2021

Choose a reason for hiding this comment

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

useAnnotation is handled in nnictl with some hacks. I think it's not elegant but don't want to solve it in this release.
multiThread is not supported. It's easy to implement since the value is directly passed to dispatcher, but I don't want to expose this interface in v2 schema.

@@ -44,6 +44,7 @@ def get_json_content(file_path):
def print_error(*content):
'''Print error information to screen'''
print(Fore.RED + ERROR_INFO + ' '.join([str(c) for c in content]) + Fore.RESET)
raise
Copy link
Contributor

Choose a reason for hiding this comment

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

someplace continuous use twice print_error, like L26 and L39 in this file.

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 my debug code, removed.

from nni.experiment.config.v1 import convert_to_v2
v2 = convert_to_v2(experiment_config).json()
response = rest_post(experiment_url(port), json.dumps(v2), REST_TIME_OUT, show_error=True)
#print(response.text)
Copy link
Contributor

Choose a reason for hiding this comment

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

del the debug comments?

@@ -520,8 +203,7 @@ def launch_experiment(args, experiment_config, mode, experiment_id):
exit(1)
if mode != 'view':
# set platform configuration
set_platform_config(experiment_config['trainingServicePlatform'], experiment_config, args.port,\
experiment_id, rest_process)
raise Exception('TODO')
Copy link
Contributor

Choose a reason for hiding this comment

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

will we do this in this release? nnictl create/resume need to set platform configuration.

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 branch was outdated. Implementation merged from dev branch.

if (exp.trainingService === undefined) {
return exp.maxExecDuration;
} else {
return 99999;
Copy link
Contributor

Choose a reason for hiding this comment

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

if v2, we don't use maxExperimentDuration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

maxExecDuration/maxExperimentDuration has always been optional. Previously the default value is handled by nnictl, which I think is improper.

@@ -60,6 +60,7 @@ class RemoteMachineTrainingService implements TrainingService {
private sshConnectionPromises: any[];

constructor(@component.Inject timer: ObservableTimer) {
super()
Copy link
Contributor

Choose a reason for hiding this comment

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

remote haven't updated yet?

_move_field(v1_machine, v2_machine, 'gpuIndices', 'gpu_indices')
_move_field(v1_machine, v2_machine, 'maxTrialNumPerGpu', 'max_trial_number_per_gpu')
_move_field(v1_machine, v2_machine, 'useActiveGpu', 'use_active_gpu')
_move_field(v1_machine, v2_machine, 'preCommand', 'trial_prepare_command')
Copy link
Contributor

Choose a reason for hiding this comment

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

we just rename this field to pythonPath in #3367 (comment)

_move_field(v1_trial, ts, 'cpuNum', 'trial_cpu_number')
_move_field(v1_trial, ts, 'memoryMB', 'trial_memory_size') # FIXME: unit
_move_field(v1_trial, ts, 'image', 'docker_image')
_drop_field(v1_trial, 'virtualCluster') # FIXME: better error message
Copy link
Contributor

Choose a reason for hiding this comment

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

why drop virtualCluster?

save_algo_meta_data(meta)
else:
print_error(f'Cannot overwrite builtin algorithm')
raise
Copy link
Contributor

@SparkSnail SparkSnail Feb 22, 2021

Choose a reason for hiding this comment

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

If print_error() function contains raise, then does not need to add raise again. BTW, there is no exception here, what is the content of raise?

return result, message
#set trial_config
return set_trial_config(experiment_config, port, config_file_name), err_message
#def set_dlts_config(experiment_config, port, config_file_name):
Copy link
Contributor

Choose a reason for hiding this comment

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

If don't support DLTS anymore, we could delete these code, not comment them.


const foregroundArg: string = parseArg(['--foreground', '-f']);
if (!('true' || 'false').includes(foregroundArg.toLowerCase())) {
console.log(`FATAL: foreground property should only be true or false`);
Copy link
Contributor

Choose a reason for hiding this comment

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

why use console.log() ?

@liuzhe-lz liuzhe-lz marked this pull request as draft February 23, 2021 08:52
@kvartet kvartet mentioned this pull request Mar 11, 2021
78 tasks
@liuzhe-lz liuzhe-lz closed this Mar 22, 2021
@liuzhe-lz liuzhe-lz deleted the dev-config branch June 17, 2021 03:26
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