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, otherwise inferred based on prefer and require.
- verbose: int = 10#
If greater than zero, prints progress messages.
- class ExpLauncher(experiment_runner: ~collections.abc.Callable[[~tianshou.highlevel.experiment.Experiment], ~tianshou.data.stats.InfoStats | None] = <function ExpLauncher.<lambda>>)[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. Allows arbitrary things to happen during experiment execution, so use it 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[[~tianshou.highlevel.experiment.Experiment], ~tianshou.data.stats.InfoStats | None] = <function ExpLauncher.<lambda>>)[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. Allows arbitrary things to happen during experiment execution, so use it with caution!.
- class JoblibExpLauncher(joblib_cfg: ~tianshou.evaluation.launcher.JoblibConfig | None = None, experiment_runner: ~collections.abc.Callable[[~tianshou.highlevel.experiment.Experiment], ~tianshou.data.stats.InfoStats | None] = <function JoblibExpLauncher.<lambda>>)[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. Allows arbitrary things to happen during experiment execution, so use it with caution!.