-
Notifications
You must be signed in to change notification settings - Fork 1.8k
update nnicli #2713
update nnicli #2713
Changes from 10 commits
a2b1920
9c8a67f
4892077
dff0871
baa5525
4cff1c5
6844e98
10b842a
8266390
99159ea
bae6522
9db2253
7fd8ef7
f4c3b97
01bdd00
b91948d
50f2e58
d87387b
46d4742
53ecd86
7997dfb
8b67511
c0c3ada
88cdd5c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# NNI Client | ||
|
||
NNI client is a python API of `nnictl`, which implements the most common used commands. Users can use this API to control their experiments, collect experiment results and conduct advanced analyses based on experiment results in python code directly instead of using command line. Here is an example: | ||
|
||
``` | ||
import nnicli as nc | ||
|
||
nc.start_experiment('nni/examples/trials/mnist-pytorch/config.yml', port=9090) # start an experiment | ||
|
||
nc.set_endpoint('http://localhost:9090') # set the experiment's endpoint, i.e., the url of Web UI | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is this API used for? after an experiment is created, the endpoint is fixed, right? why we need to set it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i see, need to set this endpoint in order to query restful APIs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it possible to automatically detect this endpoint? because it is counter intuitive that user is required to set endpoint There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree with you. Maybe we can get the endpoint when user use |
||
|
||
print(nc.version()) # check the version of nni | ||
print(nc.get_experiment_status()) # get the experiment's status | ||
|
||
print(nc.get_job_statistics()) # get the trial job information | ||
print(nc.list_trial_jobs()) # get information for all trial jobs | ||
|
||
nc.stop_nni(port=9090) # stop the experiment | ||
``` | ||
|
||
## References | ||
|
||
```eval_rst | ||
.. autofunction:: nnicli.start_experiment | ||
.. autofunction:: nnicli.set_endpoint | ||
.. autofunction:: nnicli.resume_experiment | ||
.. autofunction:: nnicli.view_experiment | ||
.. autofunction:: nnicli.update_searchspace | ||
.. autofunction:: nnicli.update_concurrency | ||
.. autofunction:: nnicli.update_duration | ||
.. autofunction:: nnicli.update_trailnum | ||
.. autofunction:: nnicli.stop_experiment | ||
.. autofunction:: nnicli.version | ||
.. autofunction:: nnicli.get_experiment_status | ||
.. autofunction:: nnicli.get_experiment_profile | ||
.. autofunction:: nnicli.get_trial_job | ||
.. autofunction:: nnicli.list_trial_jobs | ||
.. autofunction:: nnicli.get_job_statistics | ||
.. autofunction:: nnicli.get_job_metrics | ||
.. autofunction:: nnicli.export_data | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
def validate_digit(value, start, end): | ||
'''validate if a digit is valid''' | ||
if not str(value).isdigit() or int(value) < start or int(value) > end: | ||
raise ValueError('%s must be a digit from %s to %s' % (value, start, end)) | ||
raise ValueError('%s must be a digit from %s to %s' % ('value', start, end)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is strange that you add quote on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there used to be a typo here. If the value is 1, it's strange to raise a error like ValueError('1 must be a digit from 1 to 1000' % (value, start, end)). Instead, it should be ValueError('value must be a digit from 1 to 1000' % (value, start, end)) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. then it should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Goog idea. Will fix. |
||
|
||
def validate_file(path): | ||
'''validate if a file exist''' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
common used -> commonly used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.