ExperimentConfig.rst 31.7 KB
Newer Older
kvartet's avatar
kvartet committed
1
2
3
4
Experiment Config Reference (legacy)
====================================

This is the previous version (V1) of experiment configuration specification. It is still supported for now, but we recommend users to use `the new version of experiment configuration (V2) <../reference/experiment_config.rst>`_.
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

A config file is needed when creating an experiment. The path of the config file is provided to ``nnictl``.
The config file is in YAML format.
This document describes the rules to write the config file, and provides some examples and templates.


* `Experiment Config Reference <#experiment-config-reference>`__

  * `Template <#template>`__
  * `Configuration Spec <#configuration-spec>`__

    * `authorName <#authorname>`__
    * `experimentName <#experimentname>`__
    * `trialConcurrency <#trialconcurrency>`__
    * `maxExecDuration <#maxexecduration>`__
    * `versionCheck <#versioncheck>`__
    * `debug <#debug>`__
    * `maxTrialNum <#maxtrialnum>`__
Ni Hao's avatar
Ni Hao committed
23
    * `maxTrialDuration <#maxtrialduration>`__
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
    * `trainingServicePlatform <#trainingserviceplatform>`__
    * `searchSpacePath <#searchspacepath>`__
    * `useAnnotation <#useannotation>`__
    * `multiThread <#multithread>`__
    * `nniManagerIp <#nnimanagerip>`__
    * `logDir <#logdir>`__
    * `logLevel <#loglevel>`__
    * `logCollection <#logcollection>`__
    * `tuner <#tuner>`__

      * `builtinTunerName <#builtintunername>`__
      * `codeDir <#codedir>`__
      * `classFileName <#classfilename>`__
      * `className <#classname>`__
      * `classArgs <#classargs>`__
      * `gpuIndices <#gpuindices>`__
      * `includeIntermediateResults <#includeintermediateresults>`__

    * `assessor <#assessor>`__

      * `builtinAssessorName <#builtinassessorname>`__
      * `codeDir <#codedir-1>`__
      * `classFileName <#classfilename-1>`__
      * `className <#classname-1>`__
      * `classArgs <#classargs-1>`__

    * `advisor <#advisor>`__

      * `builtinAdvisorName <#builtinadvisorname>`__
      * `codeDir <#codedir-2>`__
      * `classFileName <#classfilename-2>`__
      * `className <#classname-2>`__
      * `classArgs <#classargs-2>`__
      * `gpuIndices <#gpuindices-1>`__

    * `trial <#trial>`__
    * `localConfig <#localconfig>`__

      * `gpuIndices <#gpuindices-2>`__
      * `maxTrialNumPerGpu <#maxtrialnumpergpu>`__
      * `useActiveGpu <#useactivegpu>`__

    * `machineList <#machinelist>`__

      * `ip <#ip>`__
      * `port <#port>`__
      * `username <#username>`__
      * `passwd <#passwd>`__
      * `sshKeyPath <#sshkeypath>`__
      * `passphrase <#passphrase>`__
      * `gpuIndices <#gpuindices-3>`__
      * `maxTrialNumPerGpu <#maxtrialnumpergpu-1>`__
      * `useActiveGpu <#useactivegpu-1>`__
77
      * `pythonPath <#pythonPath>`__
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257

    * `kubeflowConfig <#kubeflowconfig>`__

      * `operator <#operator>`__
      * `storage <#storage>`__
      * `nfs <#nfs>`__
      * `keyVault <#keyvault>`__
      * `azureStorage <#azurestorage>`__
      * `uploadRetryCount <#uploadretrycount>`__

    * `paiConfig <#paiconfig>`__

      * `userName <#username>`__
      * `password <#password>`__
      * `token <#token>`__
      * `host <#host>`__
      * `reuse <#reuse>`__

  * `Examples <#examples>`__

    * `Local mode <#local-mode>`__
    * `Remote mode <#remote-mode>`__
    * `PAI mode <#pai-mode>`__
    * `Kubeflow mode <#kubeflow-mode>`__
    * `Kubeflow with azure storage <#kubeflow-with-azure-storage>`__

Template
--------


* **Light weight (without Annotation and Assessor)**

