Learn how to set up a backend or device for the Trainer class.
cerebras.pytorch.backend
is simply the configuration of the device and other settings used during a run. The device
is simply what hardware the workflow will run on.
Trainer
can be done by simply specifying one of "CSX"
, "CPU"
, or "GPU"
.
device
still creates a cerebras.pytorch.backend
instance just with default settings. To configure anything about the backend, you must specify those parameters via the backend
key instead.Trainer
instances must also use the same device type as well. You cannot mix device types. For example, a configuration like this:
Trainer
can be done by creating a cerebras.pytorch.backend
instance.
The configuration is expected to be a dictionary whose keys will be used to construct a cerebras.pytorch.backend
instance.
In the Python script, construct a cerebras.pytorch.backend
instance and pass it to the backend
argument.
Trainer
instances, you must ensure you only instantiate backends of a single device type. However you can change other backend parameters between Trainer
instances.
The configuration is expected to be a dictionary whose keys will be used to construct a cerebras.pytorch.backend
instance.
In the Python script, construct a cerebras.pytorch.backend
instance and pass it to the backend
argument.
For example:
device
and backend
arguments are mutually exclusive. It is expected when initializing a Trainer
to set one of them but not both. If both are set, you will see an error that looks like this:
Trainer
in some core workflows, you can check out:
To learn more about how you can extend the capabilities of the Trainer
class, you can check out: