Objective: reason about cost before making the model bigger.
Time does not depend only on parameter count: activation size, sequence length, batch, operations and memory transfers also count. During training, you must store weights, gradients, optimizer states and activations needed for the backward pass.
A GPU speeds up parallel computations that are large enough. Small batches, slow data loading or repeated CPU↔GPU transfers can leave it idle.
loader = DataLoader(dataset, batch_size=128, shuffle=True,
num_workers=4, pin_memory=True)Measure before optimizing. On Windows, the optimal number of workers depends
on the machine and the entry point must be protected with
if __name__ == "__main__":.
Preview — the rest of the lesson is for enrolled readers.
Your access is tied to your account, not to this link. Sign in with the same email you used in class: your course is waiting, no need to enter the code again.
Sign inNo account yet? Create oneThe first modules of the course are open to everyone. For the rest you have three options: buy this course once and for all, subscribe, or enter the code handed out in class.