.. code-block:: yaml

   authorName:
   experimentName:
   trialConcurrency:
   maxExecDuration:
   maxTrialNum:
   #choice: local, remote, pai, kubeflow
   trainingServicePlatform:
   searchSpacePath:
   #choice: true, false, default: false
   useAnnotation:
   #choice: true, false, default: false
   multiThread:
   tuner:
     #choice: TPE, Random, Anneal, Evolution
     builtinTunerName:
     classArgs:
       #choice: maximize, minimize
       optimize_mode:
     gpuIndices:
   trial:
     command:
     codeDir:
     gpuNum:
   #machineList can be empty if the platform is local
   machineList:
     - ip:
       port:
       username:
       passwd:


* **Use Assessor**

.. code-block:: yaml

   authorName:
   experimentName:
   trialConcurrency:
   maxExecDuration:
   maxTrialNum:
   #choice: local, remote, pai, kubeflow
   trainingServicePlatform:
   searchSpacePath:
   #choice: true, false, default: false
   useAnnotation:
   #choice: true, false, default: false
   multiThread:
   tuner:
     #choice: TPE, Random, Anneal, Evolution
     builtinTunerName:
     classArgs:
       #choice: maximize, minimize
       optimize_mode:
     gpuIndices:
   assessor:
     #choice: Medianstop
     builtinAssessorName:
     classArgs:
       #choice: maximize, minimize
       optimize_mode:
   trial:
     command:
     codeDir:
     gpuNum:
   #machineList can be empty if the platform is local
   machineList:
     - ip:
       port:
       username:
       passwd:


* **Use Annotation**

.. code-block:: yaml

   authorName:
   experimentName:
   trialConcurrency:
   maxExecDuration:
   maxTrialNum:
   #choice: local, remote, pai, kubeflow
   trainingServicePlatform:
   #choice: true, false, default: false
   useAnnotation:
   #choice: true, false, default: false
   multiThread:
   tuner:
     #choice: TPE, Random, Anneal, Evolution
     builtinTunerName:
     classArgs:
       #choice: maximize, minimize
       optimize_mode:
     gpuIndices:
   assessor:
     #choice: Medianstop
     builtinAssessorName:
     classArgs:
       #choice: maximize, minimize
       optimize_mode:
   trial:
     command:
     codeDir:
     gpuNum:
   #machineList can be empty if the platform is local
   machineList:
     - ip:
       port:
       username:
       passwd:

Configuration Spec
------------------

authorName
^^^^^^^^^^

Required. String.

The name of the author who create the experiment.

*TBD: add default value.*

experimentName
^^^^^^^^^^^^^^

Required. String.

The name of the experiment created.

*TBD: add default value.*

trialConcurrency
^^^^^^^^^^^^^^^^

Required. Integer between 1 and 99999.

Specifies the max num of trial jobs run simultaneously.

If trialGpuNum is bigger than the free gpu numbers, and the trial jobs running simultaneously can not reach **trialConcurrency** number, some trial jobs will be put into a queue to wait for gpu allocation.

maxExecDuration
^^^^^^^^^^^^^^^

Optional. String. Default: 999d.

Ni Hao's avatar
Ni Hao committed
258
**maxExecDuration** specifies the max duration time of an experiment. The unit of the time is {**s**\ , **m**\ , **h**\ , **d**\ }, which means {*seconds*\ , *minutes*\ , *hours*\ , *days*\ }.
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282

Note: The maxExecDuration spec set the time of an experiment, not a trial job. If the experiment reach the max duration time, the experiment will not stop, but could not submit new trial jobs any more.

versionCheck
^^^^^^^^^^^^

Optional. Bool. Default: true.

NNI will check the version of nniManager process and the version of trialKeeper in remote, pai and kubernetes platform. If you want to disable version check, you could set versionCheck be false.

debug
^^^^^

Optional. Bool. Default: false.

Debug mode will set versionCheck to false and set logLevel to be 'debug'.

maxTrialNum
^^^^^^^^^^^

Optional. Integer between 1 and 99999. Default: 99999.

Specifies the max number of trial jobs created by NNI, including succeeded and failed jobs.

Ni Hao's avatar
Ni Hao committed
283
284
285
286
287
288
289
maxTrialDuration
^^^^^^^^^^^^^^^^

Optional. String. Default: 999d.

