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

migrate nnicli #3334

Merged
merged 6 commits into from
Feb 5, 2021
Merged

migrate nnicli #3334

merged 6 commits into from
Feb 5, 2021

Conversation

J-shang
Copy link
Contributor

@J-shang J-shang commented Jan 25, 2021

need do in next pr:

  1. start experiment by config file
  2. update search space by filepath
  3. support stop experiment when connect experiment by port
  4. update doc & test

@J-shang J-shang closed this Jan 27, 2021
@J-shang J-shang reopened this Jan 27, 2021
@J-shang J-shang mentioned this pull request Jan 29, 2021
94 tasks
@J-shang J-shang requested a review from SparkSnail January 29, 2021 08:43
@@ -142,17 +142,6 @@ testCases:
kwargs:
import_data_file_path: config/nnictl_experiment/test_import.json

- name: nnicli
Copy link
Contributor

Choose a reason for hiding this comment

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

similar test should be added back to test the refactored code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we don't support launch from config file and stop a connected experiment right now, will add back in next pr.

@@ -193,8 +207,369 @@ def run(self, port: int = 8080, debug: bool = False) -> bool:
self.stop()


def get_status(self) -> str:
def connect_experiment(self, port: int):
Copy link
Contributor

Choose a reason for hiding this comment

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

it would be better to have a BaseExperiment class which has basic functionality of an experiment, then write different Experiment classes inheriting BaseExperiment to provide view/launch experiment and to manage experiments

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, we need to discuss this, in the previous discussion, we use parameters to distinguish different launch ways.

@QuanluZhang QuanluZhang requested a review from ultmaster February 2, 2021 02:24
@QuanluZhang
Copy link
Contributor

this pr is about the design of experiment apis, let's fully discuss it

if config is None:
self.config = ExperimentConfig(training_service)
else:
self.config = config
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest print a message when tuner is 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.

yes, I will add a message.

self.get_status()


def _experiment_rest_get(self, port: int, api: str) -> Any:
Copy link
Contributor

Choose a reason for hiding this comment

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

double-line between member functions looks weird to me. Suggest reformatting this file with tools like autopep8.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will confirm with @liuzhe-lz

return "TrialResult(parameter: {} value: {} trialJobId: {})".format(self.parameter, self.value, self.trialJobId)


class TrialMetricData:
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should rewrite these classes with @DataClass?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good suggestion, I will rewrite them

@@ -93,7 +93,7 @@ class NnicliValidator(ITValidator):
def __call__(self, rest_endpoint, experiment_dir, nni_source_dir, **kwargs):
print(rest_endpoint)
exp = Experiment()
exp.connect_experiment(rest_endpoint)
exp.connect_experiment(int(rest_endpoint.split(':')[-1]))
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 the correct way to get the port part? What if the endpoint ends with /?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's a workaround, and will refactor in next pr, this will never be called right now.

@J-shang J-shang merged commit b698806 into microsoft:master Feb 5, 2021
@J-shang J-shang deleted the nnicli branch March 1, 2021 03:21
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