launcher#
Source code: tianshou/evaluation/launcher.py
Provides a basic interface for launching experiments. The API is experimental and subject to change!.
- class JoblibConfig(n_jobs: int = -1, backend: Literal['loky', 'multiprocessing', 'threading'] | None = 'loky', verbose: int = 10)[source]#
Bases:
object- n_jobs: int = -1#
The maximum number of concurrently running jobs. If -1, all CPUs are used.
- backend: Literal['loky', 'multiprocessing', 'threading'] | None = 'loky'#
Allows to hard-code backend, None means it will be inferred automatically.
- verbose: int = 10#
If greater than zero, prints progress messages.
- default_experiment_execution(exp: Experiment) InfoStats | None[source]#
The default execution simply runs the experiment and returns the trainer result.
- class ExpLauncher(experiment_runner: ~collections.abc.Callable[[Experiment], ~tianshou.data.stats.InfoStats | None] = <function default_experiment_execution>)[source]#
Bases:
ABCBase interface for launching multiple experiments simultaneously.
- Parameters:
experiment_runner – determines how an experiment is to be executed. Overriding the default can be useful, e.g., for using high-level interfaces to set up an experiment (or an experiment collection) and tinkering with it prior to execution. This need often arises when prototyping with mechanisms that are not yet supported by the high-level interfaces. Deviation from the default allows arbitrary things to happen during experiment execution, so use this option with caution!.
- launch(experiments: Sequence[Experiment]) list[InfoStats | None][source]#
Will return the results of successfully executed experiments.
If a single experiment is passed, will not use parallelism and run it in the main process. Failed experiments will be logged, and a RuntimeError is only raised if all experiments have failed.
- class SequentialExpLauncher(experiment_runner: ~collections.abc.Callable[[Experiment], ~tianshou.data.stats.InfoStats | None] = <function default_experiment_execution>)[source]#
Bases:
ExpLauncherConvenience wrapper around a simple for loop to run experiments sequentially.
- Parameters:
experiment_runner – determines how an experiment is to be executed. Overriding the default can be useful, e.g., for using high-level interfaces to set up an experiment (or an experiment collection) and tinkering with it prior to execution. This need often arises when prototyping with mechanisms that are not yet supported by the high-level interfaces. Deviation from the default allows arbitrary things to happen during experiment execution, so use this option with caution!.
- class JoblibExpLauncher(joblib_cfg: ~tianshou.evaluation.launcher.JoblibConfig | None = None, experiment_runner: ~collections.abc.Callable[[Experiment], ~tianshou.data.stats.InfoStats | None] = <function default_experiment_execution>)[source]#
Bases:
ExpLauncher- Parameters:
experiment_runner – determines how an experiment is to be executed. Overriding the default can be useful, e.g., for using high-level interfaces to set up an experiment (or an experiment collection) and tinkering with it prior to execution. This need often arises when prototyping with mechanisms that are not yet supported by the high-level interfaces. Deviation from the default allows arbitrary things to happen during experiment execution, so use this option with caution!.