**maxTrialDuration** specifies the max duration time of each trial job. The unit of the time is {**s**\ , **m**\ , **h**\ , **d**\ }, which means {*seconds*\ , *minutes*\ , *hours*\ , *days*\ }. If current trial job reach the max duration time, this trial job will stop.

290
291
292
293
294
trainingServicePlatform
^^^^^^^^^^^^^^^^^^^^^^^

Required. String.

295
Specifies the platform to run the experiment, including **local**\ , **remote**\ , **pai**\ , **kubeflow**\ , **frameworkcontroller**.
296
297
298
299
300
301


* 
  **local** run an experiment on local ubuntu machine.

* 
302
  **remote** submit trial jobs to remote ubuntu machines, and **machineList** field should be filed in order to set up SSH connection to remote machine.
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375

* 
  **pai**  submit trial jobs to `OpenPAI <https://github.com/Microsoft/pai>`__ of Microsoft. For more details of pai configuration, please refer to `Guide to PAI Mode <../TrainingService/PaiMode.rst>`__

* 
  **kubeflow** submit trial jobs to `kubeflow <https://www.kubeflow.org/docs/about/kubeflow/>`__\ , NNI support kubeflow based on normal kubernetes and `azure kubernetes <https://azure.microsoft.com/en-us/services/kubernetes-service/>`__. For detail please refer to `Kubeflow Docs <../TrainingService/KubeflowMode.rst>`__

* 
  **adl** submit trial jobs to `AdaptDL <https://www.kubeflow.org/docs/about/kubeflow/>`__\ , NNI support AdaptDL on Kubernetes cluster. For detail please refer to `AdaptDL Docs <../TrainingService/AdaptDLMode.rst>`__

* 
  TODO: explain frameworkcontroller.

searchSpacePath
^^^^^^^^^^^^^^^

Optional. Path to existing file.

Specifies the path of search space file, which should be a valid path in the local linux machine.

The only exception that **searchSpacePath** can be not fulfilled is when ``useAnnotation=True``.

useAnnotation
^^^^^^^^^^^^^

Optional. Bool. Default: false.

Use annotation to analysis trial code and generate search space.

Note: if **useAnnotation** is true, the searchSpacePath field should be removed.

multiThread
^^^^^^^^^^^

Optional. Bool. Default: false.

Enable multi-thread mode for dispatcher. If multiThread is enabled, dispatcher will start a thread to process each command from NNI Manager.

nniManagerIp
^^^^^^^^^^^^

Optional. String. Default: eth0 device IP.

Set the IP address of the machine on which NNI manager process runs. This field is optional, and if it's not set, eth0 device IP will be used instead.

Note: run ``ifconfig`` on NNI manager's machine to check if eth0 device exists. If not, **nniManagerIp** is recommended to set explicitly.

logDir
^^^^^^

Optional. Path to a directory. Default: ``<user home directory>/nni-experiments``.

Configures the directory to store logs and data of the experiment.

logLevel
^^^^^^^^

Optional. String. Default: ``info``.

Sets log level for the experiment. Available log levels are: ``trace``\ , ``debug``\ , ``info``\ , ``warning``\ , ``error``\ , ``fatal``.

logCollection
^^^^^^^^^^^^^

Optional. ``http`` or ``none``. Default: ``none``.

Set the way to collect log in remote, pai, kubeflow, frameworkcontroller platform. There are two ways to collect log, one way is from ``http``\ , trial keeper will post log content back from http request in this way, but this way may slow down the speed to process logs in trialKeeper. The other way is ``none``\ , trial keeper will not post log content back, and only post job metrics. If your log content is too big, you could consider setting this param be ``none``.

tuner
^^^^^

Required.

376
Specifies the tuner algorithm in the experiment, there are two kinds of ways to set tuner. One way is to use tuner provided by NNI sdk (built-in tuners), in which case you need to set **builtinTunerName** and **classArgs**. Another way is to use users' own tuner file, in which case **codeDirectory**\ , **classFileName**\ , **className** and **classArgs** are needed. *Users must choose exactly one way.*
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429

builtinTunerName
^^^^^^^^^^^^^^^^

Required if using built-in tuners. String.

Specifies the name of system tuner, NNI sdk provides different tuners introduced `here <../Tuner/BuiltinTuner.rst>`__.

codeDir
^^^^^^^

