Run Very Large Language Models on Your Computer
To be able to run the model, we need to split it: Some parts of the model will be on the GPU VRAM, on the CPU RAM, and on the hard disk. We can achieve this split very easily with Accelerate. Let's have a look at how splitting works with the following code: Here "infer_auto_device_map" will infer the optimal split of the model to load as much as possible of the model on the GPU VRAM, then on the CPU RAM, and finally on the hard disk. You can see that the split is not done at the layer level and that components of the same layer may be on different devices. For instance, for layer 7, the self-attention layer norm is on the GPU, but the final layer norm is on the CPU RAM.
Dec-22-2022, 13:50:45 GMT
- Technology: