A quick script to setup SSH to Kaggle Kernel for Deep Learning. In order to use that sexy P100 for free (and without many restriction of Jupyter Notebook) :P
Kaggle had blocked any attempt of creating an SSH tunneling into a running Kaggle kernel. So unfortunately this repo is NO LONGER WORKS. Attempting to use the script presented in this repo might violate Term and Conditions of Kaggle and WILL GET YOUR KAGGLE ACCOUNT BANNED!
While we wait for Kaggle to change its policy, the best solution for a free (or relatively cheap) GPU instance with a full SSH connection is GOOGLE COLAB (As well as Colab Pro) with a Tesla V100 for up to 24 hours. I have created another package that can help you get an SSH tunnel to a running Colab notebook in this repo: https://github.com/lamhoangtung/colab_ssh. You guys should use it instead.
Thanks for checking by ✌️ !
- Go to https://dashboard.ngrok.com/auth and get your authentication token after register with Google or Github (You only have to do this once)
- Modify the get_ssh.py file:
- Replace your
ngrok
authentication token at line7
in - Set a password for your user at line
10
(just in case you need it, we will use SSH Key authentication from now on) - Create a public Github Gist with file name
authorized_keys
and paste your public SSH key (usually located at~/.ssh/id_rsa.pub
) as the content of the gist. - If you don't have an SSH key (RSA Key Pair), please refer to the first step in this article
- Replace the link to raw content of your gist at line
11
- Replace your
-
Step 1: Create a new Kaggle kernel
-
Step 2: Go to Kernel Settings and turn on
GPU
andInternet
-
Step 3: Copy the whole content of the modified get_ssh.py and paste to the kernel as the first block of code.
-
Step 4: Click
Commit
on the top right conner and wait a minutes for everything to set up. You should see a pop-up windows like this:Save the host address information
tcp://0.tcp.ngrok.io:16360
to SSH. If some how you forget the host address and port, go toyour Ngrok Dashboard -> Status
and you will found them again.
ssh [email protected] -p 16360
<-- port number dictated in above output- With root password also dictated in above output
- You won't have to use the password since we already used SSH key authentication to logging into your server
- You can turn off the browser, disconnect from the server and it will still running. But keep in mind this server can only live for 9 hours at max.
-
Kaggle Kernel already provide many Machine Learning and Deep Learning package and library ready to use with a powerful NVIDIA Tesla P100 GPU so you might be good to go. But if you want something more that I usually use. Run this to get more:
cd ~ wget https://github.com/lamhoangtung/kaggle-kernel-setup/raw/master/install_common.sh chmod 777 install_common.sh ./install_common.sh
And follow the instruction.
-
You only need to
Commit
again in the same kernel to get everything up and running again after terminate the server.Host address
information will be reset each time you commit. -
You will need multiple
Kaggle
account and multiplengrok
account to get multiple server running at the same time.
-
Go to https://www.kaggle.com/kernels and look at the
Your Recent Kernels
section and hitStop
. -
If you encounter any problem while setting up the connection. Please terminate the server as above. Then open the kernel in editor mode and go to
Run > Power off
, then turn it on manually. -
Keep in mind everything will be lost (including process and files, ...) when you
Power off
orTerminate
the kernel