Required if using customized tuners. Path relative to the location of config file.

Specifies the directory of tuner code.

classFileName
^^^^^^^^^^^^^

Required if using customized tuners. File path relative to **codeDir**.

Specifies the name of tuner file.

className
^^^^^^^^^

Required if using customized tuners. String.

Specifies the name of tuner class.

classArgs
^^^^^^^^^

Optional. Key-value pairs. Default: empty.

Specifies the arguments of tuner algorithm. Please refer to `this file <../Tuner/BuiltinTuner.rst>`__ for the configurable arguments of each built-in tuner.

gpuIndices
^^^^^^^^^^

Optional. String. Default: empty.

Specifies the GPUs that can be used by the tuner process. Single or multiple GPU indices can be specified. Multiple GPU indices are separated by comma ``,``. For example, ``1``\ , or ``0,1,3``. If the field is not set, no GPU will be visible to tuner (by setting ``CUDA_VISIBLE_DEVICES`` to be an empty string).

includeIntermediateResults
^^^^^^^^^^^^^^^^^^^^^^^^^^

Optional. Bool. Default: false.

If **includeIntermediateResults** is true, the last intermediate result of the trial that is early stopped by assessor is sent to tuner as final result.

assessor
^^^^^^^^

430
Specifies the assessor algorithm to run an experiment. Similar to tuners, there are two kinds of ways to set assessor. One way is to use assessor provided by NNI sdk. Users need to set **builtinAssessorName** and **classArgs**. Another way is to use users' own assessor file, and users need to set **codeDirectory**\ , **classFileName**\ , **className** and **classArgs**. *Users must choose exactly one way.*
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473

By default, there is no assessor enabled.

builtinAssessorName
^^^^^^^^^^^^^^^^^^^

Required if using built-in assessors. String.

Specifies the name of built-in assessor, NNI sdk provides different assessors introduced `here <../Assessor/BuiltinAssessor.rst>`__.

codeDir
^^^^^^^

Required if using customized assessors. Path relative to the location of config file.

Specifies the directory of assessor code.

classFileName
^^^^^^^^^^^^^

Required if using customized assessors. File path relative to **codeDir**.

Specifies the name of assessor file.

className
^^^^^^^^^

Required if using customized assessors. String.

Specifies the name of assessor class.

classArgs
^^^^^^^^^

Optional. Key-value pairs. Default: empty.

Specifies the arguments of assessor algorithm.

advisor
^^^^^^^

Optional.

474
Specifies the advisor algorithm in the experiment. Similar to tuners and assessors, there are two kinds of ways to specify advisor. One way is to use advisor provided by NNI sdk, need to set **builtinAdvisorName** and **classArgs**. Another way is to use users' own advisor file, and need to set **codeDirectory**\ , **classFileName**\ , **className** and **classArgs**.
475
476
477
478
479
480

When advisor is enabled, settings of tuners and advisors will be bypassed.

builtinAdvisorName
^^^^^^^^^^^^^^^^^^

481
Specifies the name of a built-in advisor. NNI sdk provides `BOHB <../Tuner/BohbAdvisor.rst>`__ and `Hyperband <../Tuner/HyperbandAdvisor.rst>`__.
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564

codeDir
^^^^^^^

Required if using customized advisors. Path relative to the location of config file.

Specifies the directory of advisor code.

classFileName
^^^^^^^^^^^^^

Required if using customized advisors. File path relative to **codeDir**.

Specifies the name of advisor file.

className
^^^^^^^^^

Required if using customized advisors. String.

Specifies the name of advisor class.

classArgs
^^^^^^^^^

Optional. Key-value pairs. Default: empty.

Specifies the arguments of advisor.

gpuIndices
^^^^^^^^^^

Optional. String. Default: empty.

Specifies the GPUs that can be used. Single or multiple GPU indices can be specified. Multiple GPU indices are separated by comma ``,``. For example, ``1``\ , or ``0,1,3``. If the field is not set, no GPU will be visible to tuner (by setting ``CUDA_VISIBLE_DEVICES`` to be an empty string).

trial
^^^^^

Required. Key-value pairs.

In local and remote mode, the following keys are required.


* 
  **command**\ : Required string. Specifies the command to run trial process.

* 
  **codeDir**\ : Required string. Specifies the directory of your own trial file. This directory will be automatically uploaded in remote mode.

* 
  **gpuNum**\ : Optional integer. Specifies the num of gpu to run the trial process. Default value is 0.

In PAI mode, the following keys are required.


* 
  **command**\ : Required string. Specifies the command to run trial process.

* 
  **codeDir**\ : Required string. Specifies the directory of the own trial file. Files in the directory will be uploaded in PAI mode.

* 
  **gpuNum**\ : Required integer. Specifies the num of gpu to run the trial process. Default value is 0.

* 
  **cpuNum**\ : Required integer. Specifies the cpu number of cpu to be used in pai container.

* 
  **memoryMB**\ : Required integer. Set the memory size to be used in pai container, in megabytes.

* 
  **image**\ : Required string. Set the image to be used in pai.

* 
  **authFile**\ : Optional string. Used to provide Docker registry which needs authentication for image pull in PAI. `Reference <https://github.com/microsoft/pai/blob/2ea69b45faa018662bc164ed7733f6fdbb4c42b3/docs/faq.rst#q-how-to-use-private-docker-registry-job-image-when-submitting-an-openpai-job>`__.

* 
  **shmMB**\ : Optional integer. Shared memory size of container.

* 
  **portList**\ : List of key-values pairs with ``label``\ , ``beginAt``\ , ``portNumber``. See `job tutorial of PAI <https://github.com/microsoft/pai/blob/master/docs/job_tutorial.rst>`__ for details.

565
566
.. cannot find `Reference <https://github.com/microsoft/pai/blob/2ea69b45faa018662bc164ed7733f6fdbb4c42b3/docs/faq.rst#q-how-to-use-private-docker-registry-job-image-when-submitting-an-openpai-job>`__  and `job tutorial of PAI <https://github.com/microsoft/pai/blob/master/docs/job_tutorial.rst>`__ 

567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
In Kubeflow mode, the following keys are required.


* 
  **codeDir**\ : The local directory where the code files are in.

* 
  **ps**\ : An optional configuration for kubeflow's tensorflow-operator, which includes


  * 
    **replicas**\ : The replica number of **ps** role.

  * 
    **command**\ : The run script in **ps**\ 's container.

  * 
    **gpuNum**\ : The gpu number to be used in **ps** container.

  * 
    **cpuNum**\ : The cpu number to be used in **ps** container.

  * 
    **memoryMB**\ : The memory size of the container.

  * 
    **image**\ : The image to be used in **ps**.

* 
  **worker**\ : An optional configuration for kubeflow's tensorflow-operator.


  * 
    **replicas**\ : The replica number of **worker** role.

  * 
    **command**\ : The run script in **worker**\ 's container.

  * 
    **gpuNum**\ : The gpu number to be used in **worker** container.

  * 
    **cpuNum**\ : The cpu number to be used in **worker** container.

  * 
    **memoryMB**\ : The memory size of the container.

  * 
    **image**\ : The image to be used in **worker**.

localConfig
^^^^^^^^^^^

Optional in local mode. Key-value pairs.

622
Only applicable if **trainingServicePlatform** is set to ``local``\ , otherwise there should not be **localConfig** section in configuration file.
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714

gpuIndices
^^^^^^^^^^

Optional. String. Default: none.

Used to specify designated GPU devices for NNI, if it is set, only the specified GPU devices are used for NNI trial jobs. Single or multiple GPU indices can be specified. Multiple GPU indices should be separated with comma (\ ``,``\ ), such as ``1`` or  ``0,1,3``. By default, all GPUs available will be used.

maxTrialNumPerGpu
^^^^^^^^^^^^^^^^^

Optional. Integer. Default: 1.

Used to specify the max concurrency trial number on a GPU device.

useActiveGpu
^^^^^^^^^^^^

Optional. Bool. Default: false.

Used to specify whether to use a GPU if there is another process. By default, NNI will use the GPU only if there is no other active process in the GPU. If **useActiveGpu** is set to true, NNI will use the GPU regardless of another processes. This field is not applicable for NNI on Windows.

machineList
^^^^^^^^^^^

Required in remote mode. A list of key-value pairs with the following keys.

ip
^^

Required. IP address or host name that is accessible from the current machine.

The IP address or host name of remote machine.

port
^^^^

Optional. Integer. Valid port. Default: 22.

The ssh port to be used to connect machine.

username
^^^^^^^^

Required if authentication with username/password. String.

The account of remote machine.

passwd
^^^^^^

Required if authentication with username/password. String.

Specifies the password of the account.

sshKeyPath
^^^^^^^^^^

Required if authentication with ssh key. Path to private key file.

If users use ssh key to login remote machine, **sshKeyPath** should be a valid path to a ssh key file.

*Note: if users set passwd and sshKeyPath simultaneously, NNI will try passwd first.*

passphrase
^^^^^^^^^^

Optional. String.

Used to protect ssh key, which could be empty if users don't have passphrase.

gpuIndices
^^^^^^^^^^

Optional. String. Default: none.

Used to specify designated GPU devices for NNI, if it is set, only the specified GPU devices are used for NNI trial jobs. Single or multiple GPU indices can be specified. Multiple GPU indices should be separated with comma (\ ``,``\ ), such as ``1`` or  ``0,1,3``. By default, all GPUs available will be used.

maxTrialNumPerGpu
^^^^^^^^^^^^^^^^^

Optional. Integer. Default: 1.

Used to specify the max concurrency trial number on a GPU device.

useActiveGpu
^^^^^^^^^^^^

Optional. Bool. Default: false.

Used to specify whether to use a GPU if there is another process. By default, NNI will use the GPU only if there is no other active process in the GPU. If **useActiveGpu** is set to true, NNI will use the GPU regardless of another processes. This field is not applicable for NNI on Windows.

715
pythonPath
716
717
718
719
^^^^^^^^^^

Optional. String.

720
Users can configure the python path environment on remote machine by setting **pythonPath**.
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767

remoteConfig
^^^^^^^^^^^^

Optional field in remote mode. Users could set per machine information in ``machineList`` field, and set global configuration for remote mode in this field.

reuse
^^^^^

Optional. Bool. default: ``false``. It's an experimental feature.

If it's true, NNI will reuse remote jobs to run as many as possible trials. It can save time of creating new jobs. User needs to make sure each trial can run independent in same job, for example, avoid loading checkpoint from previous trials. 

kubeflowConfig
^^^^^^^^^^^^^^

operator
^^^^^^^^

Required. String. Has to be ``tf-operator`` or ``pytorch-operator``.

Specifies the kubeflow's operator to be used, NNI support ``tf-operator`` in current version.

storage
^^^^^^^

Optional. String. Default. ``nfs``.

Specifies the storage type of kubeflow, including ``nfs`` and ``azureStorage``.

nfs
^^^

Required if using nfs. Key-value pairs.


* 
  **server** is the host of nfs server.

* 
  **path** is the mounted path of nfs.

keyVault
^^^^^^^^

Required if using azure storage. Key-value pairs.

768
Set **keyVault** to storage the private key of your azure storage account. Refer to `the doc <https://docs.microsoft.com/en-us/azure/key-vault/key-vault-manage-with-cli2>`__ .
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835


* 
  **vaultName** is the value of ``--vault-name`` used in az command.

* 
  **name** is the value of ``--name`` used in az command.

azureStorage
^^^^^^^^^^^^

Required if using azure storage. Key-value pairs.

Set azure storage account to store code files.


* 
  **accountName** is the name of azure storage account.

* 
  **azureShare** is the share of the azure file storage.

uploadRetryCount
^^^^^^^^^^^^^^^^

Required if using azure storage. Integer between 1 and 99999.

If upload files to azure storage failed, NNI will retry the process of uploading, this field will specify the number of attempts to re-upload files.

paiConfig
^^^^^^^^^

userName
^^^^^^^^

Required. String.

The user name of your pai account.

password
^^^^^^^^

Required if using password authentication. String.

The password of the pai account.

token
^^^^^

Required if using token authentication. String.

Personal access token that can be retrieved from PAI portal.

host
^^^^

Required. String.

The hostname of IP address of PAI.

reuse
^^^^^

Optional. Bool. default: ``false``. It's an experimental feature.

If it's true, NNI will reuse OpenPAI jobs to run as many as possible trials. It can save time of creating new jobs. User needs to make sure each trial can run independent in same job, for example, avoid loading checkpoint from previous trials.

836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
sharedStorage
^^^^^^^^^^^^^

storageType
^^^^^^^^^^^

