Cerebras PyTorch Layer API

Cerebras PyTorch Layer API implements a subset of PyTorch APIs with our custom implementation that takes advantage of our high-performance kernels and provides extra functionalities as compared to the native PyTorch version. The extra functionalities are optional and opt-in; if you don’t use the extra functionalities, then the Layer API is equivalent to the native PyTorch version.


Cerebras has moved away from huggingface model implementations in favor for our own PyTorch layer API. One of the many benefits of using our PyTorch layer API is that it is designed to be (near) drop-in compatible with the transformer layers that are included in PyTorch. It is not possible (at least for T5 and Transformer) to maintain the same naming scheme in the migrated model as in the original.

Supported PyTorch Optimizers

Cerebras PyTorch Optimizers implement most PyTorch optimizers under torch.optim namespace as drop-in replacement with the exact semantic. Our implementation take advantage of our hardware capabilities and support fallback on GPU or CPU depend on the target device.

Supported optimizers:

  1. SGD

  2. SGDM

  3. rmsprop

  4. adadelta

  5. Lamb

  6. radam

  7. adamax

  8. adafactor

  9. adagrad

  10. adam

  11. adamw

  12. asgd

  13. nadam

  14. rprop

Supported PyTorch Ops

If your model implementation requires additional PyTorch Ops beyond the layer APIs above, Cerebras also supports the following PyTorch operations.


The following list of supported PyTorch ops is very preliminary. We cannot guarantee that mixing and matching them in your models will work. Support is only provided for the way they are used in the Cerebras Model Zoo.