experiment_config.rst 10 KB
Newer Older
liuzhe-lz's avatar
liuzhe-lz committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
77
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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
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
376
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
430
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
474
475
476
477
478
479
480
481
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
565
566
567
568
569
570
571
572
573
===========================
Experiment Config Reference
===========================

This is the detailed list of experiment config fields.
For quick start guide, reference the tutorial instead. [TODO]

Notes
=====

1. This document list field names as separated words.
   They should be spelled in ``snake_case`` for Python library ``nni.experiment``, and are normally spelled in ``camelCase`` for YAML files.

2. In this document type of fields are expressed in `Python type hint <https://docs.python.org/3/library/typing.html>`__ format.
   Therefore JSON objects are called `dict` and arrays are called `list`.

.. _Path:
.. _directory:

3. Some fields take a path to file or directory.
   Unless otherwise noted, both absolute path and relative path are supported, and ``~`` can be used for home directory.

   - When written in YAML file, relative paths are relative to the directory containing that file.
   - When assigned in Python code, relative paths are relative to current working directory.
   - All relative paths are converted to absolute when loading YAML file into Python class, and when saving Python class to YAML file.

4. Setting a field to ``None`` or ``null`` is equivalent to not setting the field.

ExperimentConfig
================

experiment name
---------------

Mnemonic name of the experiment. This will be shown in web UI and nnictl.

type: ``Optional[str]``


search space file
-----------------

Path_ to a JSON file containing the search space.

type: ``Optional[str]``

Search space format is determined by tuner. Common format for built-in tuners is documeted `here <../Tutorial/SearchSpaceSpec.html>`__.

Mutually exclusive to `search space`_.


search space
------------

Search space object.

type: ``Optional[Any]``

The format is determined by tuner. Common format for built-in tuners is documented `here <../Tutorial/SearchSpaceSpec.html>`__.

Note that ``None`` means "no such field" so empty search space should be written as ``{}``.

Mutually exclusive to `search space file`_.


trial command
-------------

Command(s) to launch trial.

type: ``str``

Bash will be used on Linux and macOS. PowerShell will be used on Windows.


trial code directory
--------------------

`Path`_ to the directory containing trial source files.

type: ``str``

default: ``"."``

All files in this directory will be sent to training machine, unless there is a ``.nniignore`` file [TODO:link]


trial concurrency
-----------------

Specify how many trials should be run concurrently.

type: ``int``

The real concurrency also depends on hardware resources and may be less than this value.


trial gpu number
----------------

Number of GPUs used by each trial.

type: ``Optional[int]``

If set to zero, trials will have no access to any GPU. 

If not specified, trials will be created and scheduled as if they do not use GPU,
but they can still access all GPUs on the training machine.


max experiment duration
-----------------------

Limit the duration of this experiment if specified.

type: ``Optional[str]``

format: ``number + s|m|h|d``

examples: ``"10m"``, ``"0.5h"``

When time runs out, the experiment will stop creating trials but continue to serve web UI.


max trial number
----------------

Limit the number of trials to create if specified.

type: ``Optional[int]``

When the budget runs out, the experiment will stop creating trials but continue to serve web UI.


nni manager ip
--------------

IP of current machine, used by training machines to access NNI manager. Not used in local mode.

type: ``Optional[str]``

If not specified, this will be the default IPv4 address of outgoing connection.


use annotation
--------------

Enable `annotation <../Tutorial/AnnotationSpec.html>`__.

type: ``bool``

default: ``False``

When using annotation, `search space`_ and `search space file`_ should not be specified manually.


debug
-----

Enable debug mode.

type: ``bool``

default: ``False``

When enabled, logging will be more verbose and some internal validation will be loosen.


log level
---------

Set log level of whole system.

type: ``Optional[str]``

values: ``"trace"``, ``"debug"``, ``"info"``, ``"warning"``, ``"error"``, ``"fatal"``

Defaults to "info" or "debug", depending on `debug`_ option.

Most modules of NNI will be affected by this value, including NNI manager, tuner, training service, etc.

The exception is trial, whose logging level is directly managed by trial code.

For Python modules, "trace" acts as ``logging.DEBUG`` and "fatal" acts as ``logging.CRITICAL``.


experiment working directory
----------------------------

Specify the `directory`_ to place log, checkpoint, metadata, and other run-time stuff.

type: ``Optional[str]``

By default uses ``~/nni-experiments``.

NNI will create a subdirectory named by experiment ID, so it is safe to use same directory for multiple experiments.


tuner gpu indices
-----------------

Limit the GPUs visible to tuner, assessor, and advisor.

type: ``Optional[Union[list[int], str]]``

This will be the ``CUDA_VISIBLE_DEVICES`` environment variable of tuner process.

Because tuner, assessor, and advisor run in same process, this option will affect them all.


tuner
-----

Specify the tuner [TODO:link]

