@@ -114,7 +114,7 @@ explanation of each field as a comment:
114114 device : # cpu | cuda
115115 max_cpus : # > 1 for parallelism
116116 max_gpus : # > 0 for gpu usage (device must be cuda though)
117- gpus_per_task : # percentage of gpus to allocate for each task
117+ gpus_per_task : # Ray GPUs per task: fraction (<=1) or integer (>1 enables DDP)
118118 gpus_subset : # optional, comma-separated list of gpu indices, e.g. 0,2. Used to force a particular subset of GPUs being used.
119119
120120
@@ -133,16 +133,16 @@ explanation of each field as a comment:
133133
134134
135135 # Experiment
136- result_folder : # path of the folder where to store results
137- exp_name : # name of the experiment
138- experiment : # dotted path to experiment class
139- model_selection_criteria : # ordered model-selection criteria
140- - metric : main_score
141- direction : max
142- evaluate_every : # evaluate on train/val/test every `n` epochs and log results
143- risk_assessment_training_runs : # how many final (model assessment) training runs to perform to mitigate bad initializations
144- model_selection_training_runs : # how many training runs to perform for each hyper-parameter configuration in a specific inner fold
145- training_timeout_seconds : # optional max time (in seconds) for a single training run (-1 disables the timeout)
136+ result_folder : # path of the folder where to store results
137+ exp_name : # name of the experiment
138+ experiment : # dotted path to experiment class
139+ model_selection_criteria : # ordered model-selection criteria
140+ - metric : main_score
141+ direction : max
142+ evaluate_every : # evaluate on train/val/test every `n` epochs and log results
143+ risk_assessment_training_runs : # how many final (model assessment) training runs to perform to mitigate bad initializations
144+ model_selection_training_runs : # how many training runs to perform for each hyper-parameter configuration in a specific inner fold
145+ training_timeout_seconds : # optional max time (in seconds) for a single training run (-1 disables the timeout)
146146
147147 # Grid Search
148148 # if only 1 configuration is selected, any inner model selection will be skipped
@@ -192,12 +192,12 @@ explanation of each field as a comment:
192192 main_scorer : mlwiz.training.callback.metric.MulticlassAccuracy
193193 my_second_metric : mlwiz.training.callback.metric.ToyMetric
194194
195- # Training engine
196- engine :
197- class_name : mlwiz.training.engine.TrainingEngine
198- args :
199- mixed_precision : False # set to True to enable torch AMP autocast (CUDA/CPU)
200- mixed_precision_dtype : torch.float16 # torch.float16 | torch.bfloat16
195+ # Training engine
196+ engine :
197+ class_name : mlwiz.training.engine.TrainingEngine
198+ args :
199+ mixed_precision : False # set to True to enable torch AMP autocast (CUDA/CPU)
200+ mixed_precision_dtype : torch.float16 # torch.float16 | torch.bfloat16
201201
202202 # Gradient clipper (optional)
203203 gradient_clipper : null
@@ -244,6 +244,22 @@ Here we can define how many resources to allocate to parallelize different exper
244244 max_gpus : 2
245245 gpus_per_task : 0.5
246246
247+ For **Distributed Data Parallel (DDP) **, set ``gpus_per_task `` to an integer greater than 1.
248+ When ``device: cuda ``, MLWiz automatically switches to DDP inside each Ray task.
249+
250+ .. code-block :: yaml
251+
252+ # one experiment uses 2 GPUs with DDP
253+ # with max_gpus: 4, Ray can run up to 2 such experiments in parallel
254+ device : cuda
255+ max_cpus : 24
256+ max_gpus : 4
257+ gpus_per_task : 2
258+
259+ MLWiz shards the training data with ``DistributedSampler `` and keeps a single set of
260+ experiment artifacts (rank 0 writes logs/checkpoints/plots). If a rank fails, check
261+ ``ddp_rank_0.log ``, ``ddp_rank_1.log ``, ... inside the run folder.
262+
247263
248264
249265Data Loading
@@ -271,26 +287,26 @@ our results:
271287
272288.. code-block :: yaml
273289
274- result_folder : RESULTS
275- exp_name : mlp
276- experiment : mlwiz.experiment.MLP
277- model_selection_criteria :
278- - metric : main_score
279- direction : max
280- evaluate_every : 3
281- risk_assessment_training_runs : 3
282- model_selection_training_runs : 2
283- training_timeout_seconds : -1 # set to a positive value to enforce a per-run time budget
284-
285- ``higher_results_are_better `` is still supported as a legacy shortcut for a
286- single ``main_score `` criterion, but it cannot be used together with
287- ``model_selection_criteria ``.
288-
289- By default MLWiz will run each training session until either the configured number of epochs is reached or the early
290- stopper halts it. If you need to cap the wall-clock time of each run, set ``training_timeout_seconds `` to a positive
291- value. The :class: `~mlwiz.training.engine.TrainingEngine ` tracks the elapsed time (including previous attempts when
292- resuming from checkpoints) and stops scheduling additional epochs once the limit is reached, logging the reason for the
293- interruption. Keeping checkpointing enabled lets you safely resume from where the timeout was triggered.
290+ result_folder : RESULTS
291+ exp_name : mlp
292+ experiment : mlwiz.experiment.MLP
293+ model_selection_criteria :
294+ - metric : main_score
295+ direction : max
296+ evaluate_every : 3
297+ risk_assessment_training_runs : 3
298+ model_selection_training_runs : 2
299+ training_timeout_seconds : -1 # set to a positive value to enforce a per-run time budget
300+
301+ ``higher_results_are_better `` is still supported as a legacy shortcut for a
302+ single ``main_score `` criterion, but it cannot be used together with
303+ ``model_selection_criteria ``.
304+
305+ By default MLWiz will run each training session until either the configured number of epochs is reached or the early
306+ stopper halts it. If you need to cap the wall-clock time of each run, set ``training_timeout_seconds `` to a positive
307+ value. The :class: `~mlwiz.training.engine.TrainingEngine ` tracks the elapsed time (including previous attempts when
308+ resuming from checkpoints) and stops scheduling additional epochs once the limit is reached, logging the reason for the
309+ interruption. Keeping checkpointing enabled lets you safely resume from where the timeout was triggered.
294310
295311
296312Grid Search
@@ -301,6 +317,7 @@ you can define lists associated to an hyper-parameter and all possible combinati
301317nesting of these combinations for maximum flexibility.
302318
303319There is one config file ``examples/MODEL_CONFIGS/config_MLP.yml `` that you can check to get a better idea.
320+ For a multi-GPU DDP setup, refer to ``examples/MODEL_CONFIGS/config_MLP_ddp.yml ``.
304321
305322
306323Random Search
332349
333350.. code-block :: bash
334351
335- mlwiz-exp --config-file examples/MODEL_CONFIGS/config_MLP.yml
352+ mlwiz-exp --config-file examples/MODEL_CONFIGS/config_MLP_ddp.yml
353+
336354
337355
338356 And we are up and running!
@@ -357,35 +375,35 @@ to you, please consider reading `Samy Bengio's lecture (Part 3) <https://bengio.
357375Navigating the live progress UI
358376^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
359377
360- The progress screen is interactive. Press ``: `` to open the small prompt in the bottom-right corner, type a command, and
361- hit ``Enter `` to switch what is rendered without stopping the run. Useful commands:
362-
363- - ``: `` (or ``:g `` / ``:global ``): go back to the default overview with all progress bars.
364- - ``:r `` (or ``:refresh ``): redraw the currently selected view (handy if the terminal layout gets messy).
365- - ``:<outer> <run> `` (e.g., ``:1 2 ``): focus the *risk assessment * run number ``run `` of outer fold ``outer `` (numbers start at 1).
366- - ``:<outer> <inner> <config> <run> `` (e.g., ``:2 1 3 1 ``): focus a *model selection * run for a specific config inside an outer/inner fold pair.
367-
368- Global overview (default view):
369-
370- .. image :: _static/exp_gui.png
371- :width: 600
372-
373- If an identifier is invalid or the run has not produced updates yet, MLWiz will print a short hint and keep listening so
374- you can try again.
375-
376- You can also use the arrow keys:
377-
378- - **left/right **: move across runs/configurations within the currently selected view.
379- - **up/down **: toggle between the most recently visited model selection view and risk assessment view.
380-
381- Focused run view (same as what you see when running with ``--debug ``):
382-
383- .. image :: _static/run_view.png
384- :width: 600
385-
386- To stop the computation, use ``CTRL-C `` to send a ``SIGINT `` signal, and consider using the command ``ray stop `` to stop
387- all Ray processes. **Warning: ** ``ray stop `` stops **all ** ray processes you have launched, including those of other
388- experiments in progress, if any.
378+ The progress screen is interactive. Press ``: `` to open the small prompt in the bottom-right corner, type a command, and
379+ hit ``Enter `` to switch what is rendered without stopping the run. Useful commands:
380+
381+ - ``: `` (or ``:g `` / ``:global ``): go back to the default overview with all progress bars.
382+ - ``:r `` (or ``:refresh ``): redraw the currently selected view (handy if the terminal layout gets messy).
383+ - ``:<outer> <run> `` (e.g., ``:1 2 ``): focus the *risk assessment * run number ``run `` of outer fold ``outer `` (numbers start at 1).
384+ - ``:<outer> <inner> <config> <run> `` (e.g., ``:2 1 3 1 ``): focus a *model selection * run for a specific config inside an outer/inner fold pair.
385+
386+ Global overview (default view):
387+
388+ .. image :: _static/exp_gui.png
389+ :width: 600
390+
391+ If an identifier is invalid or the run has not produced updates yet, MLWiz will print a short hint and keep listening so
392+ you can try again.
393+
394+ You can also use the arrow keys:
395+
396+ - **left/right **: move across runs/configurations within the currently selected view.
397+ - **up/down **: toggle between the most recently visited model selection view and risk assessment view.
398+
399+ Focused run view (same as what you see when running with ``--debug ``):
400+
401+ .. image :: _static/run_view.png
402+ :width: 600
403+
404+ To stop the computation, use ``CTRL-C `` to send a ``SIGINT `` signal, and consider using the command ``ray stop `` to stop
405+ all Ray processes. **Warning: ** ``ray stop `` stops **all ** ray processes you have launched, including those of other
406+ experiments in progress, if any.
389407
390408Useful Features to Know About
391409------------------------------
0 commit comments