Getting started¶
Install nsml¶
Download the NSML for your platform from the https://ai.nsml.navercorp.com/download page.
Or you can use wget command. (The example below help you download the mac version of NSML.)
wget https://github.com/n-CLAIR/nsml_client-hack/raw/master/nsml_client.darwin.amd64.hack.tar.gz
Install local-nsml¶
- What is a local-nsml?
This is a Python package to prevent the ImportError on the NSML library when debugging code posted to NSML locally.
Assuming pip is already installed, you can enter the following command.
pip install git+https://github.com/n-CLAIR/nsml-local
Login¶
You need to login to use NSML.Log in with your Github username and password.In the source code below shows log in using nsmlteam Github ID.
$ nsml login INFO[2019/07/18 16:05:38.667] connecting to ai-cli.nsml.navercorp.com:18553 GitHub Username: nsml-admin GitHub Password: **************** INFO[2019/07/18 16:05:55.570] Welcome to NSML!
Path registration¶
It is recommended that you set the path to run nsml on multiple paths. If you get the following error message when you run nsml login, you need to set the path.
-bash: nsml: command not found
Let’s look at how to set the path. First, enter the folder where the nsml exe. file is located, then type pwd and copy the path. Assume that pwd is
/Users/user/Documents/nsml_client.darwin.amd64.hack
.$ pwd /Users/user/Documents/nsml_client.darwin.amd64.hackThen run the command
export PATH=$PATH:
and path from pwd. The entire command isexport PATH = $ PATH: [pwd path]
.$ export PATH=$PATH:/Users/user/Documents/nsml_client.darwin.amd64.hack $Once the path is set up, nsml login is available on any path.
Run a session¶
When you type nsml run command, dataset must be specified with the -d optionThe dataset name in the example is mnist and is specified with -d mnist.You can optionally specify an entry file with
-e main.py
.nsml run -d mnist -e main.py
In the example below, we’ll run the baseline code for this hackathon through nsml run.
Clone Github’s baseline repository first.
$ git clone https://github.com/clovaai/speech_hackathon_2019.git Cloning into 'airush'... remote: Enumerating objects: 48, done. remote: Counting objects: 100% (48/48), done. remote: Compressing objects: 100% (31/31), done. remote: Total 48 (delta 14), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (48/48), done. $ nsml run -d mnist -e main.py INFO[2019/07/18 16:11:20.959] .nsmlignore check - start INFO[2019/07/18 16:11:20.959] .nsmlignore check - done INFO[2019/07/18 16:11:20.996] file integrity check - start INFO[2019/07/18 16:11:20.998] file integrity check - done INFO[2019/07/18 16:11:21.001] .nsmlignore 16 B - start INFO[2019/07/18 16:11:21.001] .nsmlignore 16 B - done (1/5 20.00%) (16 B/18 KiB 0.09%) INFO[2019/07/18 16:11:21.001] README.md 9.1 KiB - start INFO[2019/07/18 16:11:21.001] README.md 9.1 KiB - done (2/5 40.00%) (9.2 KiB/18 KiB 50.32%) INFO[2019/07/18 16:11:21.001] data_loader.py 1.5 KiB - start INFO[2019/07/18 16:11:21.002] data_loader.py 1.5 KiB - done (3/5 60.00%) (11 KiB/18 KiB 58.57%) INFO[2019/07/18 16:11:21.002] main.py 7.3 KiB - start INFO[2019/07/18 16:11:21.002] main.py 7.3 KiB - done (4/5 80.00%) (18 KiB/18 KiB 98.81%) INFO[2019/07/18 16:11:21.002] setup.py 221 B - start INFO[2019/07/18 16:11:21.002] setup.py 221 B - done (5/5 100.00%) (18 KiB/18 KiB 100.00%) ..... Building docker image. It might take for a while ...... Session nsmlteam/mnist/1 is startedSo far, we’ve looked at the basic usage of NSML. In the next part, we will look at the commands used in NSML.