Required. String.

The type of the storage, support ``NFS`` and ``AzureBlob``.

localMountPoint
^^^^^^^^^^^^^^^

Required. String.

J-shang's avatar
J-shang committed
851
The absolute or relative path that the storage has been or will be mounted in local. If the path does not exist, it will be created automatically. Recommended to use an absolute path. i.e. ``/tmp/nni-shared-storage``.
852
853
854
855
856
857

remoteMountPoint
^^^^^^^^^^^^^^^^

Required. String.

J-shang's avatar
J-shang committed
858
The absolute or relative path that the storage will be mounted in remote. If the path does not exist, it will be created automatically. Note that the directory must be empty if using AzureBlob. Recommended to use a relative path. i.e. ``./nni-shared-storage``.
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892

localMounted
^^^^^^^^^^^^

Required. String.

One of ``usermount``, ``nnimount`` or ``nomount``. ``usermount`` means you have already mount this storage on localMountPoint. ``nnimount`` means nni will try to mount this storage on localMountPoint. ``nomount`` means storage will not mount in local machine, will support partial storages in the future.

nfsServer
^^^^^^^^^

Optional. String.

Required if using NFS storage. The NFS server host.

exportedDirectory
^^^^^^^^^^^^^^^^^

Optional. String.

Required if using NFS storage. The exported directory of NFS server.

storageAccountName
^^^^^^^^^^^^^^^^^^

Optional. String.

Required if using AzureBlob storage. The azure storage account name.

storageAccountKey
^^^^^^^^^^^^^^^^^

Optional. String.

J-shang's avatar
J-shang committed
893
Required if using AzureBlob storage. The azure storage account key.
894
895
896
897
898
899
900
901

containerName
^^^^^^^^^^^^^

Optional. String.

Required if using AzureBlob storage. The AzureBlob container name.

902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
Examples
--------

Local mode
^^^^^^^^^^

If users want to run trial jobs in local machine, and use annotation to generate search space, could use the following config:

.. code-block:: yaml

     authorName: test
     experimentName: test_experiment
     trialConcurrency: 3
     maxExecDuration: 1h
     maxTrialNum: 10
     #choice: local, remote, pai, kubeflow
     trainingServicePlatform: local
     #choice: true, false
     useAnnotation: true
     tuner:
       #choice: TPE, Random, Anneal, Evolution
       builtinTunerName: TPE
       classArgs:
         #choice: maximize, minimize
         optimize_mode: maximize
     trial:
       command: python3 mnist.py
       codeDir: /nni/mnist
       gpuNum: 0

You can add assessor configuration.

.. code-block:: yaml

     authorName: test
     experimentName: test_experiment
     trialConcurrency: 3
     maxExecDuration: 1h
     maxTrialNum: 10
     #choice: local, remote, pai, kubeflow
     trainingServicePlatform: local
     searchSpacePath: /nni/search_space.json
     #choice: true, false
     useAnnotation: false
     tuner:
       #choice: TPE, Random, Anneal, Evolution
       builtinTunerName: TPE
       classArgs:
         #choice: maximize, minimize
         optimize_mode: maximize
     assessor:
       #choice: Medianstop
       builtinAssessorName: Medianstop
       classArgs:
         #choice: maximize, minimize
         optimize_mode: maximize
     trial:
       command: python3 mnist.py
       codeDir: /nni/mnist
       gpuNum: 0

Or you could specify your own tuner and assessor file as following,

.. code-block:: yaml

     authorName: test
     experimentName: test_experiment
     trialConcurrency: 3
     maxExecDuration: 1h
     maxTrialNum: 10
     #choice: local, remote, pai, kubeflow
     trainingServicePlatform: local
     searchSpacePath: /nni/search_space.json
     #choice: true, false
     useAnnotation: false
     tuner:
       codeDir: /nni/tuner
       classFileName: mytuner.py
       className: MyTuner
       classArgs:
         #choice: maximize, minimize
         optimize_mode: maximize
     assessor:
       codeDir: /nni/assessor
       classFileName: myassessor.py
       className: MyAssessor
       classArgs:
         #choice: maximize, minimize
         optimize_mode: maximize
     trial:
       command: python3 mnist.py
       codeDir: /nni/mnist
       gpuNum: 0

