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

add tutorial for colab support #2700

Merged
merged 9 commits into from
Jul 24, 2020
Merged

add tutorial for colab support #2700

merged 9 commits into from
Jul 24, 2020

Conversation

JunweiSUN
Copy link
Contributor

No description provided.

@scarlett2018 scarlett2018 mentioned this pull request Jul 20, 2020
66 tasks
@@ -0,0 +1,44 @@

# Use NNI on Google Colab
NNI can easily run on Google's colab platform. However, colab doesn't expose its public IP and ports, so by default you can not access NNI's web ui on colab. To solve this, you need a reverse proxy software like `ngrok` or `frp`. This tutorial will show you how to use ngrok to get access to NNI's web ui on colab.
Copy link
Contributor

Choose a reason for hiding this comment

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

use ngrok to access NNI's web ui

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.


```
! nnictl create --config nni_repo/nni/examples/trials/mnist-pytorch/config.yml --port 5000 & # if you want to use gpu, make sure gpuNum >= 1 in config.yml
get_ipython().system_raw('./ngrok http 5000 &')
Copy link
Contributor

@SparkSnail SparkSnail Jul 21, 2020

Choose a reason for hiding this comment

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

what is get_ipython()? why not use ./ngrok http 5000 & directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If use ! ./ngrok http 5000 & directly, the cell running this command will stuck. Not sure why this happened. Use get_ipython() will solve this problem.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think what get_ipython is trying to solve should be stated in tutorial.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.


## Access WebUI with frp

frp is another reverse proxy software with similar functions. However, frp doesn't provide free public urls, so you may need an server with public IP as an frp server. See [here](https://github.com/fatedier/frp) to know more about how to deploy frp.
Copy link
Contributor

Choose a reason for hiding this comment

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

an -> a

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

! ./ngrok authtoken <your-authtoken>
```

3. Start an NNI trail example on a port greater than 1024, then start ngrok with the same port.
Copy link
Contributor

Choose a reason for hiding this comment

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

greater -> bigger

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

@@ -0,0 +1,44 @@

# Use NNI on Google Colab
NNI can easily run on Google's colab platform. However, colab doesn't expose its public IP and ports, so by default you can not access NNI's web ui on colab. To solve this, you need a reverse proxy software like `ngrok` or `frp`. This tutorial will show you how to use ngrok to access NNI's web ui on colab.
Copy link
Contributor

Choose a reason for hiding this comment

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

Google "C"olab

Copy link
Contributor

Choose a reason for hiding this comment

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

"W"eb "UI"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

! ./ngrok authtoken <your-authtoken>
```

3. Start an NNI trail example on a port bigger than 1024, then start ngrok with the same port.
Copy link
Contributor

Choose a reason for hiding this comment

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

an NNI example. What's trail?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.



```
! nnictl create --config nni_repo/nni/examples/trials/mnist-pytorch/config.yml --port 5000 & # if you want to use gpu, make sure gpuNum >= 1 in config.yml
Copy link
Contributor

Choose a reason for hiding this comment

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

You can add comments in text instead of in the 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.

fixed.


```
! nnictl create --config nni_repo/nni/examples/trials/mnist-pytorch/config.yml --port 5000 & # if you want to use gpu, make sure gpuNum >= 1 in config.yml
get_ipython().system_raw('./ngrok http 5000 &')
Copy link
Contributor

Choose a reason for hiding this comment

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

I think what get_ipython is trying to solve should be stated in tutorial.


NNI client is a python API of `nnictl`, which implements the most common used commands. User can use this API to control their experiments in python code instead of command line. Here is an example:

```
Copy link
Contributor

Choose a reason for hiding this comment

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

Might submit this file in a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. These files were introduced by mistake.

@QuanluZhang QuanluZhang removed their request for review July 22, 2020 08:11
@@ -0,0 +1,44 @@

# Use NNI on Google Colab
NNI can easily run on Google Colab platform. However, colab doesn't expose its public IP and ports, so by default you can not access NNI's Web UI on colab. To solve this, you need a reverse proxy software like `ngrok` or `frp`. This tutorial will show you how to use ngrok to access NNI's Web UI on colab.
Copy link
Contributor

Choose a reason for hiding this comment

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

There is still a lot of "colab". Please change them to "Colab".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My bad. Fixed.

! curl -s http://localhost:4040/api/tunnels # don't change the port number 4040
```

You will see an url like http://xxxx.ngrok.io after step 4, open this url and you will find NNI's web ui. Have fun :)
Copy link
Contributor

Choose a reason for hiding this comment

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

Web UI

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

@JunweiSUN JunweiSUN closed this Jul 23, 2020
@JunweiSUN JunweiSUN reopened this Jul 23, 2020
@ultmaster ultmaster merged commit 66f2777 into microsoft:master Jul 24, 2020
@JunweiSUN JunweiSUN deleted the dev-colab-doc branch July 29, 2020 06:00
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