PyTorch Runtime Requirements
On This Page
PyTorch Runtime Requirements¶
Parameters¶
With cbtorch.Session()
you must pass in the parameter values for dataloader
and mode
into the session object. See line 73 in the simple-py example.
Getting data mid-execution¶
If you want to get the data from the Cerebras system in mid-execution, you must do it inside of a step closure, using session.add_step_closure(...)
(line 102), where session
is an instance of the cbtorch.Session
class.
This is because if the data is requested mid-execution, then PyTorch halts the execution until the data is returned to the user. This will lead to significant performance degradation, slowing down the training job considerably. Hence, we strongly recommend that you fetch the data only in step closures, as this enforces that data is only fetched between executions.
Printing data to stdout¶
When you want to print the data to stdout or stderr, use cbtorch.core.cb_model.master_print
. See line 111 in simple-py example. This function ensures that the print only happens a single time instead of once per worker.
Attention
Also see the Limitations of PyTorch on Cerebras section.