Remote mode
^^^^^^^^^^^

If run trial jobs in remote machine, users could specify the remote machine information as following format:

.. code-block:: yaml

     authorName: test
     experimentName: test_experiment
     trialConcurrency: 3
     maxExecDuration: 1h
     maxTrialNum: 10
     #choice: local, remote, pai, kubeflow
     trainingServicePlatform: remote
     searchSpacePath: /nni/search_space.json
     #choice: true, false
     useAnnotation: false
     tuner:
       #choice: TPE, Random, Anneal, Evolution
       builtinTunerName: TPE
       classArgs:
         #choice: maximize, minimize
         optimize_mode: maximize
     trial:
       command: python3 mnist.py
       codeDir: /nni/mnist
       gpuNum: 0
     #machineList can be empty if the platform is local
     machineList:
       - ip: 10.10.10.10
         port: 22
         username: test
         passwd: test
       - ip: 10.10.10.11
         port: 22
         username: test
         passwd: test
       - ip: 10.10.10.12
         port: 22
         username: test
         sshKeyPath: /nni/sshkey
         passphrase: qwert
         # Below is an example of specifying python environment.
1039
         pythonPath: ${replace_to_python_environment_path_in_your_remote_machine}
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159

PAI mode
^^^^^^^^

.. code-block:: yaml

     authorName: test
     experimentName: nni_test1
     trialConcurrency: 1
     maxExecDuration:500h
     maxTrialNum: 1
     #choice: local, remote, pai, kubeflow
     trainingServicePlatform: pai
     searchSpacePath: search_space.json
     #choice: true, false
     useAnnotation: false
     tuner:
       #choice: TPE, Random, Anneal, Evolution, BatchTuner
       #SMAC (SMAC should be installed through nnictl)
       builtinTunerName: TPE
       classArgs:
         #choice: maximize, minimize
         optimize_mode: maximize
     trial:
       command: python3 main.py
       codeDir: .
       gpuNum: 4
       cpuNum: 2
       memoryMB: 10000
       #The docker image to run NNI job on pai
       image: msranni/nni:latest
     paiConfig:
       #The username to login pai
       userName: test
       #The password to login pai
       passWord: test
       #The host of restful server of pai
       host: 10.10.10.10

Kubeflow mode
^^^^^^^^^^^^^

  kubeflow with nfs storage.

.. code-block:: yaml

     authorName: default
     experimentName: example_mni
     trialConcurrency: 1
     maxExecDuration: 1h
     maxTrialNum: 1
     #choice: local, remote, pai, kubeflow
     trainingServicePlatform: kubeflow
     searchSpacePath: search_space.json
     #choice: true, false
     useAnnotation: false
     tuner:
       #choice: TPE, Random, Anneal, Evolution
       builtinTunerName: TPE
       classArgs:
         #choice: maximize, minimize
         optimize_mode: maximize
     trial:
       codeDir: .
       worker:
         replicas: 1
         command: python3 mnist.py
         gpuNum: 0
         cpuNum: 1
         memoryMB: 8192
         image: msranni/nni:latest
     kubeflowConfig:
       operator: tf-operator
       nfs:
         server: 10.10.10.10
         path: /var/nfs/general

Kubeflow with azure storage
^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: yaml

     authorName: default
     experimentName: example_mni
     trialConcurrency: 1
     maxExecDuration: 1h
     maxTrialNum: 1
     #choice: local, remote, pai, kubeflow
     trainingServicePlatform: kubeflow
     searchSpacePath: search_space.json
     #choice: true, false
     useAnnotation: false
     #nniManagerIp: 10.10.10.10
     tuner:
       #choice: TPE, Random, Anneal, Evolution
       builtinTunerName: TPE
       classArgs:
         #choice: maximize, minimize
         optimize_mode: maximize
     assessor:
       builtinAssessorName: Medianstop
       classArgs:
         optimize_mode: maximize
     trial:
       codeDir: .
       worker:
         replicas: 1
         command: python3 mnist.py
         gpuNum: 0
         cpuNum: 1
         memoryMB: 4096
         image: msranni/nni:latest
     kubeflowConfig:
       operator: tf-operator
       keyVault:
         vaultName: Contoso-Vault
         name: AzureStorageAccountKey
       azureStorage:
         accountName: storage
         azureShare: share01