AutoStrategy#
- class braintools.trainer.AutoStrategy(prefer_fsdp=False)#
Automatically select the best strategy based on available devices.
This strategy inspects the available hardware and selects an appropriate distribution strategy.
- Parameters:
prefer_fsdp (
bool) – Whether to prefer FSDP over simple data parallelism when multiple devices are available.
Examples
The selected strategy depends on the visible devices (
'single_device'on a single CPU):>>> import braintools >>> strategy = braintools.trainer.AutoStrategy() >>> strategy.name 'auto(...)' >>> isinstance(strategy.selected_strategy, braintools.trainer.Strategy) True