Shortcuts

SingleHPUStrategy

class lightning.pytorch.strategies.SingleHPUStrategy(device='hpu', accelerator=None, checkpoint_io=None, precision_plugin=None)[source]

Bases: SingleDeviceStrategy

Strategy for training on single HPU device.

Warning

This is an experimental feature.

model_to_device()[source]

Moves the model to the correct device.

Return type

None

optimizer_step(optimizer, closure, model=None, **kwargs)[source]

Performs the actual optimizer step.

Parameters
  • optimizer (Optimizer) – the optimizer performing the step

  • closure (Callable[[], Any]) – closure calculating the loss value

  • model (Union[LightningModule, Module, None]) – reference to the model, optionally defining optimizer step related hooks

  • **kwargs – Keyword arguments to optimizer.step

Return type

Any

setup(trainer)[source]

Setup plugins for the trainer fit and creates optimizers.

Parameters

trainer (Trainer) – the trainer instance

Return type

None

setup_optimizers(trainer)[source]

Creates optimizers and schedulers.

Parameters

trainer (Trainer) – the Trainer, these optimizers should be connected to

Return type

None