type: Optional `AlgorithmConfig`_


assessor
--------

Specify the assessor [TODO:link]

type: Optional `AlgorithmConfig`_


advisor
-------

Specify the advisor [TODO:link]

type: Optional `AlgorithmConfig`_


training service
----------------

Specify `training service <../TrainingService/Overview.html>`__.

type: `TrainingServiceConfig`_


AlgorithmConfig
===============

[TODO:short description]

name
----

Name of built-in or registered [TODO:link] algorithm.

type: ``str`` for built-in and registered algorithm, ``None`` for custom algorithm


class name
----------

Qualified class name of custom algorithm.

type: ``str`` for custom algorithm, ``None`` for built-in and registered algorithm

example: ``"my_tuner.MyTuner"``


code directory
--------------

`Path`_ to directory containing the custom algorithm class.

type: ``Optional[str]`` for custom algorithm, ``None`` for built-in and registered algorithm

If not specified, the `class name`_ will be looked up in Python's `module search path <https://docs.python.org/3/tutorial/modules.html#the-module-search-path>`__


class args
----------

Keyword arguments passed to algorithm class' constructor.

type: ``Optional[dict[str, Any]]``

See algorithm's document for supported value.


TrainingServiceConfig
=====================

One of following:

  - `LocalConfig`_
  - `RemoteConfig`_
  - `OpenPaiConfig`_


LocalConfig
===========

Detailed `here <../TrainingService/LocalMode.html>`__.

platform
--------

Constant string ``"local"``.


use active gpu
--------------

Specify whether NNI should submit trials to GPUs occupied by other tasks.

type: ``bool``

If your are using desktop system with GUI, set this to ``True``.

// need to discuss default value


max trial number per gpu
------------------------

Specify how many trials can share one GPU.

type: ``int``

default: ``1``


gpu indices
-----------

Limit the GPUs visible to trial processes.

type: ``Optional[Union[list[int], str]]``

If `trial gpu number`_ is less than the length of this value, only a subset will be visible to each trial.

This will be used as ``CUDA_VISIBLE_DEVICES`` environment variable.


RemoteConfig
============

Detailed `here <../TrainingService/RemoteMachineMode.html>`__.

platform
--------

Constant string ``"remote"``.


machine list
------------

List of training machines.

type: list of `RemoteMachineConfig`_


reuse mode
----------

Enable reuse mode [TODO]

type: bool


RemoteMachineConfig
===================

host
----

IP or hostname (domain name) of the machine.

type: ``str``


port
----

SSH service port.

type: ``int``

default: 22


user
----

Login user name.

type: ``str``


password
--------

Login password.

type: ``Optional[str]``

If not specified, `ssh key file`_ will be used instead.


ssh key file
------------

`Path`_ to ssh key file (identity file).

type: ``str``

default: ``"~/.ssh/id_rsa"``

Only used when `password`_ is not specified.


ssh passphrase
--------------

Passphrase of SSH identity file.

type: ``Optional[str]``


use active gpu
--------------

Specify whether NNI should submit trials to GPUs occupied by other tasks.

type: ``bool``


max trial number per gpu
------------------------

Specify how many trials can share one GPU.

type: ``int``

default: ``1``


gpu indices
-----------

Limit the GPUs visible to trial processes.

type: ``Optional[Union[list[int], str]]``

If `trial gpu number`_ is less than the length of this value, only a subset will be visible to each trial.

This will be used as ``CUDA_VISIBLE_DEVICES`` environment variable.


trial prepare command
---------------------

Command(s) to run before launching each trial.

type: ``Optional[str]``

This is useful if preparing steps vary for different machines.


OpenPaiConfig
=============

Detailed `here <../TrainingService/PaiMode.html>`__.

platform
--------

Constant string ``"openpai"``.


host
----

Hostname of OpenPAI service.

type: ``str``


username
--------

OpenPAI user name.

type: ``str``


token
-----

OpenPAI user token.

type: ``str``

This can be found in your OpenPAI user settings page.


trial cpu number
----------------

Number of CPUs used by each trial.

type: ``int``

default: ``1``


trial memory size
-----------------

Memory used by each trial.

type: ``str``

examples: ``"1gb"``, ``"512mb"``


docker image
------------

Name and tag of docker image to run the trials.

type: ``str``

default: ``"msranni/nni:latest"``


reuse mode
----------

Enable reuse mode.

type: ``bool``

default: ``False``


nni manager storage mount point
-------------------------------

`Mount point <path>`_ of storage service (typically NFS) on current machine.

type: ``str``


container storage mount point
-----------------------------

Mount point of storage service (typically NFS) in docker container.

type: ``str``

This must be an absolute path.


open pai config
---------------

Embedded OpenPAI config file.

type: ``Optional[Dict[str, Any]]``


open pai config file
--------------------

`Path`_ to OpenPAI