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

add python api example and update doc #3396

Merged
merged 13 commits into from
Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion docs/en_US/Tutorial/HowToLaunchFromPython.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Now, you have successfully launched an NNI experiment. And you can type ``localh

Example
-------
Below is an example for this new launching approach. You can also find this code in :githublink:`mnist-tfv2/launch.py <examples/trials/mnist-tfv2/launch.py>` .
Below is an example for this new launching approach. You can also find this code in :githublink:`mnist-tfv2/launch.py <examples/trials/mnist-tfv2/launch.py>`.

.. code-block:: python

Expand Down Expand Up @@ -90,6 +90,15 @@ Below is an example for this new launching approach. You can also find this code

experiment.run(8081)

View and Control Experiment with Python API
-------------------------------------------
We migrate the API in `nnicli` to this new launching approach.
Launch the experiment by `Experiment.start()` instead of `Experiment.run()`, then you can use these APIs in interactive mode.
`Experiment.run()` polls the experiment status and will automatically call `Experiment.stop()` when the experiment finished.
`Experiment.start()` just launch a new experiment, so you need to manually stop the experiment by calling `Experiment.stop()`.
If you launch the experiment by `nnictl` and also want to use these APIs, you can use `Experiment.connect()` to connect to an exsit experiment.
An example with Jupyter Notebook has been provided, view :githublink:`python_api_quickstart.ipynb <examples/trials/sklearn/classification/python_api_quickstart.ipynb>`.

API
---

Expand Down
Loading